Computational language: week 10 Lexical Knowledge Representation concluded Syntax-based computational language Sentence structure: syntax Context free grammars Phrase Structure rules Parsing with phrase structure grammars
Lexical Knowledge Representation concluded
Modelling verbs in DATR Think Present 1 st person singular think (I think) 2 nd person singular think (you think) 3 rd person singular thinks (she thinks) 1 st person plural think (we think) 2 nd person plural think (you two think) 3 rd person plural think (they think)
Lexical knowledge representation continued Summary Inheritance Inference rules Formalism Computable
Syntax-based computational language
Sentence structure Units of the sentence are constituents Constituent: a group of words treated as a single unit Minimum constituent is the word Structure of the sentence: syntax
Structure of sentences: syntax what is syntax? “characteriz[ing] the relation between semantic predicate-argument relations and the superficial word and phrase configurations by which a language expresses them” (Kaplan 2003)
Structure of sentences: syntax (a)John saw Marysyntactic level (b)saw (John 1, Mary 2 )semantic level (c)Mary was seen by Johnsyntactic level (d)Mary sent John bookssyntactic level (e)sent (Mary 1, John 2, books 3 )semantic level (f)saw: 1 = agent, 2 = patient (g)sent: 1 = agent, 2 = goal, 3 = patient
Structure of sentences: syntax MaxmetJane Max gave Jane bananas
Structure of sentences: syntax N VN MaxmetJane NVN N Max gave Jane bananas
Structure of sentences: syntax The boys watched the game
Structure of sentences: syntax [The boys] watched [the game]
Structure of sentences: syntax [The boys] watched [the game] The boys from Brazil watched an interesting game on TV
Structure of sentences: syntax [The boys] watched [the game] [The boys from Brazil] watched [an interesting game on TV]
Structure of sentences: syntax [The boys] watched [the game] [The boys from Brazil]l watched [an interesting game on TV] My mother sent Mary a recipe
Structure of sentences: syntax [The boys] watched [the game] [The boys from Brazil]l watched [an interesting game on TV] [My mother] sent Mary [a recipe]
Structure of sentences: syntax [The boys] watched [the game] [The boys from Brazil]l watched [an interesting game on TV] [My mother] sent [a recipe] to Mary My mother in London sent my sister the wrong recipe
Structure of sentences: syntax NP V NP [The boys] watched [the game] NP V NP [The boys from Brazil] watched [an interesting game on TV] NP V NP NP [My mother] sent Mary [a recipe] NP V NP NP [My mother in London] sent [my sister] [the wrong recipe]
Context Free Grammars Taking linear strings as input Producing non-linear hierarchical data structures (graphs) as outputs Assumption: sentences have a constituent structure
Hierarchical structure 1. My mother likes her cats
Hierarchical structure 1. My mother likes her cats
Hierarchical structure 1. My mother likes her cats
Hierarchical structure 1. My mother likes her cats
Hierarchical structure 1. My mother likes her cats
Context Free Grammars Phrase structure rules Item(s) to right of arrow is an ordered list of symbols Item to left is a generalization over this list Start symbol Rules unordered
Context Free Grammars Phrase structure rules The student enjoys maths The birds sang The relatives of my husband live in Chicago The student drove his car into the tree
Context Free Grammars Formal language Set of strings derivable from designated start symbol S Strings are ‘grammatical’ sentences
Context Free Grammars Four parameters Set of non-terminal symbols or variables Set of terminal symbols (found in lexicon) Set of phrase structure rules Designated start symbol
Computable grammars The evaluation of a grammar: Its ability to capture significant generalizations within the specific grammar of a given language, and across the grammars of different languages
Context Free Grammars / Phrase Structure Grammars (PSG) Historical note Popularised by Chomsky Chomsky’s Transformational Grammar Famous computable example: Generalised Phrase Structure Grammar (Gazdar et al.)
Sentence parsing recognize / accept a sentence generate sentences
Sentence parsing recognize / accept a sentence generate sentences parsing: assign correct structure to a sentence i.e. match a sentence to the correct parse tree of the number of parse trees generated by a grammar
Sentence parsing my mother likes her cats
Sentence parsing the set of possible trees generated by the grammar is the search space parsing is searching through the space to find correct tree for the given sentence goal: find all trees which: 1. have their root in S 2. cover no more or less the words in the input
Sentence parsing Two methods 1. top-down parsing The tree must have S as its root Deduction reasoning Rule-driven
Sentence parsing Two methods 1. top-down parsing 2. bottom-up parsing The tree must have n number of leaves, and the following terminal symbols: x, y, z Induction reasoning Data-driven
Sentence parsing Two methods 1. top-down parsing trees grown downward to syntactic category nodes trees rejected if leaf nodes do not line up with all words in input
Sentence parsing Two methods 2. bottom-up parsing trees grown upwards from the input sentence, using the grammar
Sentence parsing Two methods
Sentence parsing Top-down Parallel Depth-first, left-to-right: fully expand each partial tree beginning at the left-most node
Sentence parsing Top-down Bottom-up filtering Left-corner table
Sentence parsing Top-down Bottom-up filtering Left-corner table
Sentence parsing Problems Left recursion Grammar has a non-terminal symbol that has a expansion that includes itself AND it is the left-most symbol in the expansion e.g. NP -> NP PP
Sentence parsing Problems Structural ambiguity A given input sentence fits more than one candidate parse tree e.g. my friend saw the man with the telescope … NP -> NP PP VP -> V NP PP …
Sentence parsing Applications Grammar checker Semantic analysis