Natural Language Processing Lecture 5 Modified Jim Martin

  • Slides: 19
Download presentation
Natural Language Processing Lecture 5 Modified Jim Martin

Natural Language Processing Lecture 5 Modified Jim Martin

Outline Moving from words to bigger units Syntax and Grammars § Context-free grammars §

Outline Moving from words to bigger units Syntax and Grammars § Context-free grammars § Grammars for English 11/5/2020 Speech and Language Processing - Jurafsky and Martin 2

Syntax § By grammar, or syntax, we have in mind the kind of implicit

Syntax § By grammar, or syntax, we have in mind the kind of implicit knowledge of your native language that you had mastered by the time you were 3 years old without explicit instruction § Not the kind of stuff you were later taught in “grammar” school 11/5/2020 Speech and Language Processing - Jurafsky and Martin 3

Syntax § Phrase-structure grammars, transformational syntax, Xbar theory, principles and parameters, government and binding,

Syntax § Phrase-structure grammars, transformational syntax, Xbar theory, principles and parameters, government and binding, relational grammar, . . And on and on. 11/5/2020 Speech and Language Processing - Jurafsky and Martin 4

Syntax § Why do we care about syntax? § Grammars are key components in

Syntax § Why do we care about syntax? § Grammars are key components in many applications § § § 11/5/2020 Grammar checkers Dialogue management Question answering Information extraction Machine translation Speech and Language Processing - Jurafsky and Martin 5

Syntax § Key notions that we’ll cover § Constituency § And ordering § Grammatical

Syntax § Key notions that we’ll cover § Constituency § And ordering § Grammatical relations and Dependency § Heads, agreement § Key formalism for us § Context-free grammars § Resources § Treebanks 11/5/2020 Speech and Language Processing - Jurafsky and Martin 6

Constituency § The basic idea here is that groups of words within utterances can

Constituency § The basic idea here is that groups of words within utterances can be shown to act as single units § And in a given language, these units form coherent classes that can be shown to behave in similar ways 11/5/2020 Speech and Language Processing - Jurafsky and Martin 7

Context-Free Grammars § Context-free grammars (CFGs) § Also known as § Phrase structure grammars

Context-Free Grammars § Context-free grammars (CFGs) § Also known as § Phrase structure grammars § Consist of § Rules § Terminals § Non-terminals 11/5/2020 Speech and Language Processing - Jurafsky and Martin 8

Context-Free Grammars § Terminals § Take these to be words (for now) § Non-Terminals

Context-Free Grammars § Terminals § Take these to be words (for now) § Non-Terminals § The constituents in a language § Like noun phrase, verb phrase and sentence § Rules consist of a single non-terminal on the left and any number of terminals and nonterminals on the right. 11/5/2020 Speech and Language Processing - Jurafsky and Martin 9

Generativity § As with FSAs, you can view these rules as either analysis §

Generativity § As with FSAs, you can view these rules as either analysis § Generate strings in the language § Reject strings not in the language § Impose structures (trees) on strings in the language 11/5/2020 Speech and Language Processing - Jurafsky and Martin 10

Derivations § A derivation is a sequence of rules applied to a string that

Derivations § A derivation is a sequence of rules applied to a string that accounts for that string § Covers all the elements in the string § Covers only the elements in the string 11/5/2020 Speech and Language Processing - Jurafsky and Martin 11

An English Grammar Fragment § Sentences § Noun phrases § Agreement § Verb phrases

An English Grammar Fragment § Sentences § Noun phrases § Agreement § Verb phrases § Subcategorization 11/5/2020 Speech and Language Processing - Jurafsky and Martin 12

Sentence Types § Declaratives: A plane left. § Imperatives: Leave! § Yes-No Questions: Did

Sentence Types § Declaratives: A plane left. § Imperatives: Leave! § Yes-No Questions: Did the plane leave? § WH Questions: When did the plane leave? 11/5/2020 Speech and Language Processing - Jurafsky and Martin 13

Determiners § Noun phrases can start with determiners. . . § Determiners can be

Determiners § Noun phrases can start with determiners. . . § Determiners can be § Simple lexical items: the, this, a, an, etc. § A car § Or simple possessives § John’s car § Or complex recursive versions of possessives § John’s sister’s husband’s son’s car 11/5/2020 Speech and Language Processing - Jurafsky and Martin 14

Nominals § Contains the head any pre- and postmodifiers of the head. § Pre§

Nominals § Contains the head any pre- and postmodifiers of the head. § Pre§ Quantifiers, cardinals, ordinals. . . § Three cars § Adjectives and Aps § large cars § Ordering constraints § Three large cars § ? large three cars 11/5/2020 Speech and Language Processing - Jurafsky and Martin 15

Postmodifiers § Three kinds § Prepositional phrases § From Seattle § Non-finite clauses §

Postmodifiers § Three kinds § Prepositional phrases § From Seattle § Non-finite clauses § Arriving before noon § Relative clauses § That serve breakfast 11/5/2020 Speech and Language Processing - Jurafsky and Martin 16

Agreement § By agreement, we have in mind constraints that hold among various constituents

Agreement § By agreement, we have in mind constraints that hold among various constituents that take part in a rule or set of rules § For example, in English, determiners and the head nouns in NPs have to agree in their number. This flight Those flights 11/5/2020 *This flights *Those flight Speech and Language Processing - Jurafsky and Martin 17

Verb Phrases § English VPs consist of a head verb along with 0 or

Verb Phrases § English VPs consist of a head verb along with 0 or more following constituents which we’ll call arguments. 11/5/2020 Speech and Language Processing - Jurafsky and Martin 18

Summary § Context-free grammars can be used to model various facts about the syntax

Summary § Context-free grammars can be used to model various facts about the syntax of a language. § Constituency is a key phenomena easily captured with CFG rules. § But agreement and subcategorization do pose significant problems 11/5/2020 Speech and Language Processing - Jurafsky and Martin 19