Dear Monks, My question is about a faster way to do phrase matching in a sentence. + The usual standard way would be: $sentence="Jack and Jill went up the hill to fetch a pail of water."; $sentence=~/pail of water/\#pail of water\#/g; #tag the phrase 'pail o +f water' in the sentence. However, the above method becomes too slow when I have a long list of +phrases and also sentences. If I have single words instead of phrases +, I could use hash matching on 'split' sentence words, such as: @temp=split(' ', $sentence); my %hash=("pail of water"=>1); foreach my $i (@temp) { if ($hash{$i}) { --- } } However, this method cannot be applied to phrases. Can something simil +ar/faster be used for phrase tagging of sentences? On a related note, how to club the words of the marked phrase in the s +entence as a single unit (i.e. the phrase appears in a single array e +lement when the split is done on the sentence on the space character) +. Thanks.
In reply to phrase marking by newbio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |