/Context-Free-Grammers-CFGs

A random sentence generator implemented. For this, a sample CFG rule set is provided in the Chomsky Normal Form(CNF). And CYK parser as a recognizer which tells whether a given sentence is grammatically correct or not

Primary LanguagePython

Context Free Grammers CFGs

A random sentence generator implemented. For this, a sample CFG rule set is provided in the Chomsky Normal Form(CNF). Using the grammar rules defined in a grammar file. The format of the CFG rules is as follows:

#S -> NP VP #Noun -> book

Every sentence begins with a root which is defined as follows: #ROOT -> S

Each nonterminal can have multiple expansions. For example, NP either can be ex- panded as Det Noun or Det Adj Noun.

Also implement CYK parser as a recognizer which tells whether a given sentence is grammatically correct or not according to the same CFG rule set