in reply to Re: Re: parsing a sentence?
in thread parsing a sentence?
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 { [ m!(\w+).*?/(\w+)! ] } split /\s+/, $str; for (0..$#pairs-1) { print $pairs[$_][0], " ", $pairs[$_+1][0], "\n"; }
$nth = 2; # every 2nd words for (0..$#pairs-$nth) { print $pairs[$_][0], " ", $pairs[$_+$nth][0], "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: parsing a sentence?
by Anonymous Monk on Mar 02, 2004 at 00:07 UTC | |
|
Re: Re: Re: Re: parsing a sentence?
by Anonymous Monk on Mar 02, 2004 at 01:05 UTC |