Probabilistic context-free grammar

In probabilistic grammar, we add the concept of probability. Don't worry - it's one of the most simple extensions of CFG that we've seen so far. We will now look at probabilistic context-free grammar (PCFG).

Let's define PCFG formally and then explore a different aspect of it. Refer to Figure 5.9:

Figure 5.9: PCFGs formal definition

Here, T, N, S, and R are similar to CFG; the only new thing here is the probability function, so let's look at that here, the probability function takes each grammar rule and gives us the probability value of each rule. This probability maps to a real number, R. The range for ...

Get Python Natural Language Processing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.