Statistical Parsing Parsing context-free languages Çağrı Çöltekin University of Tübingen Seminar für Sprachwissenschaft November 8, 2016
Recap Parsing basics CKY Earley Closing Ingredients of a (natural language) parser Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 1 / 27 • A grammar • An algorithm for parsing • A method for ambiguity resolution
Recap Parsing basics November 8, 2016 SfS / University of Tübingen Ç. Çöltekin, we do not study or focus on any specifjc theory dependencies often use ideas/notions from both constituencies and Dependency grammars Constitunecy (or phrase structure) grammars, grammars infjnite) language Grammars Closing Earley CKY 2 / 27 • A formal grammar is a fjnite specifjcation of a (possibly • In this course, we are interested in two broad classes of • Various theories of ‘grammar’ (e.g., HPSG, LFG, CCG) • We will study these grammars in their relation to parsing,
Recap saw VP V saw NP Marry John Marry NP subject object root Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 John S Parsing basics items (constituents or phrases) CKY Earley Closing Dependency vs. constituency on units formed by a group of lexical 3 / 27 become popular in CL binary head–dependent relations between words developed with constituency grammars • Constituency grammars are based • Dependency grammars model • Most of the theory of parsing is • Dependency grammars has recently
Recap N is a set of non-terminal symbols November 8, 2016 SfS / University of Tübingen Ç. Çöltekin, with the rewrite rules R Parsing basics R is a set of rules of the form A phrase structure grammar is specifjed by, Phrase structure grammars Closing Earley CKY 4 / 27 Σ is a set of terminal symbols S ∈ N is a distinguished start symbol αAβ → γ for A ∈ N α, β, γ ∈ Σ ∪ N • The grammar accepts a sentence if it can be derived from S
Recap Parsing basics November 8, 2016 SfS / University of Tübingen Ç. Çöltekin, cross-cut this hierarchy (shaded region) (dashed ellipse) are adequate for representing natural languages Recursively Enumerable Context Sensitive Context Free Regular Chomsky hierarchy and natural languages Closing Earley CKY 5 / 27 • Chomsky hierarchy of languages form a set-inclusion hierarchy • It is often claimed that mildly context sensitive grammars • Note, however, that the possible natural languages probably
Recap Parsing basics November 8, 2016 SfS / University of Tübingen Ç. Çöltekin, grammars for the rest of this lecture symbols (possibly empty) sequence of terminal or non-terminal 6 / 27 parsing CF languages phenomena in natural language syntax Context free grammars Closing Earley CKY • Context free grammars are suffjcient for expressing most • Most of the parsing theory (and practice) is build on • The context-free rules have the form A → α where A is a single non-terminal symbol and α is a • We will mainly focus with parsing with context-free
Recap VP Parsing basics Derivation of sentence ‘she saw a duck’ S V N S NP Prn she V V saw NP Det a N duck Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 V 7 / 27 N S CKY S Earley Closing N An example grammar V N → NP VP → Aux NP VP ⇒ NP VP NP → Det N NP ⇒ Prn NP → Prn Prn ⇒ she NP → NP PP VP ⇒ V NP VP → V NP ⇒ saw VP → V NP ⇒ Det N VP → VP PP Det ⇒ a PP → Prp NP → duck ⇒ duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap Parsing basics November 8, 2016 SfS / University of Tübingen Ç. Çöltekin, directions the sentence Parsing as search and the input Closing Earley CKY 8 / 27 • Parsing can be seen as search constrained by the grammar • Top down: start from S , fjnd the derivations that lead to • Bottom up: start from the sentence, fjnd series of derivations (in reverse) that leads to S • One can search depth fjrst or breadth fjrst in both
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recap N saw a duck Backtrack! S Parsing basics N duck N V V V Ç. Çöltekin, SfS / University of Tübingen November 8, 2016 she S N she CKY Earley Closing Parsing as search: top down S NP Det Prn a 9 / 27 Det V NP NP VP saw → NP VP → Aux NP VP NP → Det N NP → Prn NP → NP PP VP → V NP VP → V VP → VP PP PP → Prp NP → duck → park → parks → duck → ducks → saw Prn → she | her Prp → in | with Det → a | the
Recommend
More recommend