computational language: week 10 lexical knowledge representation concluded syntax-based...
TRANSCRIPT
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
ThinkPresent
1st person singular think (I think)2nd person singular think (you think)3rd person singular thinks (she thinks)1st person plural think (we think)2nd person plural think (you two think)3rd 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 Mary syntactic level
(b) saw (John1, Mary2) semantic level
(c) Mary was seen by John syntactic level(d) Mary sent John books syntactic level(e) sent (Mary1, John2, books3) semantic level
(f) saw: 1 = agent, 2 = patient(g) sent: 1 = agent, 2 = goal, 3 = patient
Structure of sentences: syntax
Max met Jane
Max gave Jane bananas
Structure of sentences: syntax N V N Max met Jane
N V N 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 structure1. My mother likes her cats
S
[my mother likes her cats]
Hierarchical structure1. My mother likes her cats
S
[my mother likes her cats]
NP [my mother]
VP [likes her cats]
Hierarchical structure1. My mother likes her cats
S
[my mother likes her cats]
NP [my mother]
VP [likes her cats]
Det N [my]
[mother]
Hierarchical structure1. My mother likes her cats
S
[my mother likes her cats]
NP [my mother]
VP [likes her cats]
Det N [my]
[mother]
V NP
[her cats]
[likes]
Hierarchical structure1. My mother likes her cats
S
[my mother likes her cats]
NP [my mother]
VP [likes her cats]
Det N [my]
[mother]
V NP
[her cats]
[likes]
Det N [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 parsingmy mother likes her cats
S
NP VP
Det N V NP
Det N
S
NP VP
Det N V
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
Top-down
Bottom-up
advantages disadvantages No search on trees that are not rooted in S Search space will include trees that are
not rooted in S
disadvantages advantages Generates trees which are not at all consistent with the input data
Any candidate tree will at the very least be consistent with the input data
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
Category Left corners (Part of Speech) S
Noun or Determiner
NP Noun or Determiner VP Verb PP Preposition
Sentence parsing Problems
Left recursionGrammar has a non-terminal symbol that
has a expansion that includes itself ANDit is the left-most symbol in the expansion
e.g. NP -> NP PP
Sentence parsing Problems
Structural ambiguityA given input sentence fits more than one
candidate parse treee.g. my friend saw the man with the telescope
…NP -> NP PPVP -> V NP PP…
Sentence parsing Applications
Grammar checker Semantic analysis