nltk.interpret_sents()

nltk.interpret_sents(inputs, grammar, semkey=u'SEM', trace=0)[source]

Add the semantic representation to each syntactic parse tree of each input sentence.

Parameters:
  • inputs (list(str)) – a list of sentences
  • grammar (nltk.grammar.FeatureGrammar) – FeatureGrammar or name of feature-based grammar
Returns:

a mapping from sentences to lists of pairs (parse-tree, semantic-representations)

Return type:

list(list(tuple(nltk.tree.Tree, nltk.sem.logic.ConstantExpression)))