Context Free Grammer Parser

Geschlossen Veröffentlicht Mar 22, 2005 Bezahlt bei Lieferung
Geschlossen Bezahlt bei Lieferung

In this assignment you will build a context-free grammar parser. You can use either a top-down or a bottom-up algorithm.

## Deliverables

Rent A Coder requirements notice: As originally posted, this bid request does not have complete details. Should a dispute arise and this project go into arbitration "as is", the contract's vagueness might cause it to be interpreted against you, even though you were acting in good-faith. So for your protection, if you are interested in this project, please work-out and document the requirements onsite.

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Deliverables must be in ready-to-run condition, as follows? (depending on the nature? of the deliverables):

a)? For web sites or? other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.

b) For all others including desktop software or software the buyer intends to distribute: A software? installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

Requirements You need to build (at least) three classes:

Grammar, ParseTree, and Parser.

The class Grammar should contain the following methods:

* public Grammar() Constructs a new grammar.

* public void addRule(String L, String R) Adds a unary rule to the grammar.

* public void addRule(String L, String R1, String R2) Adds a binary rule to the grammar.

The class ParseTree should contain the following methods:

* public ParseTree(String word) Constructs (the leaf of) a parse tree.

* public ParseTree(ParseTree L, String category) Adds unary category to top of parse tree.

* public ParseTree(ParseTree L, ParseTree R, String category) Adds binary category to top of two parse trees.

* public String toString() Prints parse tree using parentheses to show nesting.

The class Parser should contain the following methods:

* public Parser() Constructs a new parser.

* public ParseTree parse(String sentence, String category, Grammar grammar) Attempts to parse sentence into a parse tree with root with value category according to rules in grammar. Returns null if unsuccessful.

Put these classes in files [login to view URL], [login to view URL], and Parser.java. Also, please provide a short [login to view URL] file that describes the basic usage of your system a testing file TestParser.java.?

* * *

Testing Here is a small test:

public static void main(String[] args) {

Grammar g = new Grammar() ;

[login to view URL]("S","NP","VP") ;

[login to view URL]("NP", "ART", "NN") ;

[login to view URL]("NN","ADJ","NN") ;

[login to view URL]("NN","NOUN") ;

[login to view URL]("VP", "VERB", "NP") ;

[login to view URL]("ART", "the") ;

[login to view URL]("ART", "a") ;

[login to view URL]("ADJ", "big") ;

[login to view URL]("ADJ", "red") ;

[login to view URL]("NOUN", "dog") ;

[login to view URL]("NOUN", "cat") ;

[login to view URL]("VERB", "saw") ;

[login to view URL]("VERB", "bit") ;

Parser parser = new Parser() ;

[login to view URL]( [login to view URL]( "the cat saw a dog" , "S", g) ) ;

[login to view URL]( [login to view URL]( "a big red dog" , "NP", g) ) ;

[login to view URL]( [login to view URL]( "the dog saw" , "S", g) ) ;

}

This program should print the following:

(S (NP (ART the) (NN (NOUN cat))) (VP (VERB saw) (NP (ART a) (NN (NOUN dog)))))

(NP (ART a) (NN (ADJ big) (NN (ADJ red) (NN (NOUN dog)))))

null

This is not a complete testing regimen. In particular, it does not test left-recursive rules,

which might be a problem for some parsers. Nor does it test inputs and grammars that might cause

backtracking. Please include tests that test such conditions. Thanks.

## Platform

The program should be written in Java and should compile on a Unix machine.

Ingenieurwesen Java Linux MySQL PHP Softwarearchitektur Testen von Software UNIX

Projekt-ID: #3623739

Über das Projekt

6 Vorschläge Remote Projekt Aktiv Apr 4, 2005

6 Freelancer bieten im Durchschnitt $1857 für diesen Job

bogdanstan

See private message.

$42.5 USD in 14 Tagen
(195 Bewertungen)
5.7
kurilenkovw

See private message.

$51 USD in 14 Tagen
(53 Bewertungen)
4.8
drjavavw

See private message.

$42.5 USD in 14 Tagen
(8 Bewertungen)
3.6
vw1429912vw

See private message.

$595 USD in 14 Tagen
(8 Bewertungen)
1.5
endlessnight

See private message.

$212.5 USD in 14 Tagen
(0 Bewertungen)
2.5
bitio

See private message.

$10200 USD in 14 Tagen
(0 Bewertungen)
0.0