David Yi
David Yi

Reputation: 401

FCFG error in NLTK, Python. Grammar Issue

A line in a feature-based context free grammar I am writing in Python using NLTK gives me the following error.

Error parsing feature structure
ADJ[SEM=<\x.x(\y.(some(y))>] -> 'some'
         ^ Expected logic expression

I thought the expression after SEM= was a logic expression.

Upvotes: 1

Views: 832

Answers (1)

mac389
mac389

Reputation: 3133

The error comes from how NLTK implements types lambda calculus.

 \x.x(\y.some(y)) 

It expects lowercase letters to have type <e> and uppercase letters to have type <e,t>. That is to say that lowercase letters cannot represent predicates.

The following parses: \X.X(\y.some(y))

As an aside, one represents the concept of "some" in "some X are Y" with a conjunction as follows:

 \X Y.(X(x) & Y(x))

In words, some X are Y is logically equivalent to there are some items have both X and Y quality.

Upvotes: 1

Related Questions