roncook
roncook

Reputation: 397

How can I represent probabilistic grammars in BNF?

I've found a grammar online which I want to rewrite to BNF so I can use it in a grammatical evolution experiment. From what I've read online BNF is given by this form:

<symbol> := <expression> | <term>

...but I don't see where probabilities factor into it.

Upvotes: 1

Views: 167

Answers (1)

rici
rici

Reputation: 241721

In a probabilistic context-free grammar (PCFG), every production also is assigned a probability. How you choose to write this probability is up to you; I don't know of a standard notation.

Generally, the probabilities are learned rather than assigned, so the representation issue doesn't come up; the system is given a normal CFG as well as a large corpus with corresponding parse trees, and it derives probabilities by analysing the parse trees.

Note that PCFGs are usually ambiguous. Probabilities are not used to decide whether a sentence is in the language but rather which parse is correct, so with an unambiguous grammar, the probabilities would be of little use.

Upvotes: 2

Related Questions