Sponsored Content
Full Discussion: sed problem
Top Forums UNIX for Dummies Questions & Answers sed problem Post 302653815 by bartus11 on Sunday 10th of June 2012 01:53:08 PM
Old 06-10-2012
It can be done easily with Perl: Lingua::EN::Numbers - search.cpan.org
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sed Problem

I AM TRYING TO APPEND THE HOSTNAME OF A UNIX SERVER I WORK WITH SO I COULD DO A LOADING INTO A DATABASE. THE COMMAND I AM USING IS df -k | sed 's/^/dataserver /' What I intend to do is append the hostname dynamically by using the hostname command instead of having to manually enter... (1 Reply)
Discussion started by: Chelsea
1 Replies

2. UNIX for Dummies Questions & Answers

sed problem

Hi, I have a large 0.5gb xml file called ab_cd.xml which looks like this: <?xml version="1.0"?> <AB:report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://abc.com/ab_reporting AB_Reporting_3.xsd" xmlns:AB="http://abc.com/ab_reporting"> -------- --------... (3 Replies)
Discussion started by: ravykanth
3 Replies

3. UNIX for Dummies Questions & Answers

Problem with sed

Hi , echo "07/05/2008" | sed 's/\(..\)\/\(..\)\/\(..\)/\3\2\1/' Output :: 20050708 Expected output is 20080507 Iam not getting the bug in this. Thanks for the help -- penchal (4 Replies)
Discussion started by: penchal_boddu
4 Replies

4. Shell Programming and Scripting

Problem with SED

Hi, I have to use SED to remove the prefix "219-" from a text file containing phone numbers and I have to remove the ":" as well. I write the following code but it does not seem to work. Can someone help me please? mohit@mohit-desktop:~$ sed -n s/219-/" "/p corp_phones_bak > noprefix1... (2 Replies)
Discussion started by: mojoman
2 Replies

5. Shell Programming and Scripting

Problem in sed.

Hi All! I am trying to use shell variables in a sed statement, but facing an error.I used the double quotes instead if single quotes in the sed statement. # sed -i -e "s/password/$decoded/g;" $CATALINA_HOME/conf/server.xml sed: -e expression #1, char 11: unterminated `s' command # ... (5 Replies)
Discussion started by: nua7
5 Replies

6. Shell Programming and Scripting

Sed Problem

I have a file which contain many lines see below. "/var/www/abc>" I want to remove Both of these values "" and > (5 Replies)
Discussion started by: aliahsan81
5 Replies

7. Shell Programming and Scripting

SED - Problem

I have a file with a lot of numbers in it and I need to clean it up and make it look nice and proper. I found this little gem of a one-liner and basically understand what it is doing but I would like to further understand what each part of the command is doing. Being a newb, I am just trying to... (2 Replies)
Discussion started by: genedc1
2 Replies

8. Programming

sed problem

Hi all In input file I have records like this: 0,1,0,87,0,0,"6,87","170,03",0,"43,5",0,0,0,0,"6,87","126,53"and in output file I need that these records transforms in : 0 1 0 87 0 0 6,87 170,03 0 43,5 0 0 0 0 6,87 126,53 Could you help me in this case? Please (3 Replies)
Discussion started by: shizik
3 Replies

9. Shell Programming and Scripting

sed problem

Hi i am stuck with a very silly problem :mad: below is my code echo 201010_1212_121.xml i need to replace xml with csv so i did echo 201010_1212_121.xml | sed 's/.*\.xml/.*\.csv/' echo 201010_1212_121.xml | sed 's/*.xml/*.csv/' echo 201010_1212_121.xml |... (4 Replies)
Discussion started by: aishsimplesweet
4 Replies

10. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies
Lingua::Stem::Snowball(3pm)				User Contributed Perl Documentation			       Lingua::Stem::Snowball(3pm)

