32
FMZ Elaborazione del linguaggio naturale Fabio Massimo Zanzotto

Elaborazione del linguaggio naturale

  • Upload
    niran

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: Elaborazione del linguaggio naturale

FMZ

Elaborazione del linguaggio naturale

Fabio Massimo Zanzotto

Page 2: Elaborazione del linguaggio naturale

FMZ

Part five

Feature Structures

Page 3: Elaborazione del linguaggio naturale

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

Page 4: Elaborazione del linguaggio naturale

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)

Page 5: Elaborazione del linguaggio naturale

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

Page 6: Elaborazione del linguaggio naturale

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

Page 7: Elaborazione del linguaggio naturale

FMZ

Our Aim

Lines of development

Grammatical Representation Power:

• CFG (context free grammars) DCG

Grammar Use:

• CYK

• Chart and Early Algorithm

Page 8: Elaborazione del linguaggio naturale

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

Page 9: Elaborazione del linguaggio naturale

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

Page 10: Elaborazione del linguaggio naturale

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)

Page 11: Elaborazione del linguaggio naturale

FMZ

Necessary extensions

• Introducing notions like:– gender: masculine, feminine– number: singular, plural– person (for verbs)– time (for verbs)– mood (for verbs)

Page 12: Elaborazione del linguaggio naturale

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

Page 13: Elaborazione del linguaggio naturale

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!!

Page 14: Elaborazione del linguaggio naturale

FMZ

Feature Structures

Page 15: Elaborazione del linguaggio naturale

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

Page 16: Elaborazione del linguaggio naturale

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

Agreement:

npCat:

Gen: mas

Num: sing

Page 17: Elaborazione del linguaggio naturale

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

Page 18: Elaborazione del linguaggio naturale

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

Page 19: Elaborazione del linguaggio naturale

FMZ

Lexicon: examples

forma_superficiale: mangeremo

radice: mangi

coniugazione: are

numero: plur

persona: 2

modo: indicativo

tempo: futuro

Page 20: Elaborazione del linguaggio naturale

FMZ

Lexicon: examples

forma_superficiale: mangerebbe

radice: mangi

lemma: mangiare

coniugazione: are

numero: sing

persona: 3

modo: condizionale

tempo: presente

Page 21: Elaborazione del linguaggio naturale

FMZ

Lexicon: examples

forma_superficiale: uomini

lemma: uomo

numero: plur

genere: mas

Page 22: Elaborazione del linguaggio naturale

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

Page 23: Elaborazione del linguaggio naturale

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. v v’

Page 24: Elaborazione del linguaggio naturale

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: uomolemma: uomonumero: singgenere: mas

Page 25: Elaborazione del linguaggio naturale

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: presenteSubsumption is not sufficient!

Page 26: Elaborazione del linguaggio naturale

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

Page 27: Elaborazione del linguaggio naturale

FMZ

Unification Exampleforma_superficiale: mangierebbe

radice: mangi

lemma: mangiare

cat: verbo

coniugazione: are

numero: sing

persona: 3

modo: condizionale

tempo: presente

forma_superficiale: mangierebbeforma_fonologica: xxx

forma_superficiale: mangierebbe

radice: mangi

forma_fonologica: xxx

lemma: mangiare

cat: verbo

coniugazione: are

numero: sing

persona: 3

modo: condizionale

tempo: presente

=

=

Page 28: Elaborazione del linguaggio naturale

FMZ

Unification

forma_superficiale: mangierebbe

radice: mangi

lemma: mangiare

cat: verbo

coniugazione: are

numero: sing

persona: 3

modo: condizionale

tempo: presente

forma_superficiale: mangiaforma_fonologica: xxx

Unification between two feature structures may not exist.

Page 29: Elaborazione del linguaggio naturale

FMZ

Coindexing

What if we want to apply this rule?

forma_superficiale: mangierebbe

radice: mangi

lemma: mangiare

cat: verbo

coniugazione: are

numero: sing

persona: 3

modo: condizionale

tempo: presente

forma_superficiale: uomolemma: uomocat: nomenumero: singgenere: mas

cat: s cat: nomenumero: [1]

cat: verbonumero: [1]persona: 3

Page 30: Elaborazione del linguaggio naturale

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 | _ ] | _ ]

Page 31: Elaborazione del linguaggio naturale

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

Page 32: Elaborazione del linguaggio naturale

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