# Probabilistic Context Free Grammar How to calculate the probability of a parse tree

###
__Probability of a parse tree:__

__Probability of a parse tree:__

We have formally
defined PCFG. Now the next question is how to use PCFG to derive the
probability of a parse tree (derivation tree). As discussed, a sentence can be
parsed into more than one way. That means, we can have more than one parse
trees for the sentence as per the CFG due to ambiguity.

Given a parse tree
t, with the production rules α

_{1}→ β_{1}, α_{2}→ β_{2}, … , α_{n}→ β_{n}from R (ie., α_{i}→ β_{i}∈ R), we can find the probability of tree t using PCFG as follows;
As per the
equation, the probability

*P(t)*of parse tree is the product of probabilities of production rules in the tree t.

__Example:__
Find the
probability of the parse tree

*t*given below;
= 1.0 * 0.1 * 0.7 * 1.0 * 0.4
* 0.18 * 1.0 * 1.0 * 0.18

= 0.0009072

The probability of the parse tree

*t*is calculated as 0.0009072.************************

###
**Related links:**

**Related links:**

- Go to Natural Language Processing (NLP) home

**Go to NLP Solved Exercise page**

**Go to Context Free Grammar (CFG) Formal Definition page**