1 / 32

Elaborazione del linguaggio naturale

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

niran
Télécharger la présentation

Elaborazione del linguaggio naturale

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Elaborazione del linguaggio naturale Fabio Massimo Zanzotto FMZ

  2. Part five Feature Structures FMZ

  3. 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

  4. 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

  5. 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

  6. 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

  7. Our Aim Lines of development Grammatical Representation Power: • CFG (context free grammars)  DCG Grammar Use: • CYK • Chart and Early Algorithm FMZ

  8. 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

  9. 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

  10. 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

  11. Necessary extensions • Introducing notions like: • gender: masculine, feminine • number: singular, plural • person (for verbs) • time (for verbs) • mood (for verbs) FMZ

  12. 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

  13. 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

  14. Feature Structures FMZ

  15. 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

  16. 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

  17. 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

  18. 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

  19. Lexicon: examples forma_superficiale: mangeremo radice: mangi coniugazione: are numero: plur persona: 2 modo: indicativo tempo: futuro FMZ

  20. Lexicon: examples forma_superficiale: mangerebbe radice: mangi lemma: mangiare coniugazione: are numero: sing persona: 3 modo: condizionale tempo: presente FMZ

  21. Lexicon: examples forma_superficiale: uomini lemma: uomo numero: plur genere: mas FMZ

  22. 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

  23. 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. vv’ FMZ

  24. 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

  25. 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

  26. Unification Unification is a partial operation between two feature structures so that the new feature structure contain all the information of the two F1F2 is so that: • F1 F1 F2 • F2 F1 F2 • if H has the property F1  H and F2  H then F1 F2 H FMZ

  27. 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

  28. 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

  29. 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

  30. 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

  31. 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

  32. 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

More Related