Download - Week 9: Probabilistische Grammatica's
![Page 1: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/1.jpg)
Week 9: Probabilistische Grammatica's
Jurafsky & Martin (ed. 1), Hoofdstuk 12:Lexicalized and Probabilistic Parsing)
Taaltheorie en Taalverwerking
Remko Scha, ILLCOpleiding Kunstmatige Intelligentie
![Page 2: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/2.jpg)
Ambiguïteit
![Page 3: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/3.jpg)
Ambiguïteit
![Page 4: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/4.jpg)
Ambiguïteit
![Page 5: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/5.jpg)
Ambiguïteit
Cf.: Can you book me a flight? Can you book Mr. Jones some flights?
![Page 6: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/6.jpg)
Syntactische Ambiguïteit
Wat voor redenen zijn er om Can you [book [TWA flights]]? te verkiezen boven Can you [book TWA flights]?
1. Pragmatisch: Men vraagt niet vaak of je voor een specifiek iemand vluchten kunt boeken. Of: men vraagt niet vaak over vluchten zonder verdere specificaties.
2. Semantisch:Vluchten boeken voor een vliegmaatschappij is onzinnig in dit domein.
3. Syntactisch:Werkwoorden worden meestal zonder meewerkend voorwerp gebruikt;of: "to book" wordt meestal zonder meewerkend voorwerp gebruikt;of: "flights" wordt vaak met een modifier gebruikt; etc.
![Page 7: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/7.jpg)
Syntactische Ambiguïteit
Disambiguërings-methodes:
1./2. Pragmatisch/Semantisch: Bepaal betekenis-representaties voor elk van de mogelijke interpretaties. Redeneer over wat iemand kan willen weten en over wat zinnig is in dit domein. [Ouderwetse symbolische A.I.]
![Page 8: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/8.jpg)
Syntactische Ambiguïteit
Disambiguërings-methodes:
1./2. Pragmatisch/Semantisch: Bepaal betekenis-representaties voor elk van de mogelijke interpretaties. Redeneer over wat iemand kan willen weten en over wat zinnig is in dit domein.
2. Syntactisch:Doe statistiek over syntactische structuren.
![Page 9: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/9.jpg)
Syntactische Ambiguïteit
Disambiguërings-methodes:
1./2. Pragmatisch/Semantisch: Bepaal betekenis-representaties voor elk van de mogelijke interpretaties. Redeneer over wat iemand kan willen weten en over wat zinnig is in dit domein.
2. Syntactisch:Doe statistiek over syntactische structuren.
Merk op: distributie van syntactische structuren kan correleren met pragmatisch/semantische regelmatigheden
![Page 10: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/10.jpg)
Syntactische Ambiguïteit
Disambiguërings-methodes:
1./2. Pragmatisch/Semantisch: Bepaal betekenis-representaties voor elk van de mogelijke interpretaties. Redeneer over wat iemand kan willen weten en over wat zinnig is in dit domein.
2. Syntactisch:Doe statistiek over syntactische structuren.
Merk op: distributie van syntactische structuren correleert met pragmatisch/semantische regelmatigheden, vooral als we ook informatie over specifieke lexicale items meenemen.
![Page 11: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/11.jpg)
Kansrekening: Basics. [Russell & Norvig, pp. 466-478.]
![Page 12: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/12.jpg)
Kansrekening: Basics.
Het begrip kans veronderstelt een partitie van een ruimte van mogelijkheden.
Een kans beschrijft de relatieve grootte van een deel van die ruimte.
B.v.: een meting met k mogelijke uitkomsten:
P(1) + P(2) + . . . + P(k) = 1.
![Page 13: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/13.jpg)
Kansrekening: Basics.
Joint probabilities.
Als A en B uitkomsten zijn van 2 verschillende onafhankelijke metingen, dan is de kans op A en B:
P(A & B) = P(A) P(B)
![Page 14: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/14.jpg)
Kansrekening: Basics.
Conditionele waarschijnlijkheden.
De kans op A gegeven B schrijven we als: P(A|B)
![Page 15: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/15.jpg)
Kansrekening: Basics.
Algemeen geldt:P(A & B) = P(A|B) P(B)P(A & B) = P(B|A) P(A)
Als A en B onafhankelijk zijn, dan is
P(A|B) = P(A)P(B|A) = P(B)
dus P(A & B) = P(A) P(B)
![Page 16: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/16.jpg)
Statistische syntactische desambiguëring.
![Page 17: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/17.jpg)
Statistische syntactische desambiguëring.
Eenvoudigste idee:
Probabilistische Contextvrije Grammatica (PCFG)
![Page 18: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/18.jpg)
Probabilistische Contextvrije Grammatica (PCFG)
Voeg aan elke herschrijfregel (A ) een conditionele kans toe: P(A | A)
![Page 19: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/19.jpg)
Probabilistische Contextvrije Grammatica (PCFG)
Voeg aan elke herschrijfregel (A ) een conditionele kans toe: P(A | A)
Eis: P(A ) = 1
![Page 20: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/20.jpg)
CFG: 4-tupel <N, , P, S>
N: eindige verzameling non-terminale symbolen
(b.v.: {S, NP, VP, noun, article, ...})
: eindige verzameling terminale symbolen (b.v.: {the, a, boy, wumpus, ...})
N =
S: startsymbool; S N
P: eindige verzameling herschrijfregels { A, .....} A N, (N )*
Cf. Jurafsky & Martin: Hoofdstuk 9 (Context-Free Grammars for English), p. 331
![Page 21: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/21.jpg)
PCFG: 5-tupel <N, , P, S, D>
N: eindige verzameling non-terminale symbolen
(b.v.: {S, NP, VP, noun, article, ...})
: eindige verzameling terminale symbolen (b.v.: {the, a, boy, wumpus, ...})
N =
S: startsymbool; S N
P: eindige verzameling herschrijfregels { A, .....} A N, (N )*D: functie die aan elke regel p P een getal tussen 0 en 1 toekent.
A N P(A ) = 1
Cf. Jurafsky & Martin: Hoofdstuk 12, pp. 448/449
![Page 22: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/22.jpg)
PCFG
Kans op een parse-tree =
Product van de kansen van alle toegepaste regels
![Page 23: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/23.jpg)
Example PCFG
![Page 24: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/24.jpg)
![Page 25: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/25.jpg)
P = .15 * .40 * .05 * .05 * .35* .75 * .40 * .40 *.40 *.30 * .40 *.50 = 1.5 * 10-6
P = .15 * .40 * .40 * .05 * .05* .75 * .40 * .40 *.40 *.30 * .40 *.50 = 1.7 * 10-6
Statistische Desambiguëring: Kies de boom met de hoogste waarschijnlijkheid
![Page 26: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/26.jpg)
Kans op een zin =
Som van de kansen van de verschillende bomen van die zin.
(Toepassing: Spraakherkenning.)
![Page 27: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/27.jpg)
Hoe bepaal je de kansen van de CFG-regels?
• Schatting op basis van de relatieve frequenties in een "treebank" (syntactisch geannoteerd corpus).
• "Expectation Maximization": Gegeven een "plat" corpus (collectie zinnen): stel de waarschijnlijkheden zodanig in, dat de kans om dat corpus te genereren zo groot mogelijk is.
![Page 28: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/28.jpg)
Beperking van PCFG's:
De toepassingen van de herschrijfregels worden behandeld als statistisch onafhankelijk.
![Page 29: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/29.jpg)
Een PCFG kent aan deze beide analysesaltijd dezelfde waarschijnlijkheid toe!
![Page 30: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/30.jpg)
Oplossing:
• PCFG's met verrijkte labels die niet-locale informatie coderen
• Stochastic Tree Substitution Grammars
![Page 31: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/31.jpg)
Lexicalized PCFG's: Head-features(Collins et al.)
![Page 32: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/32.jpg)
Lexicalized PCFG's: Head-features
VP(dumped) VBD(dumped) NP(sacks) PP(into) waarschijnlijk
NP(sacks) NP(sacks) PP(into) onwaarschijnlijk
VP(dumped) VBD(dumped) NP(sacks) PP(with) niet heel waarschijnlijk
NP(sacks) NP(sacks) PP(with) heel waarschijnlijk
![Page 33: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/33.jpg)
Data-Oriented Parsing (DOP)
(Scha, Bod, Sima'an)
Gebruik een geannoteerd corpus ("treebank").
Lees een Stochastic Tree Substitution Grammar
rechtstreeks af uit het corpus.
(PPT-presentatie van Guy De Pauw, Universiteit Antwerpen)
![Page 34: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/34.jpg)
Data-Oriented Parsing (DOP)
Gebruik een geannoteerd corpus.
Gebruik een Stochastic Tree Substitution Grammar
Lees deze STSG rechtstreeks af uit het corpus
(PPT van Guy De Pauw, Universiteit Antwerpen)
![Page 35: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/35.jpg)
Peter
NP
killed
a raccoon
NP
VP
S
Peter
NP
killed NP
VP
S
killed
a raccoon
NP
VP
Peter
NP VP
SNP
killed
a raccoon
NP
VP
S
a raccoon
NP
Peter
NP
NP VP
S
NP
killed NP
VP
S
![Page 36: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/36.jpg)
the bear
NP
ate
honey
NP
VP
S
the bear
NP
ate NP
VP
S
the bear
NP VP
S
NP
ate
honey
NP
VP
S
ate
honey
NP
VP
NP VP
S
honey
NP
ate NP
VPthe bear
NP
NP
ate NP
VP
S
![Page 37: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/37.jpg)
Treebank
honey
NP
the bear
NP
a raccoon
NP
Peter
NP
killed
a raccoon
NP
VP
ate
honey
NP
VP
ate NP
VP
killed NP
VP
Peter
NP
killed
a raccoon
NP
VP
S
NP
killed NP
VP
S
the bear
NP
ate NP
VP
S
the bear
NP VP
S
NP
ate
honey
NP
VP
S
NP VP
S
NP
ate NP
VP
S
Peter
NP
killed NP
VP
S
NP
killed
a raccoon
NP
VP
S
NP VP
S
Peter
NP VP
S
the bear
NP
ate
honey
NP
VP
S
![Page 38: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/38.jpg)
Sentence to be parsed: Peter killed the bear
Peter
NP
killed NP
VP
S
the bear
NP Peter
NP VP
S
NP VP
S
NP
killed NP
VP
S
1 parse-tree; meerdere afleidingen
Data-Oriented Parsing
the bear
NPkilled NP
VP
Peter
NP
the bear
NP killed NP
VP
the bear
NPPeter
NP
![Page 39: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/39.jpg)
An annotated corpus defines a Stochastic Tree Substitution Grammar
Probability of a Derivation:Product of the Probabilities of the Subtrees
![Page 40: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/40.jpg)
Probability of a Derivation:Product of the Probabilities of the Subtrees
Probability of a Parse:Sum of the Probabilities of its Derivations
An annotated corpus defines a Stochastic Tree Substitution Grammar
![Page 41: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/41.jpg)
Probability of a Derivation:Product of the Probabilities of the Subtrees
Probability of a Parse:Sum of the Probabilities of its Derivations
Disambiguation: Choose the Most Probable Parse
An annotated corpus defines a Stochastic Tree Substitution Grammar
![Page 42: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/42.jpg)
Human parsing continued.
![Page 43: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/43.jpg)
Human parsing continued.
• Center-embedding (J&M, § 13.4)
![Page 44: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/44.jpg)
Human parsing continued.
• Center-embedding (J&M, § 13.4)
• Garden-path sentences (J&M, § 12.5)
![Page 45: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/45.jpg)
Garden-path sentences
"The horse raced past the barn
![Page 46: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/46.jpg)
Garden-path sentences
"The horse raced past the barn fell."
![Page 47: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/47.jpg)
Garden-path sentences
"The complex houses
![Page 48: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/48.jpg)
Garden-path sentences
"The complex houses graduate students."
![Page 49: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/49.jpg)
Garden-path sentences
"The student forgot the solution
![Page 50: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/50.jpg)
Garden-path sentences
"The student forgot the solution was in the back of the book."
![Page 51: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/51.jpg)
Garden-path sentences
• Desambiguëring gebeurt incrementeel.• Desambiguëringsbeslissing kan te vroeg genomen
worden.
![Page 52: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/52.jpg)
Opgave:
(1) Gebruik waarschijnlijkheden aan toe aan je CFG.
(2) Zorg dat je parser alle mogelijke analyses van de input-zin oplevert.
(3) Zorg dat je parser de waarschijnlijkheden van alle analyses berekent, en de meest waarschijnlijke boom als output geeft.
![Page 53: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/53.jpg)
![Page 54: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/54.jpg)
Spraak & Taal: "Language Modelling"
Spraak: Giswerk.
Corpus-gebaseerde aanpak: Sla heel veelgeluiden op en kijk waar het input-signaal het meest op lijkt.
Men doet dit met statistiek: Men schat dekans dat aan een stukje input-signaal een bepaald foneem ten grondslag ligt.
![Page 55: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/55.jpg)
Spraak & Taal: "Language Modelling"
De spraakherkennings-technologie stelt ons in staat om voor elk kandidaat-woord W en elk input-signaal te schatten: de kans dat iemand W uitspreekt als S:
P(S | W)
![Page 56: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/56.jpg)
Spraak & Taal: "Language Modelling"
De spraakherkennings-technologie stelt ons in staat om voor elk kandidaat-woord W en elk input-signaal te schatten: de kans dat iemand W uitspreekt als S:
P(S | W)
Wat we willen weten is: De kans dat aan het gegeven input-signaal S een kandidaat-woord W ten grondslag ligt:
P(W | S)
![Page 57: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/57.jpg)
Spraak & Taal: "Language Modelling"
De spraakherkennings-technologie stelt ons in staat om voor elk kandidaat-woord W en elk input-signaal te schatten: de kans dat iemand W uitspreekt als S:
P(S | W)
Wat we willen weten is: De kans dat aan het gegeven input-signaal S een kandidaat-woord W ten grondslag ligt:
P(W | S)Wat nu?
![Page 58: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/58.jpg)
Elementaire kansrekening:de regel van Bayes
![Page 59: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/59.jpg)
Elementaire kansrekening:de regel van Bayes
P(W & S) = P(W|S) P(S)P(W & S) = P(S|W) P(W)
![Page 60: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/60.jpg)
Elementaire kansrekening:de regel van Bayes
P(W & S) = P(W|S) P(S)P(W & S) = P(S|W) P(W)
P(W|S) P(S) = P(S|W) P(W)
![Page 61: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/61.jpg)
Elementaire kansrekening:de regel van Bayes
P(W & S) = P(W|S) P(S)P(W & S) = P(S|W) P(W)
P(W|S) P(S) = P(S|W) P(W)
P(W|S) = P(S|W) P(W) / P(S)
![Page 62: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/62.jpg)
Elementaire kansrekening:de regel van Bayes
P(W & S) = P(W|S) P(S)P(W & S) = P(S|W) P(W)
P(W|S) P(S) = P(S|W) P(W)
P(W|S) = P(S|W) P(W) / P(S)
P(W|S) ≈ P(S|W) P(W)
P(W) is de a priori kans op woord W
![Page 63: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/63.jpg)
Spraak & Taal: "Language Modelling"
Voor de spraakherkenning willen we weten:
de a priori kansen op alle mogelijke woorden.
![Page 64: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/64.jpg)
Spraak & Taal: "Language Modelling"
Voor de spraakherkenning willen we weten:
de a priori kansen op alle mogelijke woorden.
Hoe komen we daar achter?
Tellen in een representatief corpus.
![Page 65: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/65.jpg)
Statistical Language Model
)|()|(
)|()()()(
121123
121321
WWWWPWWWP
WWPWPWWWWPWP
NN
N
LL
L
−
==
P(the cat is on the mat) =P(the | <s>) * P(cat | <s> the) *P(is | <s> the cat) *P(on | <s> the cat is) *P(the | <s> the cat is on) *P (mat | <s> the cat is on the) *P(</s> | <s> the cat is on the mat)
![Page 66: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/66.jpg)
(P(w w ))n
n = 1
N
1, . . , Wn - 1∏ |
P(W1,…,WN) =
![Page 67: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/67.jpg)
Bigram models
P(the cat is on the mat) =P(the | <s>) * P(cat | the) * P(is | cat) *P(on | is) * P(the | on) *P (mat | the) * P(</s> | mat)
)|()|()|()( 123121 −≈ NN WWPWWPWWPWP L
)|()( 1
11
−∏=
≈ kk wwPwPn
k
n
![Page 68: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/68.jpg)
Example: Bigrams
![Page 69: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/69.jpg)
Example: Bigrams (continued)
P(I want to eat British food) =P(I|<s>)P(want|I)P(to|want)P(eat|to)P(British|eat)P(food|British) = .25 * .32 * .65 * .26 * .002 * .60 = .000016
![Page 70: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/70.jpg)
Trigram models
P(the cat is on the mat) =P(the | <s>) * P(cat | <s> the) *P(is | the cat) *P(on | cat is) *P(the | is on) *P (mat | on the) *P(</s> | the mat)
)|()|()|()( 21123121 −−≈ NNN WWWPWWWPWWPWP L
![Page 71: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/71.jpg)
Estimating bigram probabilities
e.g. P (book | the) =C(the,book)
C(the)
)C(w
)w,C(w)w|P(w
1-n
n1-n
1-nn =
![Page 72: Week 9: Probabilistische Grammatica's](https://reader035.vdocuments.pub/reader035/viewer/2022062517/5681399c550346895da1369a/html5/thumbnails/72.jpg)