This class holds the broken-down components of a hole semantics, i.e. it extracts the holes, labels, logic formula fragments and constraints out of a big conjunction of such as produced by the hole semantics grammar. It then provides some operations on the semantics dealing with holes, labels and finding legal ways to plug holes with labels.
Method | __init__ |
Constructor. usr' is a ``sem.Expression` representing an Underspecified Representation Structure (USR). A USR has the following special predicates: ALL(l,v,n), EXISTS(l,v,n), AND(l,n,n), OR(l,n,n), IMP(l,n,n), IFF(l,n,n), PRED(l,v,n,v[,v]*) where the brackets and star indicate zero or more repetitions, LEQ(n,n), HOLE(n), LABEL(n) where l is the label of the node described by the predicate, n is either a label or a hole, and v is a variable. |
Method | formula |
Return the first-order logic formula tree for this underspecified representation using the plugging given. |
Method | is |
Return true if x is a node (label or hole) in this semantic representation. |
Method | pluggings |
Calculate and return all the legal pluggings (mappings of labels to holes) of this semantics given the constraints. |
Instance Variable | constraints |
Undocumented |
Instance Variable | fragments |
Undocumented |
Instance Variable | holes |
Undocumented |
Instance Variable | labels |
Undocumented |
Instance Variable | top |
Undocumented |
Instance Variable | top |
Undocumented |
Method | _break |
Extract holes, labels, formula fragments and constraints from the hole semantics underspecified representation (USR). |
Method | _find |
Return the hole that will be the top of the formula tree. |
Method | _find |
Return the set of labels which are not referenced directly as part of another formula fragment. These will be the top-most labels for the subtree that they are part of. |
Method | _find |
Undocumented |
Method | _formula |
Undocumented |
Method | _plug |
Try all possible ways of plugging a single hole. See _plug_nodes for the meanings of the parameters. |
Method | _plug |
Plug the nodes in `queue' with the labels in `potential_labels'. |
Method | _sanity |
Make sure that a given plugging is legal. We recursively go through each node and make sure that no constraints are violated. We also check that all holes have been filled. |
Method | _violates |
Return True if the `label' cannot be placed underneath the holes given by the set `ancestors' because it would violate the constraints imposed on it. |
Constructor. usr' is a ``sem.Expression`
representing an
Underspecified Representation Structure (USR). A USR has the following
special predicates:
ALL(l,v,n),
EXISTS(l,v,n),
AND(l,n,n),
OR(l,n,n),
IMP(l,n,n),
IFF(l,n,n),
PRED(l,v,n,v[,v]*) where the brackets and star indicate zero or more repetitions,
LEQ(n,n),
HOLE(n),
LABEL(n)
where l is the label of the node described by the predicate, n is either
a label or a hole, and v is a variable.
Return the first-order logic formula tree for this underspecified representation using the plugging given.
Calculate and return all the legal pluggings (mappings of labels to holes) of this semantics given the constraints.
Extract holes, labels, formula fragments and constraints from the hole semantics underspecified representation (USR).
Return the set of labels which are not referenced directly as part of another formula fragment. These will be the top-most labels for the subtree that they are part of.
Try all possible ways of plugging a single hole. See _plug_nodes for the meanings of the parameters.
Plug the nodes in `queue' with the labels in `potential_labels'.
Each element of `queue' is a tuple of the node to plug and the list of ancestor holes from the root of the graph to that node.
`potential_labels' is a set of the labels which are still available for plugging.
`plug_acc' is the incomplete mapping of holes to labels made on the current branch of the search tree so far.
`record' is a list of all the complete pluggings that we have found in total so far. It is the only parameter that is destructively updated.