my $str = "It/PRP really/RB does/VBZ seem/VB to/TO violate/VB a/DT lot +/NN of/IN boundaries/NNS"; my @pairs = map { [ split /\// ] } split /\s+/, $str; for (0..$#pairs-1) { print $pairs[$_][1], "/", $pairs[$_+1][1], "\n"; print $pairs[$_][0], " ", $pairs[$_+1][0], "\n"; }
In reply to Re: parsing a sentence?
by Roger
in thread parsing a sentence?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |