Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm trying to make an NP (Noun Phrase) Recognizer for a project at school.
the program should be able to do two things:
1. Put brackets around all N's.
2. When the NP consists of more then one N, the whole things should have brackets around it.My answer for question 1 is:
my @pairs = split(' ',$inputtext);
foreach my $pair (@pairs) {
if ($pair =~ /(\w+)\/(\w+)/g)
{ if($2 eq "N") {print "["}; print "$1\/"; print $2; if($2 eq "N") {print "]"}; print "\n"}
};But I have defined some NP rules, but how do I make the actual parser???
NP Rules:
NP --> N
NP --> PRON_UBST, NP
NP --> PRON-PERS
NP --> PRON-REC
NP --> EGEN
NP --> PRON_POSS, N
NP --> PRON_DEMO, N
NP --> PRON_UBST,PP
PP --> PRÆP, NP
NP --> EGEN_GEN, N, PP
NP --> ADJ, N

![]() |
batch Programming
|
Batch File Question - New...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |