nltk.induce_pcfg()
¶
-
nltk.
induce_pcfg
(start, productions)[source]¶ Induce a PCFG grammar from a list of productions.
The probability of a production A -> B C in a PCFG is:
count(A -> B C)P(B, C | A) = ————— where * is any right hand sidecount(A -> *)Parameters: - start (Nonterminal) – The start symbol
- productions (list(Production)) – The list of productions that defines the grammar