The NLTK book, chapter 10, which provides some theoretical background to the implementation, references NLTK ch. 9, where the feature grammar is introduced. Have you read these articles?
Ch. 9 explains all the the features you were asking about including the ?
notation.
Ch. 10 introduces the lambda calculus. The special function app
in the implementation is used to express function application and is not introduced like this in the book, but plays the same role as ApplicationExpression
: Where M
is a functor and N
an argument, appl(M,N)
stands for the application of M
to N
, M(N)
. So app(?subj,?vp)
is just a different way of notaiton for ?subj(?vp)
, if I understand correctly. It seems that they're using M(N)
notation inside pure lambda expressions, such as P(John)
in \P.P(John)
, and the app(M,N)
construction when dealing with meta-variables which stand for expressions later to be filled with lambda terms, such as ?subj
and ?vp
, which are not lambda terms yet but placeholders for two expressions that will be applied to each other once concrete lambda terms have been inserted for them.
SEM
most likely stands for "semantics". As for the rest, "and other keywords in the file"/"all the lines"/"the structure of the grammar" is too broad and vague. You have to narrow down what exactly you don't understand to more specific questions. Also, wherever you came across this code, there must be some kind of theoretical background that explains and motivates the accompanying implementation. Given that the code builds up on NLTK, have you read the corresponding section in the NLTK book and the references it points to? If not, that's where to start. – lemontree♦ Jul 31 '19 at 13:35