eta.plan.PlanStep

class PlanStep(event=None)[source]

Bases: object

A plan step containing an eventuality, related to other plan steps through a tree structure.

Parameters:

event (Eventuality) – The eventuality corresponding to this step.

id

A unique ID for this step.

Type:

str

event

The eventuality corresponding to this step.

Type:

Eventuality

substeps

A list of more concrete plan steps that together realize this step.

Type:

list[PlanStep]

supersteps

A list of more abstract plan steps which this step (partially) realizes.

Type:

list[PlanStep]

obligations

A list of dialogue obligations associated with this plan step.

Type:

list[Eventuality]

schemas

A list of schemas that this expected/intended step arises from (if any).

Type:

list[Schema]

Methods

add_superstep

Add bidirectional subplan/superplan links between this step and a given superstep.

bind

Bind the given variable symbol to the given value throughout the entire plan step tree (and associated schemas).

format

Format a string representing this plan step as an S-expression.

get_obligations

Get any dialogue obligations associated with a particular step in the plan.

serialize

Format a string representing a serialized version of the subtree rooted at this step.

unbind

Unbind the given variable symbol throughout the entire plan step tree (and associated schemas).

get_obligations()[source]

Get any dialogue obligations associated with a particular step in the plan.

Notes

TODO: this is currently a bit of a hack, in that it involves looking at the superstep as well if no obligations are found. This is because say-to.v actions may need to access the parent paraphrase-to.v actions in order to inherit relevant obligations of the latter. It may be possible to instead modify the plan expansion method so that obligations are inherited upon expansion.

add_superstep(superstep)[source]

Add bidirectional subplan/superplan links between this step and a given superstep.

The schemas of the superstep also become the schemas associated with this step, but only in the case where this step doesn’t already have associated schemas (e.g., if it was created from an episode list in expanding an action).

Parameters:

superstep (PlanStep) – The superstep to add to this step.

Notes

TODO: it’s not clear whether the above is the sensible behavior, or if instead we should always append the schemas of the superstep to this step.

bind(var, val)[source]

Bind the given variable symbol to the given value throughout the entire plan step tree (and associated schemas).

unbind(var)[source]

Unbind the given variable symbol throughout the entire plan step tree (and associated schemas).

serialize(reverse=False, schemas=False)[source]

Format a string representing a serialized version of the subtree rooted at this step.

This is generated using a DFS, maintaining a record of recurring plan steps so that numerical references can be inserted in place of nodes that appear more than once in the tree.

Parameters:
  • reverse (bool, default=False) – If given as True, print the subtree “above” this step rather than below.

  • schemas (bool, default=False) – Whether to also display schema predicates for each step.

Return type:

str

format(schemas=False)[source]

Format a string representing this plan step as an S-expression.

Parameters:

schemas (bool, default=False) – Whether to also display schema predicates for each step.

Returns:

The step formatted as one of the following S-expression string representations: - ((<ep-name> <wff>) <certainty>) - ((<ep-name> <wff>) <certainty>) (:schemas <schema-preds>)

Return type:

str

__str__()[source]

Return str(self).