Feature Structures, Unification Some grammatical phenomena - - PowerPoint PPT Presentation

feature structures unification
SMART_READER_LITE
LIVE PREVIEW

Feature Structures, Unification Some grammatical phenomena - - PowerPoint PPT Presentation

Feature Structures, Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Feature Structures, Unification Some grammatical phenomena Linguistic features Feature structures Operations on Scott Farrar feature


slide-1
SLIDE 1

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Feature Structures, Unification

Scott Farrar CLMA, University of Washington farrar@u.washington.edu February 3, 2010

1/45

slide-2
SLIDE 2

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Today’s lecture

1

Some grammatical phenomena Linguistic features

2

Feature structures

3

Operations on feature structures Subsumption Unification

4

Features in the NLTK Creating feature structures FeatStruct behavior

2/45

slide-3
SLIDE 3

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Verb types

Consider the phrase structure rules in the PTB for verbs: VP → VBZ NP ...breaks the jar VP → VBP NP ...break the jar VP → VBD NP ...broke the jar VP → VBN NP ...broken the jar

3/45

slide-4
SLIDE 4

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Verb types

Consider the phrase structure rules in the PTB for verbs: VP → VBZ NP ...breaks the jar VP → VBP NP ...break the jar VP → VBD NP ...broke the jar VP → VBN NP ...broken the jar We could capture the regularity by a rule like this: VP → VBx NP What exactly is ‘x’ representing?

3/45

slide-5
SLIDE 5

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Noun types

And for nouns: NP → DT NN ...the book NP → DT NNS ...the books

4/45

slide-6
SLIDE 6

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Noun types

And for nouns: NP → DT NN ...the book NP → DT NNS ...the books We could capture the regularity by a rule like this: NP → DT NNx What exactly is ‘x’ representing?

4/45

slide-7
SLIDE 7

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subject-Verb Agreement

The parrot talks.

5/45

slide-8
SLIDE 8

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subject-Verb Agreement

The parrot talks. *The parrot talk.

5/45

slide-9
SLIDE 9

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subject-Verb Agreement

The parrot talks. *The parrot talk. They know Mary.

5/45

slide-10
SLIDE 10

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subject-Verb Agreement

The parrot talks. *The parrot talk. They know Mary. *They knows Mary.

5/45

slide-11
SLIDE 11

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subject-Verb Agreement

The parrot talks. *The parrot talk. They know Mary. *They knows Mary. We sing.

5/45

slide-12
SLIDE 12

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subject-Verb Agreement

The parrot talks. *The parrot talk. They know Mary. *They knows Mary. We sing. *We sings.

5/45

slide-13
SLIDE 13

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subject-Verb Agreement

The parrot talks. *The parrot talk. They know Mary. *They knows Mary. We sing. *We sings. Furthermore agreement infomation is not captured in treebanks such as the PTB: S → NP VP The NNx in the NP does not depend on the VBx in the VP.

5/45

slide-14
SLIDE 14

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature:

6/45

slide-15
SLIDE 15

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes

6/45

slide-16
SLIDE 16

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes number: he dances, they dance

6/45

slide-17
SLIDE 17

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes number: he dances, they dance case: he brings John, John brings him

6/45

slide-18
SLIDE 18

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes number: he dances, they dance case: he brings John, John brings him tense: go, went, gone

6/45

slide-19
SLIDE 19

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes number: he dances, they dance case: he brings John, John brings him tense: go, went, gone modality: may, can,

6/45

slide-20
SLIDE 20

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes number: he dances, they dance case: he brings John, John brings him tense: go, went, gone modality: may, can, honorifics (e.g., Japanese)

6/45

slide-21
SLIDE 21

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes number: he dances, they dance case: he brings John, John brings him tense: go, went, gone modality: may, can, honorifics (e.g., Japanese) evidentiality (e.g., Shipibo)

6/45

slide-22
SLIDE 22

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

linguistic feature: a property-like element that changes the grammatical behavior of syntactic constituents; the elements into which linguistic units, such as words, can be broken

  • down. For a given sub-domain of grammar, there is a

relevant feature: person: I go, you go, he goes number: he dances, they dance case: he brings John, John brings him tense: go, went, gone modality: may, can, honorifics (e.g., Japanese) evidentiality (e.g., Shipibo) noun class (e.g., Chinese)

6/45

slide-23
SLIDE 23

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain:

7/45

slide-24
SLIDE 24

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd

7/45

slide-25
SLIDE 25

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc.

7/45

slide-26
SLIDE 26

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc. case: accusative, ergative, locative, directional

7/45

slide-27
SLIDE 27

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc. case: accusative, ergative, locative, directional tense: past, present, future, hodiernal past, hesternal past

7/45

slide-28
SLIDE 28

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc. case: accusative, ergative, locative, directional tense: past, present, future, hodiernal past, hesternal past modality: conditional, subjunctive, abilitative

7/45

slide-29
SLIDE 29

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc. case: accusative, ergative, locative, directional tense: past, present, future, hodiernal past, hesternal past modality: conditional, subjunctive, abilitative honorifics: plus honorific, minus honorific

7/45

slide-30
SLIDE 30

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc. case: accusative, ergative, locative, directional tense: past, present, future, hodiernal past, hesternal past modality: conditional, subjunctive, abilitative honorifics: plus honorific, minus honorific evidentiality: visual, auditory, hearsay, folklore

7/45

slide-31
SLIDE 31

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc. case: accusative, ergative, locative, directional tense: past, present, future, hodiernal past, hesternal past modality: conditional, subjunctive, abilitative honorifics: plus honorific, minus honorific evidentiality: visual, auditory, hearsay, folklore noun class: I, II, III, etc.

7/45

slide-32
SLIDE 32

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Features and values

Definition

Features are usually modeled as pairs of feature names and feature values. A value refers to the language-specific phenomenon within the sub-domain: person: 1st, 2nd, 3rd number: singular, plural, paucal, dual, trial, etc. case: accusative, ergative, locative, directional tense: past, present, future, hodiernal past, hesternal past modality: conditional, subjunctive, abilitative honorifics: plus honorific, minus honorific evidentiality: visual, auditory, hearsay, folklore noun class: I, II, III, etc. See http://grammaticalfeatures.net for a nice summary of features from a strictly linguistics perspective.

7/45

slide-33
SLIDE 33

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Ontology of features

Whereas NPs, VPs, NNs, etc. are conceived of as categories (first-order “citizens”) in the grammar, features are more property-like.

8/45

slide-34
SLIDE 34

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Ontology of features

Whereas NPs, VPs, NNs, etc. are conceived of as categories (first-order “citizens”) in the grammar, features are more property-like. The VP has the feature value ‘past tense’ The verb is a ‘past tense’ verb The noun has a case feature ‘absolutive’.

8/45

slide-35
SLIDE 35

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Ontology of features

Whereas NPs, VPs, NNs, etc. are conceived of as categories (first-order “citizens”) in the grammar, features are more property-like. The VP has the feature value ‘past tense’ The verb is a ‘past tense’ verb The noun has a case feature ‘absolutive’. Just like, for example, an object like a car can have a color property red.

8/45

slide-36
SLIDE 36

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Bundles of feature (values)

Sometimes features are conceived of as the atomic units that compose more complex categories.

9/45

slide-37
SLIDE 37

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Bundles of feature (values)

Sometimes features are conceived of as the atomic units that compose more complex categories. A noun is a feature bundle of semantic, morphological and phonological features:    form ‘dog’ number singular animacy animate   

9/45

slide-38
SLIDE 38

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Today’s lecture

1

Some grammatical phenomena Linguistic features

2

Feature structures

3

Operations on feature structures Subsumption Unification

4

Features in the NLTK Creating feature structures FeatStruct behavior

10/45

slide-39
SLIDE 39

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Feature structures

A feature structure is, informally speaking, a set of feature names and values:    feature1 value1 feature2 value2 feature3 value3    A feature structure is defined according to particular grammatical traditions: Functional Unification Grammar Lexical Functional Grammar Head-Driven Phrase Structure Grammar (Ling566)

11/45

slide-40
SLIDE 40

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Typed feature structures: HPSG formal definition

Definition

A typed feature structure is defined on a finite set of features Feat and a type hierarchy Type, ⊑. It is a tuple Q, r, δ, θ where: Q is a finite set of nodes, r ∈ Q (r is the root node) θ : Q − → Type is a partial typing function δ : Q × Feat − → Q is a partial feature value function

12/45

slide-41
SLIDE 41

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Typed feature structures: HPSG formal definition

Definition

A typed feature structure is defined on a finite set of features Feat and a type hierarchy Type, ⊑. It is a tuple Q, r, δ, θ where: Q is a finite set of nodes, r ∈ Q (r is the root node) θ : Q − → Type is a partial typing function δ : Q × Feat − → Q is a partial feature value function subject to the following conditions:

1 r isn’t a θ-descendant. 2 all members of Q except r are θ-descendants of r. 3 Some systems add an extra (no cycles) condition:

there is no node n or path π such that δ(n, π) = n. from Copestake (2000), Appendix.

12/45

slide-42
SLIDE 42

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

More about feature values

atomic value: an unstructured value, one with only one part

  • tense

past person 2

  • 13/45
slide-43
SLIDE 43

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

More about feature values

atomic value: an unstructured value, one with only one part

  • tense

past person 2

  • complex value: a structured value, itself a feature structure

    tense past agreement

  • person

2 number singular

  

13/45

slide-44
SLIDE 44

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Graphs or matrices

Feature structures are a type of attribute-value matrix (AVM), a more generalized data structure used to represent all kinds of information. Feature structures (and AVMs) can be represented as graphs with nodes and arcs (cf. text book figures)

14/45

slide-45
SLIDE 45

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Graphs or matrices

Feature structures are a type of attribute-value matrix (AVM), a more generalized data structure used to represent all kinds of information. Feature structures (and AVMs) can be represented as graphs with nodes and arcs (cf. text book figures) Nodes correspond to variable values and the paths to the variable names. Arcs represent the feature names. A feature path is a list of features through a feature structure leading to a particular value.

14/45

slide-46
SLIDE 46

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Feature path

    tense past agreement

  • person

2 number singular

   Path: agreement number = singular

15/45

slide-47
SLIDE 47

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Feature path

    tense past agreement

  • person

2 number singular

   Path: agreement number = singular

15/45

slide-48
SLIDE 48

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Feature path

    tense past agreement

  • person

2 number singular

   Path: agreement number = singular

15/45

slide-49
SLIDE 49

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Feature path

    tense past agreement

  • person

2 number singular

   Path: agreement number = singular

15/45

slide-50
SLIDE 50

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Reentrant structures

Definition

Reentrant structure: one in which the attribute has a value that is another feature structure.         S

  • head

1

  • NP
  • head
  • agr

2

  • VP
  • head

1

  • agr

2

      

16/45

slide-51
SLIDE 51

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Reentrant structures

Definition

Reentrant structure: one in which the attribute has a value that is another feature structure.         S

  • head

1

  • NP
  • head
  • agr

2

  • VP
  • head

1

  • agr

2

       A feature structure can be used to represent partial information.

16/45

slide-52
SLIDE 52

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

More linguistic examples

Feature structure for a verb:        cat VB lex | GO | tense past aspect progressive form “was going”        Feature structure for a noun:      cat NN lex | dog | number PL form “dogs”     

17/45

slide-53
SLIDE 53

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Linguistic examples

Feature structure for a noun phrase (e.g., the boy):

2 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4 cat NP spec

1

2 6 6 6 4 cat DT number SG definite yes form “the” 3 7 7 7 5 head

2

2 6 6 6 4 cat NN number SG lex | boy | form “boy” 3 7 7 7 5 definite yes number SG 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 5

18/45

slide-54
SLIDE 54

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Today’s lecture

1

Some grammatical phenomena Linguistic features

2

Feature structures

3

Operations on feature structures Subsumption Unification

4

Features in the NLTK Creating feature structures FeatStruct behavior

19/45

slide-55
SLIDE 55

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

Definition

Subsumption is a relation that holds between feature

  • structures. A less specific (more abstract) feature structure

subsumes an equally or more specific one. The subsumption symbol is ⊑.

  • number

PL

  • 20/45
slide-56
SLIDE 56

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

Definition

Subsumption is a relation that holds between feature

  • structures. A less specific (more abstract) feature structure

subsumes an equally or more specific one. The subsumption symbol is ⊑.

  • number

PL

  • number

PL person 3

  • 20/45
slide-57
SLIDE 57

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

Definition

Subsumption is a relation that holds between feature

  • structures. A less specific (more abstract) feature structure

subsumes an equally or more specific one. The subsumption symbol is ⊑.

  • number

PL

  • number

PL person 3

   number PL person 3 lex | dog |   

20/45

slide-58
SLIDE 58

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

  • number

PL person 3

  • number

PL

  • number

PL

  • ?
  • number

SG

  • ?
  • number

SG

  • 21/45
slide-59
SLIDE 59

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

  • number

PL person 3

  • ?
  • number

PL

  • number

PL

  • ?
  • number

SG

  • ?
  • number

SG

  • 21/45
slide-60
SLIDE 60

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

  • number

PL person 3

  • ¬

  • number

PL

  • number

PL

  • ?
  • number

SG

  • ?
  • number

SG

  • 21/45
slide-61
SLIDE 61

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

  • number

PL person 3

  • ¬

  • number

PL

  • number

PL

  • ?
  • number

SG

  • ?
  • number

SG

  • 21/45
slide-62
SLIDE 62

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

  • number

PL person 3

  • ¬

  • number

PL

  • number

PL

  • ¬

  • number

SG

  • ?
  • number

SG

  • 21/45
slide-63
SLIDE 63

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

  • number

PL person 3

  • ¬

  • number

PL

  • number

PL

  • ¬

  • number

SG

  • ?
  • number

SG

  • 21/45
slide-64
SLIDE 64

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

  • number

PL person 3

  • ¬

  • number

PL

  • number

PL

  • ¬

  • number

SG

  • number

SG

  • 21/45
slide-65
SLIDE 65

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Subsumption

Criteria for ⊑

F ⊑ G iff: For every feature x in F, F(x) ⊑ G(x), where F(x) means “the value of the feature x of feature structure F”. For all paths p and q in F such that F(p) = F(q), it is also the case that G(p) = G(q).

22/45

slide-66
SLIDE 66

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

Definition

Unification is a binary operation over two features structures f 1 and f 2, used for comparing or combining information.

23/45

slide-67
SLIDE 67

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

Definition

Unification is a binary operation over two features structures f 1 and f 2, used for comparing or combining information. Unification of f 1 and f 2 either returns a merged feature structure with the information from both f 1 and f 2, or false if f 1 and f 2 are incompatible. The unification operator is represented by: ⊔.

23/45

slide-68
SLIDE 68

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

Definition

Unification is a binary operation over two features structures f 1 and f 2, used for comparing or combining information. Unification of f 1 and f 2 either returns a merged feature structure with the information from both f 1 and f 2, or false if f 1 and f 2 are incompatible. The unification operator is represented by: ⊔.

  • number

PL

  • person

2

  • 23/45
slide-69
SLIDE 69

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

Definition

Unification is a binary operation over two features structures f 1 and f 2, used for comparing or combining information. Unification of f 1 and f 2 either returns a merged feature structure with the information from both f 1 and f 2, or false if f 1 and f 2 are incompatible. The unification operator is represented by: ⊔.

  • number

PL

  • person

2

  • =
  • number

PL person 2

  • 23/45
slide-70
SLIDE 70

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

For comparing information in two feature structures, unification can be used. Are two feature structures the same, or are they incompatible?

  • number

PL

  • number

PL

  • =

24/45

slide-71
SLIDE 71

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

For comparing information in two feature structures, unification can be used. Are two feature structures the same, or are they incompatible?

  • number

PL

  • number

PL

  • =
  • number

PL

  • 24/45
slide-72
SLIDE 72

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

For comparing information in two feature structures, unification can be used. Are two feature structures the same, or are they incompatible?

  • number

PL

  • number

PL

  • =
  • number

PL

  • number

PL

  • number

SG

  • =

24/45

slide-73
SLIDE 73

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

For comparing information in two feature structures, unification can be used. Are two feature structures the same, or are they incompatible?

  • number

PL

  • number

PL

  • =
  • number

PL

  • number

PL

  • number

SG

  • =

False

24/45

slide-74
SLIDE 74

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

For comparing information in two feature structures, unification can be used. Are two feature structures the same, or are they incompatible?

  • number

PL

  • number

PL

  • =
  • number

PL

  • number

PL

  • number

SG

  • =

False Unification preserves and possibly adds information to the resulting feature structure. This property is called:

24/45

slide-75
SLIDE 75

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The unification operation

For comparing information in two feature structures, unification can be used. Are two feature structures the same, or are they incompatible?

  • number

PL

  • number

PL

  • =
  • number

PL

  • number

PL

  • number

SG

  • =

False Unification preserves and possibly adds information to the resulting feature structure. This property is called: monotonicity

24/45

slide-76
SLIDE 76

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification of dissimilar structures

  • agreement
  • number

PL

  • number

PL

  • =

25/45

slide-77
SLIDE 77

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification of dissimilar structures

  • agreement
  • number

PL

  • number

PL

  • =

   agreement

  • number

PL

  • number

PL

 

25/45

slide-78
SLIDE 78

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification: example

Grammar entry for a sentence

2 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4 cat S voice active agent

1

" cat NP number

4

# process

2

" cat VB number

4

# patient

3

h cat NP i pattern 2 6 4 subject

1

verb

2

  • bject

3

3 7 5 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 5

26/45

slide-79
SLIDE 79

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification: example

Grammar entry for a noun phrase

2 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4 cat NP spec

1

2 6 4 cat DT number

3

definite

4

3 7 5 head

2

" cat NN number

3

# number

3

definite

4

pattern " first

1

second

2

# 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 5

27/45

slide-80
SLIDE 80

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification: example

Lexical entries in AVM form      cat DT definite yes number SG form “the”           cat DT definite yes number PL form “these”     

28/45

slide-81
SLIDE 81

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification: example

Unifying a noun phrase with a determiner

2 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4 cat NP spec

1

2 6 4 cat DT number

3

definite

4

3 7 5 head

2

" cat NN number

3

# number

3

definite

4

pattern " first

1

second

2

# 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 5 ⊔ 2 6 6 6 4 cat DT definite yes number PL form “these” 3 7 7 7 5

29/45

slide-82
SLIDE 82

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification: example

Unifying the right part of a noun phrase with a determiner

2 6 4 cat DT number

3

definite

4

3 7 5 ⊔ 2 6 6 6 4 cat DT definite yes number PL form “these” 3 7 7 7 5 =

30/45

slide-83
SLIDE 83

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification: example

Unifying the right part of a noun phrase with a determiner

2 6 4 cat DT number

3

definite

4

3 7 5 ⊔ 2 6 6 6 4 cat DT definite yes number PL form “these” 3 7 7 7 5 = 2 6 6 6 4 cat DT definite yes number PL form “these” 3 7 7 7 5

30/45

slide-84
SLIDE 84

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification: example

Result of unification                         cat NP spec

1

     cat DT number PL definite yes form “these”      head

2

  • cat

NN number PL

  • number

PL definite yes pattern

  • first

1

second

2

                      

31/45

slide-85
SLIDE 85

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Today’s lecture

1

Some grammatical phenomena Linguistic features

2

Feature structures

3

Operations on feature structures Subsumption Unification

4

Features in the NLTK Creating feature structures FeatStruct behavior

32/45

slide-86
SLIDE 86

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The main features module

The NLTK has a module for feature structures and accompanying operations: nltk.featstruct The basic feature structure nltk.featstruct.FeatStruct is implemented as a mapping (dictionary) from features to values. >>>from nltk.featstruct import FeatStruct >>>fs1 = FeatStruct(number=‘singular’, person=3) >>>print fs1 [ number = ‘singular’ ] [ person = 3 ]

33/45

slide-87
SLIDE 87

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

The main features module

>>>fs2 = FeatStruct(type=‘NP’, agr=fs1) >>>print fs2 [ agr = [ number = ‘singular’ ] ] [ [ person = 3 ] ] [ ] [ type = ’NP’ ]

34/45

slide-88
SLIDE 88

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification in the NLTK

The NLTK has an implementation of unification with nltk.featstruct.FeatStruct.unify().

fs1 [ agr = [ number = ‘singular’ ] ] [ [ person = 3 ] ] [ ] [ type = ’NP’ ] fs2 [ agr = [ number = ?n ] ] [ ] [ subj = [ number = ?n ] ]

35/45

slide-89
SLIDE 89

Feature Structures, Unification Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu Some grammatical phenomena

Linguistic features

Feature structures Operations on feature structures

Subsumption Unification

Features in the NLTK

Creating feature structures FeatStruct behavior

Unification in the NLTK

>>>print fs2.unify(fs3) [ agr = [ number = ‘singular’ ] ] [ [ person = 3 ] ] [ ] [ subj = [ number = ‘singular’ ] ] [ ] [ type = ‘NP’ ]

36/45

slide-90
SLIDE 90

Creating feature structures: FeatStruct

fs1 = FeatStruct(agreement= \ FeatStruct(number=‘singular’, person=‘third’))

slide-91
SLIDE 91

Creating feature structures: FeatStruct

fs1 = FeatStruct(agreement= \ FeatStruct(number=‘singular’, person=‘third’)) [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]

slide-92
SLIDE 92

Creating feature structures: FeatStruct

fs1 = FeatStruct(agreement= \ FeatStruct(number=‘singular’, person=‘third’)) [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]

Use the FeatStruct constructor; note how quotes are used.

slide-93
SLIDE 93

Creating feature structures, short-hand

fs1 = FeatStruct("[agreement = \ [number=‘singular’,person=‘third’]]")

slide-94
SLIDE 94

Creating feature structures, short-hand

fs1 = FeatStruct("[agreement = \ [number=‘singular’,person=‘third’]]") [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]

slide-95
SLIDE 95

Creating feature structures, short-hand

fs1 = FeatStruct("[agreement = \ [number=‘singular’,person=‘third’]]") [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]

The feature structure is parsed from the string. Values are quoted.

slide-96
SLIDE 96

Creating feature structures, short-hand w/o value quotes

fs1 = FeatStruct("[agreement = \ [number=singular,person=third]]")

slide-97
SLIDE 97

Creating feature structures, short-hand w/o value quotes

fs1 = FeatStruct("[agreement = \ [number=singular,person=third]]") [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]

slide-98
SLIDE 98

Creating feature structures, short-hand w/o value quotes

fs1 = FeatStruct("[agreement = \ [number=singular,person=third]]") [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]

Value quotes aren’t necessary.

slide-99
SLIDE 99

Using indices

fs = FeatStruct("[\ NAME=Lee, \ ADDRESS=(1)[NUMBER=74, STREET=‘rue Pascal’],\ SPOUSE=[NAME=Kim, ADDRESS->(1)],]")

slide-100
SLIDE 100

Using indices

fs = FeatStruct("[\ NAME=Lee, \ ADDRESS=(1)[NUMBER=74, STREET=‘rue Pascal’],\ SPOUSE=[NAME=Kim, ADDRESS->(1)],]") [ ADDRESS = (1) [ NUMBER = 74 ] ] [ [ STREET = ‘rue Pascal’ ] ] [ ] [ NAME = ’Lee’ ] [ ] [ SPOUSE = [ ADDRESS -> (1) ] ] [ [ NAME = ‘Kim’ ] ]

slide-101
SLIDE 101

Using indices

fs = FeatStruct("[\ NAME=Lee, \ ADDRESS=(1)[NUMBER=74, STREET=‘rue Pascal’],\ SPOUSE=[NAME=Kim, ADDRESS->(1)],]") [ ADDRESS = (1) [ NUMBER = 74 ] ] [ [ STREET = ‘rue Pascal’ ] ] [ ] [ NAME = ’Lee’ ] [ ] [ SPOUSE = [ ADDRESS -> (1) ] ] [ [ NAME = ‘Kim’ ] ]

The index is assigned a value, and then referenced.

slide-102
SLIDE 102

Using indices: reference before assignment

fs = FeatStruct("[\ NAME=Lee, \ SPOUSE=[NAME=Kim, ADDRESS->(1)], \ ADDRESS=(1)[NUMBER=74, STREET=‘rue Pascal’]]")

slide-103
SLIDE 103

Using indices: reference before assignment

fs = FeatStruct("[\ NAME=Lee, \ SPOUSE=[NAME=Kim, ADDRESS->(1)], \ ADDRESS=(1)[NUMBER=74, STREET=‘rue Pascal’]]") ValueError: Error parsing feature structure [NAME=Lee, SPOUSE=[NAME=Kim, ADDRESS->(1)], ... ^ Expected bound identifier

slide-104
SLIDE 104

Using variables

from nltk.sem.logic import Variable fs10=FeatStruct("\ [NP=[head=[agreement=?n]], \ VP=[head=(1)[agreement=?n]]]")

slide-105
SLIDE 105

Using variables

from nltk.sem.logic import Variable fs10=FeatStruct("\ [NP=[head=[agreement=?n]], \ VP=[head=(1)[agreement=?n]]]") [ NP = [ head = [ agreement = ?n ] ] ] [ ] [ VP = [ head = [ agreement = ?n ] ] ]

slide-106
SLIDE 106

Example from textbook

What does this feature structure represent?

2 6 6 6 6 6 6 4 S h head

1

i NP » head h agreement

2

i – VP » head

1

h agreement

2

i – 3 7 7 7 7 7 7 5

slide-107
SLIDE 107

Example from textbook

What does this feature structure represent?

2 6 6 6 6 6 6 4 S h head

1

i NP » head h agreement

2

i – VP » head

1

h agreement

2

i – 3 7 7 7 7 7 7 5

S → NPVP

slide-108
SLIDE 108

Example from textbook

What does this feature structure represent?

2 6 6 6 6 6 6 4 S h head

1

i NP » head h agreement

2

i – VP » head

1

h agreement

2

i – 3 7 7 7 7 7 7 5

S → NPVP NP head agreement = VP head agreement

slide-109
SLIDE 109

Example from textbook

What does this feature structure represent?

2 6 6 6 6 6 6 4 S h head

1

i NP » head h agreement

2

i – VP » head

1

h agreement

2

i – 3 7 7 7 7 7 7 5

S → NPVP NP head agreement = VP head agreement S head = VP head

slide-110
SLIDE 110

Need to combine variables and indices

fs3=FeatStruct("\ [NP=[head=[agreement=?n]], \ VP=[head=(1)[agreement=?n]], \ S=[head->(1)]]")

slide-111
SLIDE 111

Need to combine variables and indices

fs3=FeatStruct("\ [NP=[head=[agreement=?n]], \ VP=[head=(1)[agreement=?n]], \ S=[head->(1)]]") [ NP = [ head = [ agreement = ?n ] ] ] [ ] [ S = [ head = (1) [ agreement = ?n ] ] ] [ ] [ VP = [ head -> (1) ]

slide-112
SLIDE 112

Unification in NLTK

[ VP = [ head = [ agreement = [ number = ‘singular’ ] ] ] ] [ [ [ [ person = ‘third’ ] ] ] ] [ NP = [ head = [ agreement = ?n ] ] ] [ ] [ S = [ head = (1) [ agreement = ?n ] ] ] [ ] [ VP = [ head -> (1) ] ]

slide-113
SLIDE 113

Unification in NLTK

[ VP = [ head = [ agreement = [ number = ‘singular’ ] ] ] ] [ [ [ [ person = ‘third’ ] ] ] ] [ NP = [ head = [ agreement = ?n ] ] ] [ ] [ S = [ head = (1) [ agreement = ?n ] ] ] [ ] [ VP = [ head -> (1) ] ] [ NP = [ head = [ agreement = (1) [ number = ‘singular’ ] ] ] ] [ [ [ [ person = ‘third’ ] ] ] ] [ ] [ S = [ head = (2) [ agreement -> (1) ] ] ] [ ] [ VP = [ head -> (2) ] ]

Printed version looks odd, but graph is intact.