eta.transducers.tt

Contains implementations of Tree Transduction (TT) based transducers.

Each transducer type defined here subclasses TTTransducer, which contains the core implementation of the TT mapping process.

Each TT transducer is instantiated with a forest of choice trees read from a directory of LISP choice tree packets, as well as one or multiple root names that are used to begin the choice process for that particular transducer. If multiple roots are provided, the results from each are combined.

The choice tree results are processed slightly differently depending on the directive of the result, i.e., string-like directives (:out, :gist, etc.) are joined to create strings, whereas S-expression-like directives (:ulf, :schema, :raw, etc.) are returned as-is. Results using the :and keyword are also flattened to create a single list of outputs.

Full documentation on TT can be found in the eta.util.tt package.

Classes

TTAffectTransducer

TTAnswerTransducer

TTAskTransducer

TTGistTransducer

TTParaphraseTransducer

TTPragmaticTransducer

TTReactionTransducer

TTReasonBottomUpTransducer

TTReasonTopDownTransducer

TTResponseTransducer

TTSemanticTransducer

TTSubplanTransducer

TTTransducer

The abstract TT transducer class containing the core implementation of the TT mapping process.

class TTTransducer(rule_dirs, roots)[source]

Bases: Transducer

The abstract TT transducer class containing the core implementation of the TT mapping process.

Each TT transducer is initialized with a set of trees and word features read from a directory of LISP choice tree packets, as well as a list of root names to use specific to that particular transducer.

The transducer performs a mapping by passing its arguments (or some data derived from the arguments) to its root choice tree(s), processing the results based on the directive, and combining them into a single flat list.

Parameters:
  • rule_dirs (str or list[str]) – The directory name(s) containing LISP choice tree packets to read from.

  • roots (str or list[str]) – The root name(s) to use for choosing results for this transducer instance.

trees

A dict mapping choice tree root names to the choice tree roots.

Type:

dict

feats

A dict mapping words to feature lists.

Type:

dict

roots

A list of root names to use for choosing results.

Type:

list[str]

cost()[source]

TT is performed locally so does not incur any cost.

class TTReasonTopDownTransducer(rule_dirs)[source]

Bases: TTTransducer, ReasonTopDownTransducer

class TTReasonBottomUpTransducer(rule_dirs)[source]

Bases: TTTransducer, ReasonBottomUpTransducer

class TTGistTransducer(rule_dirs)[source]

Bases: TTTransducer, GistTransducer

class TTSemanticTransducer(rule_dirs)[source]

Bases: TTTransducer, SemanticTransducer

class TTPragmaticTransducer(rule_dirs)[source]

Bases: TTTransducer, PragmaticTransducer

class TTReactionTransducer(rule_dirs)[source]

Bases: TTTransducer, ReactionTransducer

class TTSubplanTransducer(rule_dirs)[source]

Bases: TTTransducer, SubplanTransducer

class TTParaphraseTransducer(rule_dirs)[source]

Bases: TTTransducer, ParaphraseTransducer

class TTResponseTransducer(rule_dirs)[source]

Bases: TTTransducer, ResponseTransducer

class TTAnswerTransducer(rule_dirs)[source]

Bases: TTTransducer, AnswerTransducer

class TTAskTransducer(rule_dirs)[source]

Bases: TTTransducer, AskTransducer

class TTAffectTransducer(rule_dirs)[source]

Bases: TTTransducer, AffectTransducer