Context Free Grammer Parser

Lukket Opslået Mar 22, 2005 Betalt ved levering
Lukket Betalt ved levering

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 [url removed, login to view], [url removed, login to view], and Parser.java. Also, please provide a short [url removed, login to view] 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() ;

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

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

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

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

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

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

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

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

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

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

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

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

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

Parser parser = new Parser() ;

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

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

[url removed, login to view]( [url removed, login to view]( "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.

Ingeniørarbejde Java Linux MySQL PHP Software Arkitektur Software Testning UNIX

Projekt ID: #3623739

Om projektet

7 bud Remote projekt Aktiv Apr 4, 2005

7 freelancere byder i gennemsnit $1606 timen for dette job

bogdanstan

See private message.

$42.5 USD in 14 dage
(194 bedømmelser)
5.7
kurilenkovw

See private message.

$51 USD in 14 dage
(52 bedømmelser)
4.8
hmmvw

See private message.

$97.75 USD in 14 dage
(24 bedømmelser)
4.4
drjavavw

See private message.

$42.5 USD in 14 dage
(8 bedømmelser)
3.6
vw1429912vw

See private message.

$595 USD in 14 dage
(8 bedømmelser)
1.5
Calinoiu

See private message.

$42.5 USD in 14 dage
(5 bedømmelser)
1.2
endlessnight

See private message.

$212.5 USD in 14 dage
(0 bedømmelser)
2.5
bitio

See private message.

$10200 USD in 14 dage
(0 bedømmelser)
0.0