简体   繁体   中英

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.

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: \\XX(\\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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM