eta.lf.Eventuality
- class Eventuality(ep, nl, ulf, elf, prob=1.0)[source]
Bases:
object
Defines an “eventuality”, which represents an event or fact at several levels (natural language, ULF, and ELF).
An Eventuality subsumes logical forms as well as their natural language expression, encapsulating them in one object. Minimally, an Eventuality has an episode variable/constant and a natural language string expressing the formula characterizing that event. On top of that, a ULF representation of that formula may be provided. At the highest level, a fully deindexed ELF representation may be provided.
We assume that the level of representation builds upward, i.e., a natural language string may be easily derived from the ULF, and likewise, a ULF may be easily derived from the full ELF. On the other hand, mapping from natural language to ULF requires semantic parsing, and mapping from ULF to ELF requires disambiguation, scoping, and deindexing. Hence, we want to regard those upper levels of representation as “optional”, since they may not be needed in simpler dialogue applications.
- Parameters:
ep (str) – A symbol denoting the episode variable or constant.
nl (str) – The natural language representation of the formula characterizing the event.
ulf (ULF, optional) – The ULF formula characterizing the event.
elf (ELF, optional) – The ELF formula characterizing the event.
prob (float, default=1.) – The probability associated with this event.
Methods
Bind the given variable symbol to the given value.
Embed the eventuality based on the natural language representation, given an embedder object.
Format an eventuality as ((<ep> <wff>) <prob>), where <wff> is the highest level of representation for this eventuality.
Get the ELF representation for this eventuality, applying any variable assignments.
Get the episode symbol for this eventuality, applying any variable assignments.
Get the natural language representation for this eventuality, applying any variable assignments.
Get the ULF representation for this eventuality, applying any variable assignments.
Get the highest level of representation available for this eventuality (if no_bind is given as True, do not apply bindings).
Replace the first variable symbol with the second variable symbol throughout the eventuality.
Set the ULF formula.
Set the episode symbol.
Set the probability of this event.
Set the ULF formula.
Unbind the given variable symbol.
- replacevar(var1, var2)[source]
Replace the first variable symbol with the second variable symbol throughout the eventuality.
- embed(embedder)[source]
Embed the eventuality based on the natural language representation, given an embedder object.
- get_nl()[source]
Get the natural language representation for this eventuality, applying any variable assignments.
- get_ulf()[source]
Get the ULF representation for this eventuality, applying any variable assignments.
- get_elf()[source]
Get the ELF representation for this eventuality, applying any variable assignments.
- get_wff(no_bind=False)[source]
Get the highest level of representation available for this eventuality (if no_bind is given as True, do not apply bindings).