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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PERL: NP Recognizer

Reply to Message Icon

Name: joba
Date: June 28, 2007 at 06:21:04 Pacific
OS: Win Vista Premium
CPU/Ram: Pentium/1024
Product: 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




Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


batch Programming Batch File Question - New...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: PERL: NP Recognizer

Perl script, regex & hash of arrays www.computing.net/answers/programming/perl-script-regex-amp-hash-of-arrays/15784.html

linux perl problem www.computing.net/answers/programming/linux-perl-problem/11744.html

perl frolics www.computing.net/answers/programming/perl-frolics/13009.html