Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- linguistic feature : a property-like element that changes the rar@u.washington.edu grammatical behavior of syntactic constituents; the elements Some grammatical phenomena into which linguistic units, such as words, can be broken Linguistic features down. For a given sub-domain of grammar, there is a Feature structures relevant feature: Operations on feature structures Subsumption person : I go, you go, he goes Unification Features in the number : he dances, they dance NLTK Creating feature structures case : he brings John, John brings him FeatStruct behavior tense : go, went, gone modality : may, can, 6/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- linguistic feature : a property-like element that changes the rar@u.washington.edu grammatical behavior of syntactic constituents; the elements Some grammatical phenomena into which linguistic units, such as words, can be broken Linguistic features down. For a given sub-domain of grammar, there is a Feature structures relevant feature: Operations on feature structures Subsumption person : I go, you go, he goes Unification Features in the number : he dances, they dance NLTK Creating feature structures case : he brings John, John brings him FeatStruct behavior tense : go, went, gone modality : may, can, honorifics (e.g., Japanese) 6/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- linguistic feature : a property-like element that changes the rar@u.washington.edu grammatical behavior of syntactic constituents; the elements Some grammatical phenomena into which linguistic units, such as words, can be broken Linguistic features down. For a given sub-domain of grammar, there is a Feature structures relevant feature: Operations on feature structures Subsumption person : I go, you go, he goes Unification Features in the number : he dances, they dance NLTK Creating feature structures case : he brings John, John brings him FeatStruct behavior tense : go, went, gone modality : may, can, honorifics (e.g., Japanese) evidentiality (e.g., Shipibo) 6/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- linguistic feature : a property-like element that changes the rar@u.washington.edu grammatical behavior of syntactic constituents; the elements Some grammatical phenomena into which linguistic units, such as words, can be broken Linguistic features down. For a given sub-domain of grammar, there is a Feature structures relevant feature: Operations on feature structures Subsumption person : I go, you go, he goes Unification Features in the number : he dances, they dance NLTK Creating feature structures case : he brings John, John brings him FeatStruct behavior tense : go, went, gone modality : may, can, honorifics (e.g., Japanese) evidentiality (e.g., Shipibo) noun class (e.g., Chinese) 6/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures Operations on feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption case : accusative, ergative, locative, directional Unification Features in the NLTK Creating feature structures FeatStruct behavior 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption case : accusative, ergative, locative, directional Unification tense : past, present, future, hodiernal past, hesternal Features in the NLTK past Creating feature structures FeatStruct behavior 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption case : accusative, ergative, locative, directional Unification tense : past, present, future, hodiernal past, hesternal Features in the NLTK past Creating feature structures modality : conditional, subjunctive, abilitative FeatStruct behavior 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption case : accusative, ergative, locative, directional Unification tense : past, present, future, hodiernal past, hesternal Features in the NLTK past Creating feature structures modality : conditional, subjunctive, abilitative FeatStruct behavior honorifics : plus honorific, minus honorific 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption case : accusative, ergative, locative, directional Unification tense : past, present, future, hodiernal past, hesternal Features in the NLTK past Creating feature structures modality : conditional, subjunctive, abilitative FeatStruct behavior honorifics : plus honorific, minus honorific evidentiality : visual, auditory, hearsay, folklore 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption case : accusative, ergative, locative, directional Unification tense : past, present, future, hodiernal past, hesternal Features in the NLTK past Creating feature structures modality : conditional, subjunctive, abilitative FeatStruct behavior honorifics : plus honorific, minus honorific evidentiality : visual, auditory, hearsay, folklore noun class : I, II, III, etc. 7/45
Feature Structures, Features and values Unification Scott Farrar Definition CLMA, University of Washington far- Features are usually modeled as pairs of feature names and rar@u.washington.edu feature values . A value refers to the language-specific Some grammatical phenomenon within the sub-domain: phenomena Linguistic features Feature structures person : 1st, 2nd, 3rd Operations on number : singular, plural, paucal, dual, trial, etc. feature structures Subsumption case : accusative, ergative, locative, directional Unification tense : past, present, future, hodiernal past, hesternal Features in the NLTK past Creating feature structures modality : conditional, subjunctive, abilitative FeatStruct behavior 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
Feature Structures, Ontology of features Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Whereas NPs, VPs, NNs, etc. are conceived of as categories Some grammatical phenomena (first-order “citizens”) in the grammar, features are more Linguistic features property-like . Feature structures Operations on feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 8/45
Feature Structures, Ontology of features Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Whereas NPs, VPs, NNs, etc. are conceived of as categories Some grammatical phenomena (first-order “citizens”) in the grammar, features are more Linguistic features property-like . Feature structures Operations on feature structures The VP has the feature value ‘past tense’ Subsumption Unification The verb is a ‘past tense’ verb Features in the NLTK The noun has a case feature ‘absolutive’. Creating feature structures FeatStruct behavior 8/45
Feature Structures, Ontology of features Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Whereas NPs, VPs, NNs, etc. are conceived of as categories Some grammatical phenomena (first-order “citizens”) in the grammar, features are more Linguistic features property-like . Feature structures Operations on feature structures The VP has the feature value ‘past tense’ Subsumption Unification The verb is a ‘past tense’ verb Features in the NLTK The noun has a case feature ‘absolutive’. Creating feature structures FeatStruct behavior Just like, for example, an object like a car can have a color property red . 8/45
Feature Structures, Bundles of feature (values) Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Sometimes features are conceived of as the atomic units that Linguistic features compose more complex categories. Feature structures Operations on feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 9/45
Feature Structures, Bundles of feature (values) Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Sometimes features are conceived of as the atomic units that Linguistic features compose more complex categories. Feature structures Operations on feature structures A noun is a feature bundle of semantic, morphological and Subsumption Unification phonological features: Features in the form ‘dog’ NLTK Creating feature structures number singular FeatStruct behavior animacy animate 9/45
Feature Structures, Today’s lecture Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena 1 Some grammatical Linguistic features phenomena Linguistic features Feature structures Feature structures 2 Operations on feature structures Subsumption Operations on feature structures 3 Unification Features in the Subsumption NLTK Unification Creating feature structures FeatStruct behavior Features in the NLTK 4 Creating feature structures FeatStruct behavior 10/45
Feature Structures, Feature structures Unification Scott Farrar CLMA, University of Washington far- A feature structure is, informally speaking, a set of feature rar@u.washington.edu names and values: Some grammatical phenomena Linguistic features feature 1 value 1 Feature structures feature 2 value 2 Operations on feature structures feature 3 value 3 Subsumption Unification Features in the NLTK A feature structure is defined according to particular Creating feature structures grammatical traditions: FeatStruct behavior Functional Unification Grammar Lexical Functional Grammar Head-Driven Phrase Structure Grammar (Ling566) 11/45
Feature Structures, Typed feature structures: HPSG formal definition Unification Scott Farrar Definition CLMA, University of Washington far- rar@u.washington.edu A typed feature structure is defined on a finite set of features Feat and a type hierarchy � Type , ⊑� . It is a tuple Some grammatical phenomena � Q , r , δ, θ � where: Linguistic features Q is a finite set of nodes, Feature structures Operations on r ∈ Q ( r is the root node) feature structures Subsumption θ : Q − → Type is a partial typing function Unification Features in the δ : Q × Feat − → Q is a partial feature value function NLTK Creating feature structures FeatStruct behavior 12/45
Feature Structures, Typed feature structures: HPSG formal definition Unification Scott Farrar Definition CLMA, University of Washington far- rar@u.washington.edu A typed feature structure is defined on a finite set of features Feat and a type hierarchy � Type , ⊑� . It is a tuple Some grammatical phenomena � Q , r , δ, θ � where: Linguistic features Q is a finite set of nodes, Feature structures Operations on r ∈ Q ( r is the root node) feature structures Subsumption θ : Q − → Type is a partial typing function Unification Features in the δ : Q × Feat − → Q is a partial feature value function NLTK Creating feature subject to the following conditions: structures FeatStruct behavior 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
Feature Structures, More about feature values Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu atomic value : an unstructured value, one with only one part Some grammatical phenomena � � Linguistic features tense past Feature structures person 2 Operations on feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 13/45
Feature Structures, More about feature values Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu atomic value : an unstructured value, one with only one part Some grammatical phenomena � � Linguistic features tense past Feature structures person 2 Operations on feature structures Subsumption Unification complex value : a structured value, itself a feature structure Features in the NLTK tense past Creating feature structures FeatStruct behavior � � person 2 agreement number singular 13/45
Feature Structures, Graphs or matrices Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Feature structures are a type of attribute-value matrix Some grammatical (AVM), a more generalized data structure used to represent phenomena Linguistic features all kinds of information. Feature structures (and AVMs) can Feature structures be represented as graphs with nodes and arcs (cf. text book Operations on figures) feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 14/45
Feature Structures, Graphs or matrices Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Feature structures are a type of attribute-value matrix Some grammatical (AVM), a more generalized data structure used to represent phenomena Linguistic features all kinds of information. Feature structures (and AVMs) can Feature structures be represented as graphs with nodes and arcs (cf. text book Operations on figures) feature structures Subsumption Unification Features in the Nodes correspond to variable values and the paths to NLTK Creating feature the variable names. structures FeatStruct behavior Arcs represent the feature names. A feature path is a list of features through a feature structure leading to a particular value. 14/45
Feature Structures, Feature path Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features tense past Feature structures � � person 2 Operations on agreement feature structures number singular Subsumption Unification Features in the NLTK Path: Creating feature � agreement number � = singular structures FeatStruct behavior 15/45
Feature Structures, Feature path Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features tense past Feature structures � � person 2 Operations on agreement feature structures number singular Subsumption Unification Features in the NLTK Path: Creating feature � agreement number � = singular structures FeatStruct behavior 15/45
Feature Structures, Feature path Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features tense past Feature structures � � person 2 Operations on agreement feature structures singular number Subsumption Unification Features in the NLTK Path: Creating feature � agreement number � = singular structures FeatStruct behavior 15/45
Feature Structures, Feature path Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features tense past Feature structures � � person 2 Operations on agreement feature structures number singular Subsumption Unification Features in the NLTK Path: Creating feature � agreement number � = singular structures FeatStruct behavior 15/45
Feature Structures, Reentrant structures Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Definition Some grammatical Reentrant structure : one in which the attribute has a phenomena value that is another feature structure. Linguistic features Feature structures Operations on � � S head 1 feature structures Subsumption Unification � � � � NP head agr 2 Features in the NLTK Creating feature � � structures � � VP head agr FeatStruct behavior 1 2 16/45
Feature Structures, Reentrant structures Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Definition Some grammatical Reentrant structure : one in which the attribute has a phenomena value that is another feature structure. Linguistic features Feature structures Operations on � � S head 1 feature structures Subsumption Unification � � � � NP head agr 2 Features in the NLTK Creating feature � � structures � � VP head agr FeatStruct behavior 1 2 A feature structure can be used to represent partial information. 16/45
Feature Structures, More linguistic examples Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Feature structure for a verb: Some grammatical cat VB phenomena Linguistic features lex | GO | Feature structures tense past Operations on aspect progressive feature structures Subsumption form “was going” Unification Features in the Feature structure for a noun: NLTK Creating feature structures cat NN FeatStruct behavior lex | dog | number PL form “dogs” 17/45
Feature Structures, Linguistic examples Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Feature structure for a noun phrase (e.g., the boy ): Some grammatical 2 3 cat NP phenomena Linguistic features 2 3 6 cat DT 7 6 7 Feature structures 6 7 number SG 6 7 6 7 Operations on spec 1 6 7 6 7 feature structures definite yes 6 7 6 7 4 5 6 7 Subsumption 6 7 form “the” Unification 6 7 6 7 Features in the 6 2 3 7 cat NN NLTK 6 7 6 7 Creating feature number SG 6 7 6 7 structures head 2 6 7 6 7 FeatStruct behavior lex | boy | 6 6 7 7 4 5 6 7 6 7 form “boy” 6 7 6 7 6 definite yes 7 4 5 number SG 18/45
Feature Structures, Today’s lecture Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena 1 Some grammatical Linguistic features phenomena Linguistic features Feature structures Feature structures 2 Operations on feature structures Subsumption Operations on feature structures 3 Unification Features in the Subsumption NLTK Unification Creating feature structures FeatStruct behavior Features in the NLTK 4 Creating feature structures FeatStruct behavior 19/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical Definition phenomena Linguistic features Subsumption is a relation that holds between feature Feature structures structures. A less specific (more abstract) feature structure Operations on feature structures subsumes an equally or more specific one. The subsumption Subsumption Unification symbol is ⊑ . Features in the NLTK Creating feature structures � � FeatStruct behavior number PL 20/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical Definition phenomena Linguistic features Subsumption is a relation that holds between feature Feature structures structures. A less specific (more abstract) feature structure Operations on feature structures subsumes an equally or more specific one. The subsumption Subsumption Unification symbol is ⊑ . Features in the NLTK Creating feature � � structures number PL � � FeatStruct behavior number PL ⊑ person 3 20/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical Definition phenomena Linguistic features Subsumption is a relation that holds between feature Feature structures structures. A less specific (more abstract) feature structure Operations on feature structures subsumes an equally or more specific one. The subsumption Subsumption Unification symbol is ⊑ . Features in the NLTK number PL Creating feature � � structures number PL � � FeatStruct behavior number PL ⊑ ⊑ person 3 person 3 lex | dog | 20/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena � � Linguistic features number PL � � number PL Feature structures person 3 Operations on feature structures Subsumption � � � � number PL ? number SG Unification Features in the NLTK � � � � Creating feature number SG ? structures FeatStruct behavior 21/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena � � Linguistic features number PL � � ? number PL Feature structures person 3 Operations on feature structures Subsumption � � � � number PL ? number SG Unification Features in the NLTK � � � � Creating feature number SG ? structures FeatStruct behavior 21/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena � � Linguistic features number PL � � ¬ ⊑ number PL Feature structures person 3 Operations on feature structures Subsumption � � � � number PL ? number SG Unification Features in the NLTK � � � � Creating feature number SG ? structures FeatStruct behavior 21/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena � � Linguistic features number PL � � ¬ ⊑ number PL Feature structures person 3 Operations on feature structures Subsumption � � � � number PL ? number SG Unification Features in the NLTK � � � � Creating feature number SG ? structures FeatStruct behavior 21/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena � � Linguistic features number PL � � ¬ ⊑ number PL Feature structures person 3 Operations on feature structures Subsumption � � � � number PL ¬ ⊑ number SG Unification Features in the NLTK � � � � Creating feature number SG ? structures FeatStruct behavior 21/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena � � Linguistic features number PL � � ¬ ⊑ number PL Feature structures person 3 Operations on feature structures Subsumption � � � � number PL ¬ ⊑ number SG Unification Features in the NLTK � � � � Creating feature number SG ? structures FeatStruct behavior 21/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena � � Linguistic features number PL � � ¬ ⊑ number PL Feature structures person 3 Operations on feature structures Subsumption � � � � number PL ¬ ⊑ number SG Unification Features in the NLTK � � � � Creating feature number SG ⊑ structures FeatStruct behavior 21/45
Feature Structures, Subsumption Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Criteria for ⊑ Linguistic features Feature structures F ⊑ G iff: Operations on feature structures For every feature x in F , F ( x ) ⊑ G ( x ), where F ( x ) Subsumption means “the value of the feature x of feature structure Unification Features in the F ”. NLTK Creating feature For all paths p and q in F such that F ( p ) = F ( q ), it is structures FeatStruct behavior also the case that G ( p ) = G ( q ). 22/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Definition Some grammatical Unification is a binary operation over two features phenomena Linguistic features structures f 1 and f 2, used for comparing or combining Feature structures information. Operations on feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 23/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Definition Some grammatical Unification is a binary operation over two features phenomena Linguistic features structures f 1 and f 2, used for comparing or combining Feature structures information. Operations on feature structures Subsumption Unification of f 1 and f 2 either returns a merged feature Unification Features in the structure with the information from both f 1 and f 2, or false NLTK Creating feature if f 1 and f 2 are incompatible. The unification operator is structures FeatStruct behavior represented by: ⊔ . 23/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Definition Some grammatical Unification is a binary operation over two features phenomena Linguistic features structures f 1 and f 2, used for comparing or combining Feature structures information. Operations on feature structures Subsumption Unification of f 1 and f 2 either returns a merged feature Unification Features in the structure with the information from both f 1 and f 2, or false NLTK Creating feature if f 1 and f 2 are incompatible. The unification operator is structures FeatStruct behavior represented by: ⊔ . � � � � number PL ⊔ person 2 23/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Definition Some grammatical Unification is a binary operation over two features phenomena Linguistic features structures f 1 and f 2, used for comparing or combining Feature structures information. Operations on feature structures Subsumption Unification of f 1 and f 2 either returns a merged feature Unification Features in the structure with the information from both f 1 and f 2, or false NLTK Creating feature if f 1 and f 2 are incompatible. The unification operator is structures FeatStruct behavior represented by: ⊔ . � � number PL � � � � number PL ⊔ person 2 = person 2 23/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu For comparing information in two feature structures, Some grammatical unification can be used. Are two feature structures the phenomena Linguistic features same, or are they incompatible? Feature structures Operations on � � � � feature structures number PL ⊔ number PL = Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 24/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu For comparing information in two feature structures, Some grammatical unification can be used. Are two feature structures the phenomena Linguistic features same, or are they incompatible? Feature structures Operations on � � � � � � feature structures number PL ⊔ number PL = number PL Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 24/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu For comparing information in two feature structures, Some grammatical unification can be used. Are two feature structures the phenomena Linguistic features same, or are they incompatible? Feature structures Operations on � � � � � � feature structures number PL ⊔ number PL = number PL Subsumption Unification � � � � Features in the number PL ⊔ number SG = NLTK Creating feature structures FeatStruct behavior 24/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu For comparing information in two feature structures, Some grammatical unification can be used. Are two feature structures the phenomena Linguistic features same, or are they incompatible? Feature structures Operations on � � � � � � feature structures number PL ⊔ number PL = number PL Subsumption Unification � � � � Features in the number PL ⊔ number SG = False NLTK Creating feature structures FeatStruct behavior 24/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu For comparing information in two feature structures, Some grammatical unification can be used. Are two feature structures the phenomena Linguistic features same, or are they incompatible? Feature structures Operations on � � � � � � feature structures number PL ⊔ number PL = number PL Subsumption Unification � � � � Features in the number PL ⊔ number SG = False NLTK Creating feature structures FeatStruct behavior Unification preserves and possibly adds information to the resulting feature structure. This property is called: 24/45
Feature Structures, The unification operation Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu For comparing information in two feature structures, Some grammatical unification can be used. Are two feature structures the phenomena Linguistic features same, or are they incompatible? Feature structures Operations on � � � � � � feature structures number PL ⊔ number PL = number PL Subsumption Unification � � � � Features in the number PL ⊔ number SG = False NLTK Creating feature structures FeatStruct behavior Unification preserves and possibly adds information to the resulting feature structure. This property is called: monotonicity 24/45
Feature Structures, Unification of dissimilar structures Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features � � � � � � Feature structures agreement number PL ⊔ number PL = Operations on feature structures Subsumption Unification Features in the NLTK Creating feature structures FeatStruct behavior 25/45
Feature Structures, Unification of dissimilar structures Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features � � � � � � Feature structures agreement number PL ⊔ number PL = Operations on feature structures � � agreement number PL Subsumption Unification Features in the � � number PL NLTK Creating feature structures FeatStruct behavior 25/45
Feature Structures, Unification: example Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Grammar entry for a sentence Some grammatical 2 3 cat S phenomena Linguistic features voice active 6 7 6 7 Feature structures 6 7 " # cat NP 6 7 agent Operations on 6 1 7 6 number 7 4 feature structures 6 7 Subsumption 6 7 " # 6 7 cat VB Unification 6 7 process 2 6 7 Features in the number 4 6 7 NLTK 6 7 6 7 Creating feature h i patient cat NP 6 7 structures 3 6 7 FeatStruct behavior 6 7 2 3 6 subject 7 1 6 7 6 7 verb pattern 6 2 7 6 7 4 5 4 5 object 3 26/45
Feature Structures, Unification: example Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Grammar entry for a noun phrase Some grammatical 2 3 cat NP phenomena Linguistic features 6 2 3 7 cat DT 6 7 Feature structures 6 7 spec number 6 1 6 3 7 7 Operations on 4 5 6 7 feature structures 6 definite 7 4 6 7 Subsumption 6 7 " # Unification 6 7 cat NN 6 7 head 2 Features in the 6 7 number 3 6 7 NLTK 6 7 Creating feature 6 7 number 3 structures 6 7 FeatStruct behavior 6 7 definite 4 6 7 6 7 " # 6 7 first 1 6 7 pattern 4 5 second 2 27/45
Feature Structures, Unification: example Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Lexical entries in AVM form Some grammatical phenomena cat DT Linguistic features definite yes Feature structures Operations on number SG feature structures Subsumption form “the” Unification Features in the cat DT NLTK Creating feature definite yes structures FeatStruct behavior number PL form “these” 28/45
Feature Structures, Unification: example Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Unifying a noun phrase with a determiner Some grammatical 2 3 cat NP phenomena Linguistic features 6 2 3 7 cat DT 6 7 Feature structures 6 7 spec number 1 6 3 7 6 7 Operations on 6 4 5 7 6 definite 7 feature structures 4 2 3 cat DT 6 7 Subsumption 6 7 " # 6 7 Unification cat NN definite yes 6 7 6 7 head ⊔ 2 6 7 Features in the 6 7 number 6 number PL 7 3 6 7 NLTK 4 5 6 7 form “these” Creating feature 6 7 number 3 structures 6 7 FeatStruct behavior 6 7 definite 4 6 7 6 7 " # 6 7 first 1 6 7 pattern 4 5 second 2 29/45
Feature Structures, Unification: example Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features Feature structures Unifying the right part of a noun phrase with a determiner Operations on 2 3 cat DT 2 3 feature structures cat DT definite yes Subsumption 6 7 ⊔ number = 6 3 7 6 7 Unification 4 5 6 number PL 7 Features in the definite 4 5 4 form “these” NLTK Creating feature structures FeatStruct behavior 30/45
Feature Structures, Unification: example Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features Feature structures Unifying the right part of a noun phrase with a determiner Operations on 2 3 2 3 cat DT cat DT 2 3 feature structures cat DT definite yes definite yes Subsumption 6 7 6 7 ⊔ number = 6 3 7 6 7 6 7 Unification 4 5 6 number PL 7 6 number PL 7 Features in the definite 4 5 4 5 4 form “these” form “these” NLTK Creating feature structures FeatStruct behavior 30/45
Feature Structures, Unification: example Unification Scott Farrar CLMA, University Result of unification of Washington far- rar@u.washington.edu cat NP Some grammatical cat DT phenomena Linguistic features number PL Feature structures spec 1 definite yes Operations on feature structures form “these” Subsumption Unification � � cat NN Features in the NLTK head 2 number PL Creating feature structures FeatStruct behavior number PL definite yes � � first 1 pattern second 2 31/45
Feature Structures, Today’s lecture Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena 1 Some grammatical Linguistic features phenomena Linguistic features Feature structures Feature structures 2 Operations on feature structures Subsumption Operations on feature structures 3 Unification Features in the Subsumption NLTK Unification Creating feature structures FeatStruct behavior Features in the NLTK 4 Creating feature structures FeatStruct behavior 32/45
Feature Structures, The main features module Unification Scott Farrar CLMA, University The NLTK has a module for feature structures and of Washington far- rar@u.washington.edu accompanying operations: nltk.featstruct Some grammatical phenomena The basic feature structure nltk.featstruct.FeatStruct Linguistic features Feature structures is implemented as a mapping (dictionary) from features to Operations on values. feature structures Subsumption Unification >>>from nltk.featstruct import FeatStruct Features in the NLTK Creating feature structures >>>fs1 = FeatStruct(number=‘singular’, person=3) FeatStruct behavior >>>print fs1 [ number = ‘singular’ ] [ person = 3 ] 33/45
Feature Structures, The main features module Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena >>>fs2 = FeatStruct(type=‘NP’, agr=fs1) Linguistic features Feature structures >>>print fs2 Operations on feature structures Subsumption Unification Features in the [ agr = [ number = ‘singular’ ] ] NLTK Creating feature [ [ person = 3 ] ] structures FeatStruct behavior [ ] [ type = ’NP’ ] 34/45
Feature Structures, Unification in the NLTK Unification Scott Farrar CLMA, University of Washington far- The NLTK has an implementation of unification with rar@u.washington.edu nltk.featstruct.FeatStruct.unify() . Some grammatical phenomena Linguistic features fs1 Feature structures Operations on feature structures [ agr = [ number = ‘singular’ ] ] Subsumption [ [ person = 3 ] ] Unification [ ] Features in the [ type = ’NP’ ] NLTK Creating feature structures FeatStruct behavior fs2 [ agr = [ number = ?n ] ] [ ] [ subj = [ number = ?n ] ] 35/45
Feature Structures, Unification in the NLTK Unification Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Some grammatical phenomena Linguistic features >>>print fs2.unify(fs3) Feature structures [ agr = [ number = ‘singular’ ] ] Operations on [ [ person = 3 ] ] feature structures Subsumption [ ] Unification Features in the [ subj = [ number = ‘singular’ ] ] NLTK [ ] Creating feature structures FeatStruct behavior [ type = ‘NP’ ] 36/45
Creating feature structures: FeatStruct fs1 = FeatStruct(agreement= \ FeatStruct(number=‘singular’, person=‘third’))
Creating feature structures: FeatStruct fs1 = FeatStruct(agreement= \ FeatStruct(number=‘singular’, person=‘third’)) [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]
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.
Creating feature structures, short-hand fs1 = FeatStruct("[agreement = \ [number=‘singular’,person=‘third’]]")
Creating feature structures, short-hand fs1 = FeatStruct("[agreement = \ [number=‘singular’,person=‘third’]]") [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]
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.
Creating feature structures, short-hand w/o value quotes fs1 = FeatStruct("[agreement = \ [number=singular,person=third]]")
Creating feature structures, short-hand w/o value quotes fs1 = FeatStruct("[agreement = \ [number=singular,person=third]]") [ agreement = [ number = ‘singular’ ] ] [ [ person = ‘third’ ] ]
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.
Using indices fs = FeatStruct("[\ NAME=Lee, \ ADDRESS=(1)[NUMBER=74, STREET=‘rue Pascal’],\ SPOUSE=[NAME=Kim, ADDRESS->(1)],]")
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’ ] ]
Recommend
More recommend