NAME
Lingua::Stem::Snowball - Perl interface to Snowball stemmers. SYNOPSIS
my @words = qw( horse hooves ); # OO interface: my $stemmer = Lingua::Stem::Snowball->new( lang => 'en' ); $stemmer->stem_in_place( @words ); # qw( hors hoov ) # Functional interface: my @stems = stem( 'en', @words ); DESCRIPTION
Stemming reduces related words to a common root form -- for instance, "horse", "horses", and "horsing" all become "hors". Most commonly, stemming is deployed as part of a search application, allowing searches for a given term to match documents which contain other forms of that term. This module is very similar to Lingua::Stem -- however, Lingua::Stem is pure Perl, while Lingua::Stem::Snowball is an XS module which provides a Perl interface to the C version of the Snowball stemmers. (<http://snowball.tartarus.org>). Supported Languages The following stemmers are available (as of Lingua::Stem::Snowball 0.95): |-----------------------------------------------------------| | Language | ISO code | default encoding | also available | |-----------------------------------------------------------| | Danish | da | ISO-8859-1 | UTF-8 | | Dutch | nl | ISO-8859-1 | UTF-8 | | English | en | ISO-8859-1 | UTF-8 | | Finnish | fi | ISO-8859-1 | UTF-8 | | French | fr | ISO-8859-1 | UTF-8 | | German | de | ISO-8859-1 | UTF-8 | | Hungarian | hu | ISO-8859-1 | UTF-8 | | Italian | it | ISO-8859-1 | UTF-8 | | Norwegian | no | ISO-8859-1 | UTF-8 | | Portuguese | pt | ISO-8859-1 | UTF-8 | | Romanian | ro | ISO-8859-2 | UTF-8 | | Russian | ru | KOI8-R | UTF-8 | | Spanish | es | ISO-8859-1 | UTF-8 | | Swedish | sv | ISO-8859-1 | UTF-8 | | Turkish | tr | UTF-8 | | |-----------------------------------------------------------| Benchmarks Here is a comparison of Lingua::Stem::Snowball and Lingua::Stem, using The Works of Edgar Allen Poe, volumes 1-5 (via Project Gutenberg) as source material. It was produced on a 3.2GHz Pentium 4 running FreeBSD 5.3 and Perl 5.8.7. (The benchmarking script is included in this distribution: devel/benchmark_stemmers.plx.) |--------------------------------------------------------------------| | total words: 454285 | unique words: 22748 | |--------------------------------------------------------------------| | module | config | avg secs | rate | |--------------------------------------------------------------------| | Lingua::Stem 0.81 | no cache | 2.029 | 223881 | | Lingua::Stem 0.81 | cache level 2 | 1.280 | 355025 | | Lingua::Stem::Snowball 0.94 | stem | 1.426 | 318636 | | Lingua::Stem::Snowball 0.94 | stem_in_place | 0.641 | 708495 | |--------------------------------------------------------------------| METHODS
/ FUNCTIONS new my $stemmer = Lingua::Stem::Snowball->new( lang => 'es', encoding => 'UTF-8', ); die $@ if $@; Create a Lingua::Stem::Snowball object. new() accepts the following hash style parameters: o lang: An ISO code taken from the table of supported languages, above. o encoding: A supported character encoding. Be careful with the values you supply to new(). If "lang" is invalid, Lingua::Stem::Snowball does not throw an exception, but instead sets $@. Also, if you supply an invalid combination of values for "lang" and "encoding", Lingua::Stem::Snowball will not warn you, but the behavior will change: stem() will always return undef, and stem_in_place() will be a no-op. stem @stemmed = $stemmer->stem( WORDS, [IS_STEMMED] ); @stemmed = stem( ISO_CODE, WORDS, [LOCALE], [IS_STEMMED] ); Return lowercased and stemmed output. WORDS may be either an array of words or a single scalar word. In a scalar context, stem() returns the first item in the array of stems: $stem = $stemmer->stem($word); $first_stem = $stemmer->stem(@words); # probably wrong LOCALE has no effect; it is only there as a placeholder for backwards compatibility (see Changes). IS_STEMMED must be a reference to a scalar; if it is supplied, it will be set to 1 if the output differs from the input in some way, 0 otherwise. stem_in_place $stemmer->stem_in_place(@words); This is a high-performance, streamlined version of stem() (in fact, stem() calls stem_in_place() internally). It has no return value, instead modifying each item in an existing array of words. The words must already be in lower case. lang my $lang = $stemmer->lang; $stemmer->lang($iso_language_code); Accessor/mutator for the lang parameter. If there is no stemmer for the supplied ISO code, the language is not changed (but $@ is set). encoding my $encoding = $stemmer->encoding; $stemmer->encoding($encoding); Accessor/mutator for the encoding parameter. stemmers my @iso_codes = stemmers(); my @iso_codes = $stemmer->stemmers(); Returns a list of all valid language codes. REQUESTS &; BUGS Please report any requests, suggestions or bugs via the RT bug-tracking system at http://rt.cpan.org/ or email to bug-Lingua-Stem-Snowball@rt.cpan.org. http://rt.cpan.org/NoAuth/Bugs.html?Dist=Lingua-Stem-Snowball is the RT queue for Lingua::Stem::Snowball. Please check to see if your bug has already been reported. AUTHORS
Lingua::Stem::Snowball was originally developed to provide access to stemming algorithms for the OpenFTS (full text search engine) project (<http://openfts.sourceforge.net>), by Oleg Bartunov, <oleg at sai dot msu dot su> and Teodor Sigaev, <teodor at stack dot net>. Currently maintained by Marvin Humphrey <marvin at rectangular dot com>. Previously maintained by Fabien Potencier <fabpot at cpan dot org>. COPYRIGHT AND LICENSE
Perl bindings copyright 2004-2008 by Marvin Humphrey, Fabien Potencier, Oleg Bartunov and Teodor Sigaev. This software may be freely copied and distributed under the same terms and conditions as Perl. Snowball files and stemmers are covered by the BSD license. SEE ALSO
<http://snowball.tartarus.org>, Lingua::Stem. perl v5.14.2 2011-11-15 Lingua::Stem::Snowball(3pm)
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy