regexp that doesn't work properly

2007-01-22 Thread Adriano Allora
Hi to all, I need to clean a tagged text (each line= a word, a part of speech, a lemma). Actually the corpus shows some errors like this one: < NOM anthNOM > NOM I wanto to replace these three lines with a single line like this one: well, I tried the command

1, random; 2, unicode

2006-12-27 Thread Adriano Allora
hi to all, two questions: 1) I need to extract a random item from an hash, does exist a function to do it? A module? An implementable and not-too-much-slow flowchart? 2) How to use unicode with perl? If I write "cos'è" in a string and then I print in the stdout that sring, I read "cos'?" Is

what's mistaken?

2006-12-26 Thread Adriano Allora
hi to all, (and a very good new year's eve). someone can tell me why this script doesn't accept the -h flag?: #!/usr/bin/perl -w use strict; use warnings; use Getopt::Std; getopt('h'); my $opt_h; if($opt_h) { [code...] } [rest of the script...] thnak you a lot, alladr

pattern substitution

2006-11-18 Thread Adriano Allora
hi to all, I've got a list of tagged words, like this one (only a little bit longest): e CON e le DET:def il ha VER:presavere|riavere detto VER:pperdire < NOM CORRVER:inficorre > NOM e CON e a PRE a I

selecting a part of a string

2006-09-23 Thread Adriano Allora
hi to all, another silly question about a pattern matching which should work but it doesn't. I have a list af string similar to this one: parola|n.c.,0,fem,sg,0|parola and I need to select all the chars before the pipe and put them in a variable. That substitution does'n work:

match an array element

2006-08-16 Thread Adriano Allora
hi all, I need to match any array element in a list of files. More precisely I'd to extract the $. for each match recording an hash element like this one: $matches{$filename} = $. Every file is a list of unique words, so I'm sure there will not be problems. My actual solution sounds like:

the biggest number

2006-08-11 Thread Adriano Allora
hi all, I've got a list of filenames like this: IT1.txt IT2.txt IT3.txt [...] IT10.txt IT11.txt IT12.txt [...] DE1.txt DE2.txt DE3.txt [...] DE10.txt DE11.txt DE12.txt and I need to extract the biggest number in these files (12 in the example, the files are always in pairs) Actually I use a

renaming files

2006-06-30 Thread Adriano Allora
hi to all, does exists a way to rename automatically files? I mean: I've got directories with this content: EN0.tmp EN1.tmp EN2.tmp EN3.tmp EN4.tmp ... IT0.tmp IT1.tmp IT2.tmp IT3.tmp IT4.tmp ... Now, some couples of files were deleted (you can imagine the EN1.tmp/IT1.tmp) but I need no holes

Re: selecting short words

2006-06-11 Thread Adriano Allora
yes, specifying the end of the string it's necessasy, but, if I write: #!/usr/bin/perl -w print STDOUT "Leggo...\n"; while (<>) { print "$_" if /^\w{1,5}$/; } the script doesn't match words (but THERE ARE words of 5 or 4 characters). I cannot undestand abbuonandot

selecting short words

2006-06-11 Thread Adriano Allora
Hi to all, i need to extract from a list of words (in a single column) anotherl list containing only the words of 5 or less chars. I wrote this script, but it doesn't work: #!/usr/bin/perl -w while (<>) { print "$_" if /^\w{,5}/; } someone can tell me why it does no

Re: force requiring a file

2006-02-15 Thread Adriano Allora
Il giorno 14/feb/06, alle 22:16, Tom Phoenix ha scritto: [...] Better yet, use absolute pathnames, not relative ones, to locate code. That's for security reasons. quite strange: I launched the perl script in this odd-way (to test if I was in the correct directory): adrianoallora$ /Libra

force requiring a file

2006-02-14 Thread Adriano Allora
Hi all, I need to execute the code found in a separate file (that file is written by another script). I wrote: my $nf = shift(); chomp($nf); require("./ricerche/$nf.pl"); see what happens: Can't locate ./ricerche/VALICO672.pl in @INC (@INC contains: /System/Library/P

find a value

2006-02-08 Thread Adriano Allora
Hi all, is there a way to find a value in an array without a foreach loop? thank you all a lot, alladr |^|_|^|_|^| |^|_|^|_|^| || || || || |

Re: negative match

2006-01-24 Thread Adriano Allora
what -xism does mean. Any help is appreciated, adriano allora Il giorno 20/gen/06, alle 17:22, Tom Phoenix ha scritto: On 1/20/06, Adriano Allora <[EMAIL PROTECTED]> wrote: my $form1 = qw(ara\w+); my $pos1 = qw([A-Z]+); my $lemma1 = qw(?!arabo); my $pattern = "^(?:$form1)[^A-Z]*(

negative match

2006-01-20 Thread Adriano Allora
hi to all, I cannot use a negative match, and I cannot understand why: someone may help me? I've got this four rows (for instance): arabaADJ arabo araboADJ arabo araboNOM arabo aranoVER:presarare and, with this regular expression, I would extract only the

conclusion: about eval and stdin

2006-01-04 Thread Adriano Allora
hi to all and thanks to all suggested me some solution, using debug lines (or something similar) I understood how obtaining the output I want. Now, I'm writing this e-mail to show a possible way to do a discrete corrector: I write a regexp to substitute (maybe with another regexp including bac

about eval and stdin

2006-01-02 Thread Adriano Allora
hi to all, a friend of mine ask me for a perl script to change regexp patterns in some texts (he can learn regexp, but I suppose he won't learn perl). So I start write this one to him. I have a problem: ==> with pattern = (dir)ectory and replacement = $1, why the script does not eval $1 as "d

thank you all!

2004-09-04 Thread Adriano Allora
Ok, at least job casualties lead me away from perl (maybe only for one year). I thank you all for all you did fo me and for others like me. bye -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

multi-word substitution

2004-02-24 Thread Adriano Allora
Hi to all, I want to create a script which can substitute a more-than-one-word substitution with more than other one from command line in a large amount of files. My idea: $ perl command words to be substitute -f words with which substitute -f2 file file file... (-f marks the end (the italian

it seems impossible to me...

2003-06-27 Thread Adriano Allora
Hi to all, I have to clean a huge array in wich every element is a text line. My cleaning consists in deleting each item if it appears more than one time. I cannot use hashes and I'd prefer avoiding foreach cycles (I have a lot of arrays, and so...). I searched a function wich works in this

extracting a group of keys

2003-06-18 Thread Adriano Allora
Hi to all, I have to compare each line of a very long text file with each line of another one. I stored all the first file lines in an hash - to make the process faster. Now I have that hash with the first word of each line in the value of hash and the entire line in the related key (cause I can

Help with this!

2003-04-03 Thread Adriano Allora
Hi to all, I need to delete in a list of files, and in each file of newsgroups, all the posts which contents quoted lines. ONLY IF these lines are effectively repeating the non quoted text. I'm actually working on a single file in the directory, but the moment in which I have to work on a multi-fil

Should I re-think this path?

2003-04-02 Thread Adriano Allora
Hi to all, I need to delete in a list of files, and in each file of newsgroups, all the posts which contents quoted lines. ONLY IF these lines are effectively repeating the non quoted text. At the end, I'm working on a single file in the directory, but the moment in which I have to work on a multi-

re-thinking how to do an erasure

2003-04-01 Thread Adriano Allora
Hi to all, this times my call-for-help could be interesting also for who knows perl (and not only for me). I need to delete in a list of files, and in each file of newsgroups, all the posts which contents quoted lines. ONLY IF these lines are effectively repeating the non quoted text. FIRST ste

Re: Php perl?

2003-04-01 Thread Adriano Allora
Hi, I used to use ASP, then I start to use PHP and now I'm learning perl. Perl is more efficent and powerful but also (a bit?) more difficult than PHP. PHP is a very... comfortable scripting language to develop web-pages (similar to ASP, but more easy), and stop there. Perl is perfect to do a lot

how to optimize it?

2003-03-30 Thread Adriano Allora
hello, I wrote this script, and it works: it clean all the files in a 157Mb directory in 6 minutes. But I recently used it in a directory in which I stored only one 145 Mb file and it is very very very slow (I suppose because it isn't optimized: it uses memory not very well). Someone may help me

Re: how can I delete a line?

2003-03-27 Thread Adriano Allora
Hello, thank you all, at this moment I don't need a solution involving anything neither nuclear fly swatters: I show the hammer to the bolt and that became a nail. I needed something a bit more kinky that I told you in the first mail - to delete all the posts too much short in a very long newsgr

how can I delete a line?

2003-03-25 Thread Adriano Allora
hello, I need to delete single lines in a text (for example the 132nd, the 133rd and the 134th ones). How can I do it in a structure like: if $. = selected number line = "" ? thanks, all'adr -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Re: to clean and copy

2003-03-25 Thread Adriano Allora
Hi to all, on the one hand I wanto to thank a lot John Krahn for his precious help; on the other hand I would publish in the body of this email the script I use (thank again, John!) to clean all the text files in a directory. I don't know if this is a kind of mail permitted in this list, but

to clean and copy

2003-03-24 Thread Adriano Allora
Hi to all, my input = a directory in which I stored a certain amount of text files downloaded by some newsgroups; my desired_process = to clean all the files and copy them all in another directory; my desired_output = another directory in which there are all cleaned files; my problem = my scrip

Re: macthing question...

2003-01-01 Thread Adriano Allora
maybe this does not ineterest you, but: if you wanna substitute each code (for instance 010) with its correct name (for instance red) you can use thw script that follows. Actually I'm working on apply this script to an entire directory and its subdirectories (see the mail "navigate the directorie

navigate the directories

2003-01-01 Thread Adriano Allora
I need to know, in the @ARGV, when a string is the name of a directory. More precisely I'd like to write a script that: processes the files of the textes in a dir extracts the list of the sub-directories in a dir in each sub-dir processes the files of the textes extracts the list of the sub-di

Re: two questions

2003-01-01 Thread Adriano Allora
thank you all (Dan Muey, Wiggins d'Anconia, Rob Hansom in particular), the party is finished, there was a perl-experienced-user but I used all my selfcoltrol to avoid to ask him something about programming (my girlfriend would have never forgiven me ;P ). After some hours of sleep, I was rewarded

Re: two questions

2002-12-31 Thread Adriano Allora
Lunedì, 30 Dic 2002, alle 23:38 Europe/Rome, Wiggins d'Anconia ha scritto: Adriano Allora wrote: hi to all, I'd like to know two things: 1 - Perl vs. AWK I'm learning Perl to use it in text processing. Recently I start to argue with a friend of mine about the best language t

two questions

2002-12-30 Thread Adriano Allora
hi to all, I'd like to know two things: 1 - Perl vs. AWK I'm learning Perl to use it in text processing. Recently I start to argue with a friend of mine about the best language to process texts (clear them, or markup them, tokenize them or parse them), he says awk is better - quicker than perl,

Re: single quote and substitutions

2002-12-29 Thread Adriano Allora
1- Have you tried doing the regex without the vars? s/(name1|name2)/(surname1|surname2)/g; Does that do what you want? If not you need to write a regex that does what you want without vars then incorporate that into your vars. 2- This may work, try : { s/$original/$new/g; print; } Dan

Re: single quote and substitutions

2002-12-29 Thread Adriano Allora
Venerdì, 27 Dic 2002, alle 20:11 Europe/Rome, Dan Muey ha scritto: Have you tried doing the regex without the vars? s/(name1|name2)/(surname1|surname2)/g; Does that do what you want? I'd prefer do not do it in this way, because I don't know how many (and what kind of) $originals and $news I'l

single quote and substitutions

2002-12-27 Thread Adriano Allora
Hi to all, I need to substitute in a text a serie of word with another serie of word (for example: when I have the name I want the correct surname). Modifying a someone else script I wrote this one: #!/usr/bin/perl -w my $original = '(name1|name2)'; my $new = '(surname1|surname2)'; $file_name

counting all lines except...

2002-11-03 Thread Adriano Allora
Hi to all, I've just learnt ( ... anyway, I'm trying to do it) to select a string when it is not preceded (or followed) by another string. My aim is to know the mean of text lines in each newsgroup post, so I wrote: #!/usr/bin/perl -w $nome_del_file = q/text.txt/; open(INPUT, $nome_del_fil

create a readable webpage

2002-11-01 Thread Adriano Allora
Hi to all, I have this problem: I want to put a dot pl file (my perl script) in a url and I want it to write the page and the browser to read it. For instance, this one could be my perl script: #!/usr/bin/perl print "HTTP/1.0 200 OK\n"; print "Content-Type: text/html\n\n"; print ''; print 'Done,

again about php and perl

2002-10-30 Thread Adriano Allora
Hi to all, I've ever used PHP for my webworks, but I'm slowly learning Perl and I recently discovered the cgi.pm and it seems enought simply and useful. What's the difference between using perl-cgi and php pages? And: is it very stupid to write a cgi wich creates all the web pages as I could do w

Re: PERL vs. PHP?

2002-10-23 Thread Adriano Allora
Is this true? Are there other advantages to PHP over PERL? I guess PHP is a little simpler. Jenda yes, yes!, I think so: i've worked with PHP and it is (very) simpler. but my idea is that you can make more with perl. adr -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

variables in regexp

2002-10-09 Thread Adriano Allora
Hi to all, I feel myself very stupid, but I've tried to do it in different ways and I cannot do it. I need to clear a text, to tokenize it, for instance to delete some things and to transform some others: .. at this time I use this regexp: a) to delete s/=+\n//g; s/-+\n//g; b) to transform s/-+

opening a list of files

2002-09-25 Thread Adriano Allora
Hi to all, I need a script to open all the files in a directory and count all the words of them, but it doesn't work: use Text::ParseWords; $folder = "pathname"; opendir(KART, $folder); foreach (readdir(KART)){ if(grep /\.txt$/, $_){ $filename = "$_"; open(INPUT, $filename); this