module documentation
Utility functions for batch-processing sentences: parsing and extraction of the semantic representation of the root node of the the syntax tree, followed by evaluation of the semantic representation in a first-order model.
Function | demo |
Undocumented |
Function | demo |
Check that interpret_sents() is compatible with legacy grammars that use a lowercase 'sem' feature. |
Function | demo |
Undocumented |
Function | evaluate |
Add the truth-in-a-model value to each semantic representation for each syntactic parse of each input sentences. |
Function | interpret |
Add the semantic representation to each syntactic parse tree of each input sentence. |
Function | parse |
Convert input sentences into syntactic trees. |
Function | read |
Undocumented |
Function | root |
Find the semantic representation at the root of a tree. |
Check that interpret_sents() is compatible with legacy grammars that use a lowercase 'sem' feature.
Define 'test.fcfg' to be the following
Add the truth-in-a-model value to each semantic representation for each syntactic parse of each input sentences.
Parameters | |
inputs:list(str) | a list of sentences |
grammar:nltk.grammar.FeatureGrammar | FeatureGrammar or name of feature-based grammar |
model | Undocumented |
assignment | Undocumented |
trace | Undocumented |
Returns | |
list(list(tuple(nltk.tree.Tree, nltk.sem.logic.ConstantExpression, bool or dict(str): bool))) | a mapping from sentences to lists of triples (parse-tree, semantic-representations, evaluation-in-model) |
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 |
semkey | Undocumented |
trace | Undocumented |
Returns | |
list(list(tuple(nltk.tree.Tree, nltk.sem.logic.ConstantExpression))) | a mapping from sentences to lists of pairs (parse-tree, semantic-representations) |
Convert input sentences into syntactic trees.
Parameters | |
inputs:list(str) | sentences to be parsed |
grammar:nltk.grammar.FeatureGrammar | FeatureGrammar or name of feature-based grammar |
trace | Undocumented |
Returns | |
list(nltk.tree.Tree) or dict(list(str)): list(Tree) | a mapping from input sentences to a list of ``Tree``s |