Context-Free Parsing - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Context-Free Parsing

Description:

We need to constrain the rules in CFGs, for example ... mass nouns can be bare too. n(_agr) -- adj(), n(_agr). ;;; or with noun compounds ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 24
Provided by: Har134
Category:

less

Transcript and Presenter's Notes

Title: Context-Free Parsing


1
Context-Free Parsing
  • Part 2
  • Features and Unification

2
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 well see that feature bundles can
    completely replace constituents

3
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(numX) VP (numX) NP (numX) ? det(numX)
n (numX) VP(numX) ? v(numX) NP(num?)
4
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 (numX) ? det(numX) n (numX)
this det (numsg) these det (numpl) the
det (num?) man n (numsg) men n (numpl)
NP (numsg)
det(numsg) n(numsg)
5
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 (numX) ? det(numX) n (numX)
this det (numsg) these det (numpl) the
det (num?) man n (numsg) men n (numpl)
NP (numsg)
det(num?) n(numsg)
6
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
Parsing with features
VP ? v e.g. dance VP? v NP e.g. eat VP ? v NP
NP e.g. give VP ? v PP e.g. wait (for)
  • Using features to impose subcategorization
    constraints

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
Parsing with features (top-down)
S ? NP(_num) VP(_num) NP(_num) ? det(_num)
n(_num) VP(_num) ? v(_num,intrans) VP(_num) ? v
(_num,trans) NP(_1)
the man shot those elephants
S ? NP(_num) VP(_num)
NP(_num) ? det(_num) n(_num)
the det(_num)
man n(sing)
(sing)
(sing)
_numsing
VP(sing) ? v(sing,intrans)
shot v(sing,trans)
(sing)
(pl)
(sing)
VP(sing) ? v(sing,trans) NP(_1)
shot v(sing,trans)
NP(_1) ? det(_1) n(_1)
(pl)
(pl)
those det(pl)
elephants n(pl)
9
(No Transcript)
10
(No Transcript)
11
ADAPT formalism
s(_fin,_tns) --gt np(_agr,subj),
vp(_agr,_tns,_val). np(_agr,_case) --gt det(_agr),
n(_agr). np(_agr,_case) --gt pro(_agr,_case). np(no
t3sg,_case) --gt n(not3sg). bare
plurals np(3sg,_case) --gt n(mass). mass nouns
can be bare too n(_agr) --gt adj(), n(_agr).
or with noun compounds n(_agr) --gt n(_agr1),
n(_agr). vp(_agr,_tns,_val) --gt
vp(_agr,_tns,_val), pp(). vp(_agr,_tns,_val) --gt
vp(_agr,_tns,_val), adv(). vp(_agr,_tns,intr) --gt
vg(_agr,_tns,intr). vp(_agr,_tns,tr) --gt
vg(_agr,_tns,tr), np(_agr0,obj). _cat() --gt
_cat(), conj(), _cat(). etc
  • Note distinction between _variable and value
  • Rules always have the same number of arguments
  • (or it counts as a different category)
  • Even if the value is of no interest
  • You can even have variable functor names
  • (for those who know Prolog) it looks like
    Prolog, but it aint!

12
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

13
Feature structures
  • or they can be coindexed

CAT S HEAD
14
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
15
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

?

16
Feature unification
  • Complementary features are brought together
  • Unification is recursive
  • Coindexed structures are identical (not just
    copies) assignment to one effects all

?

PERSON 3
CAT NP AGR NUM SG
CAT NP AGR PERS 3
?

17
Example
CAT N AGR _2 SEM _3
CAT NP AGR _1 ? _2 SEM
_3
CAT DET AGR _1
?
CAT DET AGR
?
a
?
CAT DET AGR VAL DEF
the
CAT N LEX man AGR NUM SG SEM
HUM
?
man
18
the man
the
the man
CAT N AGR _2 SEM _3
CAT NP AGR _1
? _2 SEM _3
CAT DET AGR _1
?
LEX man AGR NUM SG SEM HUM
VAL DEF
VAL DEF
NUM SG
HUM
19
a man
a
a man
CAT NP AGR _1
? _2 SEM
_3
CAT N AGR _2 SEM _3
CAT DET AGR _1
?
LEX man AGR NUM SG SEM HUM
NUM SG
HUM
20
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

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
  • catnp ? num??, gen??, case??
  • catv,numsg ? tnspres
  • attr1val1 ? ? attr2val2

22
Inheritance rules
  • Inheritance rules can be over-ridden
  • e.g. catn ? gen??,sem??
  • sexmale,female
  • genmasc,fem,neut
  • catn,genfem,semhum ? sexfemale
  • uxor catn,genfem,semhum
  • agricola catn,genfem,semhum,sexmale

23
Unification in Linguistics
  • Lexical Functional Grammar
  • If interested, see PARGRAM project
  • GPSG, HPSG
  • Construction Grammar
  • Categorial Grammar
Write a Comment
User Comments (0)
About PowerShow.com