50 lines
1.3 KiB
Plaintext
50 lines
1.3 KiB
Plaintext
## Natural Language Toolkit: feat0.fcfg
|
|
##
|
|
## First example of a feature-based grammar for English, illustrating
|
|
## value-sharing of NUM and TENSE features.
|
|
## Used in Feature-Based Grammars chapter.
|
|
##
|
|
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
|
|
## URL: <http://nltk.sourceforge.net>
|
|
## For license information, see LICENSE.TXT
|
|
|
|
% start S
|
|
# ###################
|
|
# Grammar Productions
|
|
# ###################
|
|
|
|
# S expansion productions
|
|
S -> NP[NUM=?n] VP[NUM=?n]
|
|
|
|
# NP expansion productions
|
|
NP[NUM=?n] -> N[NUM=?n]
|
|
NP[NUM=?n] -> PropN[NUM=?n]
|
|
NP[NUM=?n] -> Det[NUM=?n] N[NUM=?n]
|
|
NP[NUM=pl] -> N[NUM=pl]
|
|
|
|
# VP expansion productions
|
|
VP[TENSE=?t, NUM=?n] -> IV[TENSE=?t, NUM=?n]
|
|
VP[TENSE=?t, NUM=?n] -> TV[TENSE=?t, NUM=?n] NP
|
|
|
|
# ###################
|
|
# Lexical Productions
|
|
# ###################
|
|
|
|
Det[NUM=sg] -> 'this' | 'every'
|
|
Det[NUM=pl] -> 'these' | 'all'
|
|
Det -> 'the' | 'some' | 'several'
|
|
|
|
PropN[NUM=sg]-> 'Kim' | 'Jody'
|
|
|
|
N[NUM=sg] -> 'dog' | 'girl' | 'car' | 'child'
|
|
N[NUM=pl] -> 'dogs' | 'girls' | 'cars' | 'children'
|
|
|
|
IV[TENSE=pres, NUM=sg] -> 'disappears' | 'walks'
|
|
TV[TENSE=pres, NUM=sg] -> 'sees' | 'likes'
|
|
|
|
IV[TENSE=pres, NUM=pl] -> 'disappear' | 'walk'
|
|
TV[TENSE=pres, NUM=pl] -> 'see' | 'like'
|
|
|
|
IV[TENSE=past] -> 'disappeared' | 'walked'
|
|
TV[TENSE=past] -> 'saw' | 'liked'
|