CFG & PCFG
CFG & PCFG
In the PCFG example, each production rule has a probability associated with
it, indicating how likely it is to be chosen during the generation or parsing
process. This allows PCFGs to capture the likelihood of different sentence
structures or parse trees, which is valuable in various NLP tasks like
machine translation and speech recognition.
CFG & PCFG
The simplest probabilistic model for recursive embedding is a PCFG, a Probabilistic
(sometimes also called Stochastic) Context Free Grammar
Is simply a CFG with probabilities added to the rules, indicating how likely different
rewritings are.
PCFGs are the simplest and most natural probabilistic model for tree structures, the
mathematics behind them is well understood, the algorithms for them are a natural
development of the algorithms employed with HMMs.
PCFGs provide a sufficiently general computational device that they can simulate various
other forms of probabilistic conditioning
Some Features of PCFGs
The predictive power of a PCFG as measured by entropy tends to be greater than that for
a finite state grammar (i.e., an HMM) with the same number of parameters. (For such
comparisons, we compute the number of parameters as follows. A V terminal, n
nonterminal PCFG has n3 + nV parameters, while a K state M output HMM has K2 + MK
parameters. While the exponent is higher in the PCFG case, the number of nonterminals
used is normally quite small.
Inside & Outside Probability
• Definition:
• Induction:
Chomsky Normal Form
• Chomsky Normal Form (CNF) grammars only
have unary and binary rules of the form
N →N N
j r s
For syntactic categories
N
a spaning words wi…wj
set to zero
Finding the most
Likely parse for a
sentence
A
on the word-span
m-word input B C
string
n non-terminals
begin m m+1
end
O(m3n3)
bookkeeping
Inside Probability Example
astronomers saw stars with ears
0 1 2 3 45
1 2 3 4 5