Re: best method to perform operations on word lists



Francois Massion wrote:

[...]
#!perl
use strict; use warnings;
my $list =
"überzeugt
überzeugt,
überzogen
überzogen,
überzogen.
üblich
übliche
üblichen
üblicherweise";
my @terms = split /\n/, $list;
my $prev = 'nonesuch584685542256RANOM58544';

This didn't modify the list.

I didn't mean to modify $list; the new content is in @terms. If you
want $list to contain the new words, you can use something like this at
the end of the program.

$list = join "\n", @terms;

Maybe the reason is the $prev definition.

$prev has no direct importance here, it's only required that it should
not be present in @terms, because it is used to delete double entries
from @terms.

s/(\.|,|e|en|e,|en,|e\.|en\.)$// for @terms;
I also tried Dr. Ruud's regex but it would have to be rewritten for
each language.

That is correct, hence my thoughts about language files. My code is a
very brute algorithm - it only strips out the following from the end of
each line:

. , e en e en, e. en.

If you are planning to use this for different languages, you would
obviously need to modify those patterns each time.

--
Bart

.



Relevant Pages

  • Re: best method to perform operations on word lists
    ... current purpose it'll do the trick but any suggestion for optimization ... my $prev = 'nonesuch584685542256RANOM58544'; ... This didn't modify the list. ... hence my thoughts about language files. ...
    (comp.lang.perl.misc)
  • RE: Formula counts incorrectly
    ... > I assume that it is only counting 5/5/2005 one time? ... > Could someone please modify this formula to work the way I want it to? ... > was's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=20211 ... Prev by Date: ...
    (microsoft.public.excel.misc)
  • Re: I just got office 2003, created a document, saved it, now i cant.
    ... >I don't know how to modify my document. ... I need help and i just bought this ... > laptop. ... Prev by Date: ...
    (microsoft.public.word.newusers)
  • Re: dynamically set a field based upon a parameter
    ... Within your javascript function, ... function SetFieldValue(fieldName, fieldValue) ... If you wanted to modify, you could even pass in the form ... Prev by Date: ...
    (comp.lang.javascript)
  • Remote Registry changes
    ... No matter what Path ... I am trying to modify. ... I would try other hives, ... Prev by Date: ...
    (microsoft.public.windows.server.scripting)