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.

ep
Type:

str

nl
Type:

str

ulf
Type:

ULF or None

elf
Type:

ELF or None

prob
Type:

float

bindings

A mapping from variables to bound values.

Type:

dict

embedding

A vector embedding of this eventuality.

Type:

list[float]

Methods

bind

Bind the given variable symbol to the given value.

embed

Embed the eventuality based on the natural language representation, given an embedder object.

format

Format an eventuality as ((<ep> <wff>) <prob>), where <wff> is the highest level of representation for this eventuality.

get_elf

Get the ELF representation for this eventuality, applying any variable assignments.

get_ep

Get the episode symbol for this eventuality, applying any variable assignments.

get_nl

Get the natural language representation for this eventuality, applying any variable assignments.

get_ulf

Get the ULF representation for this eventuality, applying any variable assignments.

get_wff

Get the highest level of representation available for this eventuality (if no_bind is given as True, do not apply bindings).

replacevar

Replace the first variable symbol with the second variable symbol throughout the eventuality.

set_elf

Set the ULF formula.

set_ep

Set the episode symbol.

set_prob

Set the probability of this event.

set_ulf

Set the ULF formula.

unbind

Unbind the given variable symbol.

set_ep(ep)[source]

Set the episode symbol.

set_ulf(ulf)[source]

Set the ULF formula.

set_elf(elf)[source]

Set the ULF formula.

set_prob(prob)[source]

Set the probability of this event.

bind(var, val)[source]

Bind the given variable symbol to the given value.

unbind(var)[source]

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_ep()[source]

Get the episode symbol for this eventuality, applying any variable assignments.

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).

format()[source]

Format an eventuality as ((<ep> <wff>) <prob>), where <wff> is the highest level of representation for this eventuality.

__str__()[source]

Return str(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).