chomsky-normal-form

Conversion to Chomsky Normal Form

我的未来我决定 提交于 2019-12-23 18:34:09
问题 I do need your help. I have these productions: 1) A--> aAb 2) A--> bAa 3) A--> ε I should apply the Chomsky Normal Form (CNF). In order to apply the above rule I should: eliminate ε producions eliminate unitary productions remove useless symbols Immediately I get stuck. The reason is that A is a nullable symbol (ε is part of its body) Of course I can't remove the A symbol. Can anyone help me to get the final solution? 回答1: As the Wikipedia notes, there are two definitions of Chomsky Normal

Converting grammar to Chomsky Normal Form?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 15:19:01
问题 Convert the grammar below into Chomsky Normal Form. Give all the intermediate steps. S -> AB | aB A -> aab|lambda B -> bbA Ok so the first thing I did was add a new start variable S0 so now I have S0 -> S S -> AB | aB A -> aab|lambda B -> bbA then I removed all of the lambda rules: S0 -> S S -> AB | aB | B A -> aab B -> bbA | bb Then I checked for S->S and A->B type rules which did not exist. And that was the answer I came up with, do I need to do anything further or did I do anything wrong?

Converting grammar to Chomsky Normal Form?

时光毁灭记忆、已成空白 提交于 2019-12-18 15:18:37
问题 Convert the grammar below into Chomsky Normal Form. Give all the intermediate steps. S -> AB | aB A -> aab|lambda B -> bbA Ok so the first thing I did was add a new start variable S0 so now I have S0 -> S S -> AB | aB A -> aab|lambda B -> bbA then I removed all of the lambda rules: S0 -> S S -> AB | aB | B A -> aab B -> bbA | bb Then I checked for S->S and A->B type rules which did not exist. And that was the answer I came up with, do I need to do anything further or did I do anything wrong?

Removing epsilon production from context-free grammar

≯℡__Kan透↙ 提交于 2019-12-13 04:25:00
问题 I am just having trouble with one part of the grammar that reads: C -> CBA | epsilon After I remove epsilon productions, I get: C -> CBA | CB | BA | B | A I'm confused as to whether this is correct or not. In the grammar, B is also a nullable variable. Do I also have to include CA and/or A in the latter grammar? Any help appreciated. 来源: https://stackoverflow.com/questions/19920349/removing-epsilon-production-from-context-free-grammar

what will be CNF form of this probabilistic grammar?

删除回忆录丶 提交于 2019-12-11 04:52:38
问题 If PCFG is like, NP -> ADJ N [0.6] NP -> N [0.4] N -> cat [0.2] N -> dog [0.8] What will be CNF form? Will it be the following? NP -> ADJ NP [0.6] NP -> cat [0.08] NP -> dog [0.32] or somethings else? 回答1: NP -> ADJ NP [0.6] NP -> cat [0.08] NP -> dog [0.32] Your answer is correct because you need to get the same probability for the result by applying both the original and the converted set of rules (in CNF). 来源: https://stackoverflow.com/questions/39769119/what-will-be-cnf-form-of-this

Converting grammar to Chomsky Normal Form?

这一生的挚爱 提交于 2019-11-30 12:42:31
Convert the grammar below into Chomsky Normal Form. Give all the intermediate steps. S -> AB | aB A -> aab|lambda B -> bbA Ok so the first thing I did was add a new start variable S0 so now I have S0 -> S S -> AB | aB A -> aab|lambda B -> bbA then I removed all of the lambda rules: S0 -> S S -> AB | aB | B A -> aab B -> bbA | bb Then I checked for S->S and A->B type rules which did not exist. And that was the answer I came up with, do I need to do anything further or did I do anything wrong? Wikipedia says: In computer science, a context-free grammar is said to be in Chomsky normal form if all