nltk.sem.glue module

class nltk.sem.glue.DrtGlue[source]

Bases: Glue

__init__(semtype_file=None, remove_duplicates=False, depparser=None, verbose=False)[source]
get_glue_dict()[source]
class nltk.sem.glue.DrtGlueDict[source]

Bases: GlueDict

get_GlueFormula_factory()[source]
class nltk.sem.glue.DrtGlueFormula[source]

Bases: GlueFormula

__init__(meaning, glue, indices=None)[source]
make_LambdaExpression(variable, term)[source]
make_VariableExpression(name)[source]
class nltk.sem.glue.Glue[source]

Bases: object

__init__(semtype_file=None, remove_duplicates=False, depparser=None, verbose=False)[source]
dep_parse(sentence)[source]

Return a dependency graph for the sentence.

Parameters

sentence (list(str)) – the sentence to be parsed

Return type

DependencyGraph

depgraph_to_glue(depgraph)[source]
get_glue_dict()[source]
get_pos_tagger()[source]
get_readings(agenda)[source]
gfl_to_compiled(gfl)[source]
parse_to_compiled(sentence)[source]
parse_to_meaning(sentence)[source]
train_depparser(depgraphs=None)[source]
class nltk.sem.glue.GlueDict[source]

Bases: dict

__init__(filename, encoding=None)[source]
add_missing_dependencies(node, depgraph)[source]
find_label_name(name, node, depgraph, unique_index)[source]
get_GlueFormula_factory()[source]
get_glueformulas_from_semtype_entry(lookup, word, node, depgraph, counter)[source]
get_label(node)[source]

Pick an alphabetic character as identifier for an entity in the model.

Parameters

value (int) – where to index into the list of characters

get_meaning_formula(generic, word)[source]
Parameters
  • generic – A meaning formula string containing the parameter “<word>”

  • word – The actual word to be replace “<word>”

get_semtypes(node)[source]

Based on the node, return a list of plausible semtypes in order of plausibility.

initialize_labels(expr, node, depgraph, unique_index)[source]
lookup(node, depgraph, counter)[source]
lookup_unique(rel, node, depgraph)[source]

Lookup ‘key’. There should be exactly one item in the associated relation.

read_file(empty_first=True)[source]
to_glueformula_list(depgraph, node=None, counter=None, verbose=False)[source]
class nltk.sem.glue.GlueFormula[source]

Bases: object

__init__(meaning, glue, indices=None)[source]
applyto(arg)[source]

self = (x.(walk x), (subj -o f)) arg = (john , subj) returns ((walk john), f)

compile(counter=None)[source]

From Iddo Lev’s PhD Dissertation p108-109

lambda_abstract(other)[source]
make_LambdaExpression(variable, term)[source]
make_VariableExpression(name)[source]
simplify()[source]
nltk.sem.glue.demo(show_example=- 1)[source]