Computing.Net > Forums > Programming > PERL: NP Recognizer

PERL: NP Recognizer

Reply to Message Icon

Original Message
Name: joba
Date: June 28, 2007 at 06:21:04 Pacific
Subject: PERL: NP Recognizer
OS: Win Vista Premium
CPU/Ram: Pentium/1024
Model/Manufacturer: DELL
Comment:

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



Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: PERL: NP Recognizer

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge