Download presentation
Presentation is loading. Please wait.
1
Context-Free Parsing Part 2 Features and Unification
2
2/21 Parsing with features We need to constrain the rules in CFGs, for example –to coerce agreement within and between constituents –to pass features around –to enforce subcategorisation constraints Features can be easily added to our grammars And later we’ll see that feature bundles can completely replace constituents
3
3/21 Parsing with features Rules can stipulate values, or placeholders (variables) for values Features can be used within the rule, or passed up via the mother nodes Example: subject-verb agreement S NP VP [if NP and VP agree in number] number of NP depends on noun and/or determiner number of VP depends on verb S NP(num=X) VP (num=X) NP (num=X) det(num=X) n (num=X) VP(num=X) v(num=X) NP(num=?)
4
4/21 Declarative nature of features The rules can be used in various ways –To build an NP only if det and n agree (bottom-up) –When generating an NP, to choose an n which agrees with the det (if working L-to-R) (top-down) –To show that the num value for an NP comes from its components (percolation) –To ensure that the num value is correctly set when generating an NP (inheritance) –To block ill-formed input NP (num=X) det(num=X) n (num=X) this det (num=sg) these det (num=pl) the det (num=?) man n (num=sg) men n (num=pl) det(num=sg) n(num=sg) thisman NP (num=sg) n(num=pl) men
5
5/21 Use of variables Unbound (unassigned) variables (ie variables with a free value): –the can combine with any value for num –Unification means that the num value for the is set to sg NP (num=X) det(num=X) n (num=X) this det (num=sg) these det (num=pl) the det (num=?) man n (num=sg) men n (num=pl) det(num=?) n(num=sg) theman NP (num=sg)
6
6/21 Parsing with features Features must be compatible Formalism should allow features to remain unspecified Feature mismatch can be used to block false analyses, and disambiguate –e.g. they can fish ~ he can fish ~ he cans fish Formalism may have attribute-value pairs, or rely on argument position e.g. NP(_num,_sem) det(_num) n (_num,_sem) an = det(sing) the = det(_num) man = n(sing,hum)
7
7/21 Parsing with features Using features to impose subcategorization constraints VP ve.g. dance VP v NPe.g. eat VP v NP NPe.g. give VP v PPe.g. wait (for) VP(_num) v(_num,intr) VP(_num) v(_num,trans) NP VP(_num) v(_num,ditrans) NP NP VP(_num) v(_num,prepobj(_case)) PP(_case) PP(_case) prep(_case)NP dance = v(plur,intr) dances = v(sing,intr) danced = v(_num,intr) waits = v(sing,prepobj(for)) for = prep(for)
8
8/21 v (sing,intrans) S NP(_num) VP(_num) NP(_num) det(_num) n(_num) VP(_num) v(_num,intrans) VP(_num) v (_num,trans) NP(_1) Parsing with features (top-down) S NP(_num) VP(_num) S NP VP (_num) NP(_num) det(_num) n(_num) the man shot those elephants det n (_num) the = det(_num) the man = n(sing) man VP(sing) v(sing,intrans) shot = v(sing,trans) (sing) VP(sing) v(sing,trans) NP(_1) shot = v(sing,trans) v NP (sing,trans) (_1) shot det n (_1) (_1) thoseelephants (pl) NP(_1) det(_1) n(_1) those = det(pl) elephants = n(pl) _num=sing (pl)
9
9/21 S NP(_num) VP(_num) NP(_num) det(_num) n(_num) VP(_num) v(_num,intrans) VP(_num) v (_num,trans) NP(_1) Parsing with features (bottom-up) S NP(_num) VP(_num) NP(_num) det(_num) n(_num) the man shot those elephants NP (sing) the = det(_num) det (_num) the man = n(sing) shot = v(sing,trans) (sing) S VP(_num) v (_num,trans) NP(_1) VP (sing,trans) those = det(pl) elephants = n(pl) n (sing) man v (sing,trans) shot det (pl) those n (pl) elephants NP (pl)
10
10/21 Feature structures Instead of attaching features to the symbols, we can parse with symbols made up entirely of attribute-value pairs: “feature structures” Can be used in the same way as seen previously Values can be atomic … … or embedded feature structures … CAT NP NUMBER SG PERSON 3 ATTR1 VAL1 ATTR2 VAL2 ATTR3 VAL3 CAT NP AGR NUM SG PERS 3
11
11/21 Feature structures … or they can be coindexed CAT S HEAD AGR 1 SUBJ [ AGR 1 ] NUM SG PERS 3
12
12/21 Parsing with feature structures Grammar rules can specify assignments to or equations between feature structures Expressed as “feature paths” e.g. HEAD.AGR.NUM = SG CAT S HEAD AGR 1 SUBJ [ AGR 1 ] NUM SG PERS 3
13
13/21 Feature unification Feature structures can be unified if –They have like-named attributes that have the same value: [NUM SG] [NUM SG] = [NUM SG] –Like-named attributes that are “open” get the value assigned: CAT NP NUMBER ?? PERSON 3 NUMBER SG PERSON 3 = CAT NP NUMBER SG PERSON 3
14
14/21 Feature unification –Complementary features are brought together –Unification is recursive –Coindexed structures are identical (not just copies): assignment to one effects all CAT NP NUMBER SG [PERSON 3] = CAT NP NUMBER SG PERSON 3 CAT NP AGR [NUM SG] CAT NP AGR NUM SG PERS 3 = CAT NP AGR [PERS 3]
15
15/21 Example CAT NP AGR _1 _2 SEM _3 CAT DET AGR _1 CAT N AGR _2 SEM _3 CAT DET AGR VAL INDEF NUM SG a CAT DET AGR [VAL DEF] the CATN LEX “man” AGR [NUM SG] SEM HUM man
16
16/21 the man the CAT N AGR _2 SEM _3 CAT DET AGR [VAL DEF] the CAT NP AGR _1 _2 SEM [_3] CAT DET AGR _1 [VAL DEF] VAL DEF CATN LEX “man” AGR [NUM SG] SEM HUM man LEX “man” AGR [NUM SG] SEM HUM the man NUM SG HUM
17
17/21 a mana CAT N AGR _2 SEM _3 CAT NP AGR _1 _2 SEM [_3] CAT DET AGR _1 CATN LEX “man” AGR [NUM SG] SEM HUM man LEX “man” AGR [NUM SG] SEM HUM a man [NUM SG] HUM CAT DET AGR VAL INDEF NUM SG a VAL INDEF NUM SG VAL INDEF NUM SG VAL INDEF AGR NUM SG
18
18/21 Types and inheritance Feature typing allows us to constrain possible values a feature can have –e.g. num = {sing,plur} –Allows grammars to be checked for consistency, and can make parsing easier We can express general “feature co-occurrence conditions” … And “feature inheritance rules” Both these allow us to make the grammar more compact
19
19/21 Co-occurrence conditions and Inheritance rules General rules (beyond simple unification) which apply automatically, and so do not need to be stated (and repeated) in each rule or lexical entry Examples: [cat=np] [num=??, gen=??, case=??] [cat=v,num=sg] [tns=pres] [attr1=val1] [attr2=val2]
20
20/21 Inheritance rules Inheritance rules can be over-ridden e.g. [cat=n] [gen=??,sem=??] sex={male,female} gen={masc,fem,neut} [cat=n,gen=fem,sem=hum] [sex=female] uxor [cat=n,gen=fem,sem=hum] agricola [cat=n,gen=fem,sem=hum,sex=male]
21
21/21 Unification in Linguistics Lexical Functional Grammar –If interested, see PARGRAM project GPSG, HPSG Construction Grammar Categorial Grammar
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.