Advanced Database Management System - Tutorials and Notes: How to calculate the probability of a sentence in NLP using PCFG

## Search Engine

Please visit, subscribe and share 10 Minutes Lectures in Computer Science

# Probabilistic Context Free Grammar How to calculate the probability of a sentence given the probabilities of various parse trees in PCFG

Probability of a sentence:

Probability of a sentence is the sum of probabilities of all parse trees that can be derived from the sentence under PCFG;

Example:

Probability of tree t1

= 1.0 * 0.1 * 0.7 * 1.0 * 0.4 * 0.18 * 1.0 * 1.0 * 0.18
= 0.0009072

Probability of tree t2
P(t2) = 1.0 * 0.1 * 0.3 * 0.7 * 1.0 * 0.18 * 1.0 * 1.0 * 0.18
= 0.0006804

Probability of the sentence:
Probability of the sentence “astronomers saw the stars with ears”;

Which is the most probable tree?
The probability of the parse tree t1 is greater than the probability of parse tree t2. Hence, t1 is the more probable of the two parses.

********************

• Go to NLP Solved Exercise page