I was not able to understand the grammar rules explain in discourse.fcfg file.

Can any one help me understanding SEM means in S[SEM = <app(?subj,?vp)>] -> NP[NUM=?n,SEM=?subj] VP[NUM=?n,SEM=?vp] an other keywords in the file.

How to decode all the lines?

Appreciate your time. Thanks


S[SEM = <app(?subj,?vp)>] -> NP[NUM=?n,SEM=?subj] VP[NUM=?n,SEM=?vp]

Can anyone explain the meaning and the properties of each keyword. What does app, subj, ? NUM, means.

  • 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. Jul 31, 2019 at 13:35
  • @lemontree Thanks you for the details. I need to convert the text into the First Order Logic with the help of Feature Grammar Parser. Post developing the grammar for some text, I need to get the answers with the help of the fcfg grammar as well as First Order Logic. Jul 31, 2019 at 13:45

1 Answer 1


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.

  • I wasn't able to find app to which I asked rest I understood. I wasn't able to find the examples how to use discourse.fcfg . Can you help in that? Aug 6, 2019 at 7:49
  • Right, that isn't actually introduced like this in the book. See the update to my post. Aug 6, 2019 at 13:58
  • @AmanDalmia (not sure you've seen my comment) Aug 9, 2019 at 20:27
  • I have seen your comment. Aug 12, 2019 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.