the/article book/noun
he/pronoun is/verb ill/adjective
####
the book article noun
he is ill pronoun verb adjective
####
#!/usr/bin/perl
use warnings;
use strict;
my @words;
my @parts_of_speech;
while(my $sentence = ) {
@words = ();
@parts_of_speech = ();
while ($sentence =~ /(\w+)\/(\w+)/g ) {
push(@words, $1) if $1;
push(@parts_of_speech, $2) if $2;
}
print $_, " " for @words;
print $_, " " for @parts_of_speech;
print "\n";
}
__DATA__
the/article book/noun
he/pronoun is/verb ill/adjective
####
C:\Code>perl linguistic.pl
the book article noun
he is ill pronoun verb adjective