eta.transducers.base
Contains abstract base transducer classes for each supported transducer.
A transducer is an object that maps some set of arguments to some value; multiple abstract transducers are supported for various types of mappings with different function signatures.
The abstract transducers defined in this module do not actually implement any behavior; it is expected that they will be extended with transducers that use various techniques to perform a mapping (e.g., rule-based tree transduction, statistical models, large language models, etc.).
Note that each transducer type should return a list; this allows multiple transducer implementations to be “stacked” in practice, e.g., using both a tree transduction and an LLM transducer and collating the results.
Classes
Maps the word content of an utterance to an appropriate affect, given a conversation history. |
|
Maps a conversation history and relevant knowledge to an answer utterance. |
|
Maps a conversation history and relevant knowledge to a question utterance. |
|
Maps an utterance to a list of gist clauses, given a conversation history. |
|
Maps a gist clause, given a conversation history and relevant knowledge, to a paraphrased response. |
|
Maps a gist clause to a list of ULF formulas capturing its pragmatic meaning. |
|
Maps an observed event to a formula for an action that an agent can take. |
|
Maps from a list of facts to a list of new facts inferred from those. |
|
Maps from a plan step event and a list of facts to a list of new facts inferred from those. |
|
Maps a conversation history and relevant knowledge to a response utterance. |
|
Maps a gist clause to a list of ULF formulas capturing its semantic meaning. |
|
Maps a plan step event to a list of subplans, i.e., sequences of events that are substeps of the given step. |
|
The base transducer class. |
- class ReasonTopDownTransducer[source]
Bases:
Transducer
Maps from a plan step event and a list of facts to a list of new facts inferred from those.
- Parameters:
step (Eventuality) – The event corresponding to the plan step to use as context for inference.
facts (list[Eventuality]) – The list of facts to make inferences from.
- Returns:
A list of new facts inferred from the plan step and given facts.
- Return type:
- class ReasonBottomUpTransducer[source]
Bases:
Transducer
Maps from a list of facts to a list of new facts inferred from those.
- Parameters:
facts (list[Eventuality]) – The list of facts to make inferences from.
- Returns:
A list of new facts inferred from the given facts.
- Return type:
- class GistTransducer[source]
Bases:
Transducer
Maps an utterance to a list of gist clauses, given a conversation history.
- Parameters:
utt (Utterance) – The utterance to interpret as a gist clause.
conversation_log (list[DialogueTurn]) – The conversation history to use as context for interpretation.
- Returns:
A list of gist clauses.
- Return type:
- class SemanticTransducer[source]
Bases:
Transducer
Maps a gist clause to a list of ULF formulas capturing its semantic meaning.
- class PragmaticTransducer[source]
Bases:
Transducer
Maps a gist clause to a list of ULF formulas capturing its pragmatic meaning.
- class ReactionTransducer[source]
Bases:
Transducer
Maps an observed event to a formula for an action that an agent can take.
- Parameters:
observation (Eventuality) – The observed event for the agent to react to.
- Returns:
A list of action formulas that the agent can take in reaction to the observation.
- Return type:
list[s-expr]
Notes
TODO: this should likely be expanded to support a list of observed events rather than a single event, since in general a reaction may be contingent on multiple combined observations.
- class SubplanTransducer[source]
Bases:
Transducer
Maps a plan step event to a list of subplans, i.e., sequences of events that are substeps of the given step.
- Parameters:
step (Eventuality) – The event corresponding to a plan step to expand.
- Returns:
A list of subplans, where each subplan is a sequence of substep events.
- Return type:
- class ParaphraseTransducer[source]
Bases:
Transducer
Maps a gist clause, given a conversation history and relevant knowledge, to a paraphrased response.
- Parameters:
gist (str) – The gist clause to paraphrase.
conversation_log (list[DialogueTurn]) – The conversation history to use as context for paraphrasing.
facts_bg (list[Eventuality]) – A list of “background” knowledge to use for paraphrasing, i.e., knowledge that may impact the resulting paraphrase, but may not be directly included in the paraphrased response.
facts_fg (list[Eventuality]) – A list of “foreground” knowledge to use for paraphrasing, i.e., knowledge that should be directly included in the paraphrased response.
- Returns:
A list of paraphrased responses.
- Return type:
- class ResponseTransducer[source]
Bases:
Transducer
Maps a conversation history and relevant knowledge to a response utterance.
- Parameters:
conversation_log (list[DialogueTurn]) – The conversation history to use as context for the response.
facts_bg (list[Eventuality]) – A list of “background” knowledge to use for the response, i.e., knowledge that may impact the resulting response, but may not be directly included in the response.
facts_fg (list[Eventuality]) – A list of “foreground” knowledge to use for the response, i.e., knowledge that should be directly included in the response.
- Returns:
A list of responses.
- Return type:
- class AnswerTransducer[source]
Bases:
Transducer
Maps a conversation history and relevant knowledge to an answer utterance.
- Parameters:
conversation_log (list[DialogueTurn]) – The conversation history to use as context for the answer.
facts_bg (list[Eventuality]) – A list of “background” knowledge to use for the answer, i.e., knowledge that may impact the resulting answer, but may not be directly included in the answer.
facts_fg (list[Eventuality]) – A list of “foreground” knowledge to use for the answer, i.e., knowledge that should be directly included in the answer.
- Returns:
A list of answers.
- Return type:
- class AskTransducer[source]
Bases:
Transducer
Maps a conversation history and relevant knowledge to a question utterance.
- Parameters:
conversation_log (list[DialogueTurn]) – The conversation history to use as context for the question.
facts_bg (list[Eventuality]) – A list of “background” knowledge to use for the question, i.e., knowledge that may impact the resulting question, but may not be directly included in the question.
facts_fg (list[Eventuality]) – A list of “foreground” knowledge to use for the question, i.e., knowledge that should be directly included in the question.
- Returns:
A list of questions.
- Return type:
- class AffectTransducer[source]
Bases:
Transducer
Maps the word content of an utterance to an appropriate affect, given a conversation history.
- Parameters:
words (str) – The words to match to an appropriate affect.
conversation_log (list[DialogueTurn]) – The conversation history to use as context for affect detection.
- Returns:
A list of affects.
- Return type: