320 likes | 472 Views
Elaborazione del linguaggio naturale. Fabio Massimo Zanzotto. Part five. Feature Structures. Where we are?. Target of the analysis: interpret NL sentences with respect to a sort of anambiguos internal laguage
E N D
Elaborazione del linguaggio naturale Fabio Massimo Zanzotto FMZ
Part five Feature Structures FMZ
Where we are? Target of the analysis: • interpret NL sentences with respect to a sort of anambiguos internal laguage • Natural Languages is a ambiguous and social beast vs. Formal Languages is unambiguous and “top-down” decided • What’s a language model: • treating infinite sentences with generative machinaries with a finite set of rules FMZ
How we proceeded so far... ASSIOM: A syntactic interpretation of a sentence helps in understanding its semantics Let’s build a syntactic model for NL!! • Analysis of the chomsky hierarchy • Use of Context-free formalisms and related parsing algoritms • CYK • DCG (in prolog) FMZ
How we proceeded so far... OBSERVATION: NL is more difficult that what we may think Let us renounce to the total grammaticality!!! • Model offering Partial Analysis • CYK • Chart parsing and early algorithm FMZ
Our Aim Lines of development Grammatical Representation Power: Build a formalism/model able to give the possibility of reducing the unnecessary interpretations Grammar Use: Build a formalism (and an associated algorithm) able to represent partial analysis FMZ
Our Aim Lines of development Grammatical Representation Power: • CFG (context free grammars) DCG Grammar Use: • CYK • Chart and Early Algorithm FMZ
Observing natural language Toy Examples: ... La vecchia porta la sbarra ... ... Il vecchio porta la sbarra ... ... Flying planes can be dangerous ... ... Flying planes is dangerous ... FMZ
A sample Grammar (introspectively produced) S NP VP | S SBAR | SBAR S SBAR CongSub S S S CongCoord S | S, S CongCoord S NP NP SBAR VP VerbX NP | VerbX NP PP VerbX Verb | Modal Verb NP Art Noun | Art Adj Noun | Noun | Verb Noun | NP PP PP Prep NP FMZ
Observations • The sample grammar is insufficient!! • Spurious interpretations are produced for unambiguous sentences • Loosing the eternal struggle between coverage and induced ambiguity NP Art Noun | Art Adj Noun | Noun | Verb Noun | NP PP ... the old man carries apples ... A) the old man (VP carries apples) B) the old man (NP carries apples) FMZ
Necessary extensions • Introducing notions like: • gender: masculine, feminine • number: singular, plural • person (for verbs) • time (for verbs) • mood (for verbs) FMZ
Grammar Adding number (Sing, Plur) NPSing ArtSing NounSing NPPlur ArtPlur NounPlur VPSing VerbXSing NP | VerbXSing NP PP VPPlur VerbXPlur NP | VerbXPlur NP PP S NPSing VPSing | NPPlur VPPlur FMZ
Grammar Adding number (Sing, Plur) and gender (Mas, Fem) NPMasSing ArtMasSing NounMasSing NPFemSing ArtFemSing NounFemSing NPMasPlur ArtMasPlur NounMasPlur NPFemPlur ArtFemPlur NounFemPlur VPSing VerbXSing NP | VerbXSing NP PP VPPlur VerbXPlur NP | VerbXPlur NP PP S NPMasSing VPSing | NPFemSing VPSing | NPMasPlur VPPlur | NPFemPlur VPPlur !!Rules are uncontrollably proliferating!! FMZ
What do we desire? Adding number (Sing, Plur) and gender (Mas, Fem) NPMasSing ArtMasSing NounMasSing NPFemSing ArtFemSing NounFemSing NPMasPlur ArtMasPlur NounMasPlur NPFemPlur ArtFemPlur NounFemPlur NP_Gen:X_Num:Y Art_Gen:X_Num:Y Noun_Gen:X_Num:Y FMZ
Feature Structures Feature structures (information containers) are: • Sets of attribute-value pairs • a value of an attribute may be: • a final value (i.e., an element from a set) • a feature structure Cat: np Agreement: Gen: mas Num: sing FMZ
Feature Structures Formally if F is a feature structure, • F is a set of pairs (f,v) • given (f,v)F • v is a final value • v is a feature structure FMZ
Feature Structures: Lexicon • nouns • forma_superficiale • lemma • genere • numero • verbs • forma_superficiale • radice • coniugazione: are, ere, ire • genere: mas, fem • numero: sing, plur • persona: 1,2,3 • modo: indicativo, congiuntivo, imperativo • tempo: presente, passato,... • verso: attivo, passivo FMZ
Lexicon: examples forma_superficiale: mangeremo radice: mangi coniugazione: are numero: plur persona: 2 modo: indicativo tempo: futuro FMZ
Lexicon: examples forma_superficiale: mangerebbe radice: mangi lemma: mangiare coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente FMZ
Lexicon: examples forma_superficiale: uomini lemma: uomo numero: plur genere: mas FMZ
How to use the lexicon? “l’uomo mangierebbe pere” that may be seen: [forma_supericiale: l’] [forma_supericiale: uomo] [forma_supericiale: mangierebbe] [forma_supericiale: pere] forma_superficiale: mangierebbe radice: mangi lemma: mangiare coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente FMZ
Comparing feature structures: subsumption • A Feature Structure F1 subsumes F2 (F1 F2) if all the information that is in the F1is also in F2 Formally, F1 F2 se e solo se v=v’ oppure (f,v) F1(f,v’) F2. vv’ FMZ
After the lexicon and the subsumption “l’uomo mangierebbe pere” that may be seen: [forma_supericiale: l’] [forma_supericiale: uomo] [forma_supericiale: mangierebbe] [forma_supericiale: pere] forma_superficiale: mangierebbe radice: mangi lemma: mangiare coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente forma_superficiale: uomo lemma: uomo numero: sing genere: mas FMZ
What if? “l’uomo mangierebbe pere” that may be seen: [ forma_supericiale: l’] [ forma_supericiale: uomo] [ forma_supericiale: mangierebbe , forma_fonologica: xxxx ] [ forma_supericiale: pere] forma_superficiale: mangierebbe radice: mangi lemma: mangiare coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente Subsumption is not sufficient! FMZ
Unification Unification is a partial operation between two feature structures so that the new feature structure contain all the information of the two F1F2 is so that: • F1 F1 F2 • F2 F1 F2 • if H has the property F1 H and F2 H then F1 F2 H FMZ
Unification Example forma_superficiale: mangierebbe radice: mangi lemma: mangiare cat: verbo coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente = forma_superficiale: mangierebbe forma_fonologica: xxx forma_superficiale: mangierebbe radice: mangi forma_fonologica: xxx lemma: mangiare cat: verbo coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente = FMZ
Unification Unification between two feature structures may not exist. forma_superficiale: mangierebbe radice: mangi lemma: mangiare cat: verbo coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente forma_superficiale: mangia forma_fonologica: xxx FMZ
Coindexing What if we want to apply this rule? cat: s cat: nome numero: [1] cat: verbo numero: [1] persona: 3 forma_superficiale: mangierebbe radice: mangi lemma: mangiare cat: verbo coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente forma_superficiale: uomo lemma: uomo cat: nome numero: sing genere: mas FMZ
Feature Structures in Prolog • feature structures will be represented as a open list of attribute value pairs • : (the colon) will be used to form attribute value pairs es. [number:sg, person:3 | _ ] [cat:np, agr:[number:sg, person:3 | _ ] | _ ] FMZ
Unification in Prolog unify0(Dag,Dag) :- !. unify0([Feature:Value|Rest],Dag) :- val(Feature,Value,Dag,StripDag), unify0(Rest,StripDag).val(Feature,Value1,[Feature:Value2|Rest],Rest) :- !, unify0(Value1,Value2).val(Feature,Value,[Dag|Rest],[Dag|NewRest]) :- !, val(Feature,Value,Rest,NewRest). FMZ
Where we worked today? Lines of development Grammatical Representation Power: Build a formalism/model able to give the possibility of reducing the unnecessary interpretations Grammar Use: Build a formalism (and an associated algorithm) able to represent partial analysis FMZ