nltk/nltk — Issue #197: Things you cannot do with FeatureGrammar
Author: heatherleaf
Created: 2012-02-01 09:45:01+00:00
State: open

In PATR I can write the following rule:

NP -> Det Nom
=
=
= 3

But it is impossible to create an equivalent rule in a FeatureGrammar. None of the following works:

NP[AGR=?x,AGR=[PERS=3]] -> Det[AGR=?x] Nom[AGR=?x]
NP[AGR=(1)[PERS=3]] -> Det[AGR->(1)] Nom[AGR->(1)]

The first is illegal since I am not allowed to use the same feature twice in the NP.
The second is illegal since references `->(1)` must not cross feature structure borders.

On a related note, the following feature structures are all considered unequal by NLTK:

FeatStruct("[a=?x,b=?x]") != FeatStruct("[a=?y,b=?y]") != FeatStruct("[a=(1)[],b->(1)]")

On the other hand, the following two are equal:

FeatStruct("[a=(1)[],b->(1)]") == FeatStruct("[b=(2)[],a->(2)]")

Personally I see why, but for a person learning feature structures it is very difficult to understand.