#!/usr/bin/perl #use strict; my $filename = ""; my $outputfile = ""; print "Input file name:"; $filename = ; chop ($filename); open (INFILE, "$filename") || die "error opening $filename $!\n"; print "Output file name:"; chop($outputfile = ); open (OUTFILE, ">$outputfile") || die "error opening $outputfile $!\n"; while () #read the input file { while ( /(\w['\w-]*)/g ){ #if we have a "word"; } my $word = ""; my $filename = ""; my $outputfile = ""; my $ending = "/NN"; my $plending = "/NNS"; my $properending = "/NNP"; my $nounphrase = ""; foreach $word (( /(\w['\w-]*)/g )){ if($word =~ /$ending$/i){ print OUTFILE "word = $word, is a plural Noun\n"; #$word =~ s/NN$//i;# chop the ending #print OUTFILE "$word\n"; }#end of 1st if } foreach $word (( /(\w['\w-]*)/g )){ if($word =~ /$plending$/i){ print OUTFILE"word = $word, is a Noun\n"; #$word =~ s/NN$//i;# chop the ending #print OUTFILE "$word\n"; }#end of 1st if } foreach $word (( /(\w['\w-]*)/g )){ if($word =~ /$properending$/i){ print OUTFILE"word = $word, is a Proper Noun\n"; #$word =~ s/NN$//i;# chop the ending #print OUTFILE "$word\n"; }#end of 1st if } close OUTFILE; }