Last class ◮ Constituents and their heads ◮ Context-free grammars English Syntax and Parsing ANLP: Lecture 12 ◮ Structural ambiguity Shay Cohen Today: School of Informatics ◮ Chomsky normal form for context-free grammars University of Edinburgh ◮ More on English grammar 11 October 2019 ◮ Agreement in context-free grammars ◮ If time left: a bit on parsing 1 / 62 2 / 62 Side Note: English not being Finite State Chomsky Normal Form A context-free grammar is in Chomsky normal form if all productions are of the form A → B C or A → a where A , B , C are A question I was asked (paraphrase): nonterminals in the grammar and a is a word in the grammar. Why do we need to go through the compli- cated process of finding a regular language { (the N) n TV m likes tuna fish L = | n , m ≥ 0 } Disregarding the empty string, every CFG is equivalent to and intersect it with English to show we do not a grammar in Chomsky normal form (the grammars’ string get a regular language? Is it not sufficient to just languages are identical) state that a subset of English is the language { (the N) n TV n − 1 likes tuna fish | n ≥ 1 } , which is not regular, and therefore English is not regular? Why is that important? ◮ A normal form constrains the possible ways to represent an ◮ Hint: Is the language of all possible sequence of words Σ ∗ object regular (finite state)? ◮ Makes parsing efficient 3 / 62 4 / 62
Conversion to Chomsky Normal Form Sentence types ◮ Replace all words in an RHS with a preterminal that rewrites to that word Among the large number of constructions for English sentences, four are particularly common: ◮ Declarative I prefer a morning flight. ◮ Imperative ◮ Break all RHSes into a sequence of RHSes with two Give me the newspaper. nonterminals, possibly introducing new nonterminals: ◮ Yes-no question Do any of these flights have stops? S → A 1 A 2 A 3 ◮ Wh-questions transforms into What is your name? S → A 1 B B → A 2 A 3 . 5 / 62 6 / 62 Declarative Imperative Often begin with a VP and have no subject. S → NP VP S → VP ◮ I want a flight from Ontario to Chicago. ◮ Show the lowest fare. ◮ The flight should be eleven a.m. tomorrow. ◮ Give me Sunday’s flights arriving in Las Vegas from New York ◮ The return flight should leave at around seven. City. ◮ I will be back tomorrow. ◮ List all flights between five and seven. ◮ Go home. 7 / 62 8 / 62
Yes-no questions Wh-subject-question Identical to the declarative structure, except that the first NP Often used to ask questions or requests. contains a wh-word. S → Aux NP VP S → Wh-NP VP ◮ Do any of these flights have stops? ◮ What airlines fly from Burbank to Denver? ◮ Does American’s flight eighteen twenty five serve dinner? ◮ Which flights depart Burbank after noon and arrive in Denver ◮ Can you give me the same information for United? by six? ◮ Whose flights serve breakfast? 9 / 62 10 / 62 Wh-non-subject-question Long-range dependencies and movement Wh-non-subject-questions contain long-distance dependencies: What flights do you have from Burbank to Tacoma? Wh-phrase is not the subject of the sentence, and so the sentence includes another subject with the auxiliary before the subject NP Wh-NP what flights is separated from the predicate that it is related to the VP have. S → Wh-NP Aux NP VP Some annotations and linguistic theories (minimalism) contain a small marker called a “trace” or “empty category” that is inserted after the verb to indicate long-distance dependency. ◮ What flights do you have from Burbank to Tacoma? This is to denote that the object has “moved” from the object position to the beginning of the sentence: I have an 11am flight from Burbank to Tacoma 11 / 62 12 / 62
Noun phrases and determiners NP: the Nominal NP → Det Nominal The nominal follows the Det and may contain other modifiers. In its simplest form: NP can begin with simple determiners: ◮ a stop Nominal → Noun ◮ the flight ◮ this flight Numbers and other quantifiers: ◮ those flights ◮ any flights two friends the second leg the next day ◮ some flights many flights the last flight one stop More complex expressions can act as determiners: Adjectives: ◮ United’s flight ◮ United’s pilot’s union a first-class fare a non-stop flight ◮ Denver’s mayor’s mother’s cancelled flight the longest layover the earliest flight The determiner can be a possessive expression: Det → NP’s Adjectives can be grouped into adjective phrase (AP): the least Determiners are not obligatory: expensive fare ◮ I like water. ◮ I like apples. 13 / 62 14 / 62 NP: Nominal NP: Nominal Non-finite clauses: 1. Gerundive(-ing) postmodifiers - VP that begins with the The head noun can also be followed by postmodifiers: gerundive (-ing) form of the verb: Prepositional phrase (PP): Nominal → Nominal GerundVP all flights [from Cleveland] all flights [from Cleveland] [to Newark] any flights [arriving after eleven] arrival [in San Jose] [before seven] flights [leaving on Thursday] a reservation [on flight sixty two] [from Tampa] [to Montreal] 2. Infinitives: A rule to account for postnominal PPs: the last flight [to arrive in Boston] 3. -ed forms: Nominal → Nominal PP I need to have dinner [served] Which is the aircraft [used by this flight]? 15 / 62 16 / 62
NP: Nominal Verb Phrase The verb phrase consists of the verb and a number of other Relative clauses – a clause that begins with a relative pronoun constituents: (that or who). The relative pronoun functions as the subject of the embedded verb: VP → Verb disappear VP → Verb NP prefer [a morning flight] a flight [that serves breakfast] VP → Verb NP PP leave [Boston] [in the morning] flights [that leave in the morning] VP → Verb PP leaving [on Thursday] the man [who arrived late] More complex constituents are also possible: Nominal → Nominal RelClause Another VP: RelClause → (who | that) VP I want [VP to fly from Milwaukee to Orlando] Various postnominal modifiers can be combined: Sentential complement: A flight [from Phoenix to Detroit] [leaving Monday evening] Evening flights [from Nashville] [that serve dinner] I [VP [V think] [S I would like to take the early flight]] 17 / 62 18 / 62 Conjunction Conjunction VP conjunctions: What flights do you have [VP [VP leaving Denver] and [VP Major phrase types can be combined with conjunctions like and, arriving in San Francisco]] or, but: S conjunctions: I need to know [NP [NP the aircraft] and [NP the flight number]] [S [S I’m interested in a flight from Dallas to Chicago] and [S I’m NP → NP and NP also interested in going to Baltimore]] The ability to form coordinate phrases through conjunctions is VP → VP and VP used to test for constituency: S → S and S I need to know the [Nom [Nom aircraft] and [Nom flight number]]. Meta-rule: X → X and X Any non-terminal can be conjoined with the same non-terminal to yield a constituent of the same type. 19 / 62 20 / 62
Grammars in Practice Agreement phenomena In programming languages, typing rules enforce type agreement between different (often separated) constituents of a program: ◮ Read off treebanks int i=0; ...; if (i>2) ... There are somewhat similar phenomena in NL: constituents of a ◮ May contain thousands of rules sentence (often separated) may be constrained to agree on an attribute such as person, number, gender. ◮ We will talk more about treebanks when we add probabilities to grammars ◮ You, I imagine, are unable to attend. ◮ The hills are looking lovely today, aren’t they? ◮ He came very close to injuring himself. 21 / 62 22 / 62 Agreement in various languages Agreement rules: why bother? These examples illustrate that in English: Modelling agreement is obviously important if we want to generate grammatically correct NL text. ◮ Verbs agree in person and number with their subjects; But even for understanding input text, agreement can be useful for ◮ Tag questions agree in person, number, tense and mode with their resolving ambiguity. main statement, and have the opposite polarity. E.g. the following sentence is ambiguous . . . ◮ Reflexive pronouns follow suit in person, number and gender . French has much more by way of agreement phenomena: ◮ Adjectives agree with their head noun in gender and number. The boy who eats flies ducks. Le petit chien, La petite souris, Les petites mouches ◮ Participles of ˆ etre verbs agree with their subject: . . . whilst the following are less so: Il est arriv´ e, Elles sont arriv´ ees ◮ Participles of other verbs agree with preceding direct objects: The boys who eat fly ducks. Il a vu la femme, Il l’a vue The boys who eat flies duck. How can we capture these kinds of constraints in a grammar? 23 / 62 24 / 62
Recommend
More recommend