Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my @wordarray = split /\s+/, $sentence; chomp foreach(@wordarray); @wordarray = grep {length} @wordarray; for(my $wordindex=0; $wordindex <= $#wordarray; $wordindex ++){ my $word1 = $wordarray[$wordindex]; while ($word1 =~ /(.*?)\/([A-Z]+)/g){ $valueword1 = $1; $keyword1 = $2; } my $word2 = $wordarray[$wordindex+1]; while ($word2 =~ /(.*?)\/([A-Z]+)/g){ $valueword2 = $1; $keyword2 = $2; } $patternKey = join("/",$keyword1, $keyword2); $patternValue = join(" ",$valueword1, $valueword2); print "key $patternKey \n"; print "value $patternValue \n"; my $matchingKey = grep($patternKey, @PatternArray); ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parsing a sentence?
by BrowserUk (Patriarch) on Mar 01, 2004 at 23:40 UTC | |
by Anonymous Monk on Mar 02, 2004 at 00:13 UTC | |
|
Re: parsing a sentence?
by Roger (Parson) on Mar 01, 2004 at 23:24 UTC | |
by Anonymous Monk on Mar 01, 2004 at 23:39 UTC | |
by Roger (Parson) on Mar 01, 2004 at 23:48 UTC | |
by Anonymous Monk on Mar 02, 2004 at 00:07 UTC | |
by Anonymous Monk on Mar 02, 2004 at 01:05 UTC |