pythonnltklambda-calculuscombinatory-logic

Lambda-Calculus Representation in NLTK CCG


I am trying to implement a probabilistic ccg with lambda-calculus features.

Basically i want to do the following code:

>> lex = parseLexicon(r'''
 :- S,NP
 He => NP {sem=\x.he(x)} [1.0]
 Walks => S\NP {sem=\X. walk(X)} [1.0]
 There => S\S {sem=\x . there(x)} [1.0]
 ''')
>> parser = CCGChartParser(lex)
>> all_parses = parser.nbest_parse(“He walks 
there”.split(),n=100)
>> for parse in all_parses: 
 printCCGDerivation(parse)

but existing CCG implementation of NLTK does not support {sem=\x.he(x)} [1.0] kinds of semantic parts in lexicon.

Are there Any other CCG implementations that can handle this? Or can i represent this inside of NLTK?


Solution

  • NLTK CCG recently supports semantics predicate (Lambda-Calculus representation) computation. Please see the tests here: https://github.com/nltk/nltk/blob/develop/nltk/test/ccg_semantics.doctest

    The probabilistic parsing for CCG is on the horizon: https://github.com/nltk/nltk/issues/1356