nltk.ProbabilisticProduction
¶
-
class
nltk.
ProbabilisticProduction
(lhs, rhs, **prob)[source]¶ A probabilistic context free grammar production. A PCFG
ProbabilisticProduction
is essentially just aProduction
that has an associated probability, which represents how likely it is that this production will be used. In particular, the probability of aProbabilisticProduction
records the likelihood that its right-hand side is the correct instantiation for any given occurrence of its left-hand side.See: Production
Methods¶
__init__ (lhs, rhs, **prob) |
Construct a new ProbabilisticProduction . |
is_lexical () |
Return True if the right-hand contain at least one terminal token. |
is_nonlexical () |
Return True if the right-hand side only contains Nonterminals |
lhs () |
Return the left-hand side of this Production . |
logprob () |
Return log(p) , where p is the probability associated with this object. |
prob () |
Return the probability associated with this object. |
rhs () |
Return the right-hand side of this Production . |
set_logprob (prob) |
|
set_prob (prob) |
|
unicode_repr () |
Return a concise string representation of the Production . |