class_docstr: 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.
class_docstr_tok: ["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","."]
docstr: Try all possible ways of plugging a single hole.
  See _plug_nodes for the meanings of the parameters.
docstr_tok: ["Try","all","possible","ways","of","plugging","a","single","hole",".","See","_plug_nodes","for","the","meanings","of","the","parameters","."]
code: def _plug_hole(
      self,
      hole,
      ancestors0,
      queue,
      potential_labels0,
      plug_acc0,
      record,
  ):
      """
      Try all possible ways of plugging a single hole.
      See _plug_nodes for the meanings of the parameters.
      """
      # Add the current hole we're trying to plug into the list of ancestors.
      assert hole not in ancestors0
      ancestors = [hole] + ancestors0
  
      # Try each potential label in this hole in turn.
      for l in potential_labels0:
          # Is the label valid in this hole?
          if self._violates_constraints(l, ancestors):
              continue
  
          plug_acc = plug_acc0.copy()
          plug_acc[hole] = l
          potential_labels = potential_labels0.copy()
          potential_labels.remove(l)
  
          if len(potential_labels) == 0:
              # No more potential labels.  That must mean all the holes have
              # been filled so we have found a legal plugging so remember it.
              #
              # Note that the queue might not be empty because there might
              # be labels on there that point to formula fragments with
              # no holes in them.  _sanity_check_plugging will make sure
              # all holes are filled.
              self._sanity_check_plugging(plug_acc, self.top_hole, [])
              record.append(plug_acc)
          else:
              # Recursively try to fill in the rest of the holes in the
              # queue.  The label we just plugged into the hole could have
              # holes of its own so at the end of the queue.  Putting it on
              # the end of the queue gives us a breadth-first search, so that
              # all the holes at level i of the formula tree are filled
              # before filling level i+1.
              # A depth-first search would work as well since the trees must
              # be finite but the bookkeeping would be harder.
              self._plug_nodes(
                  queue + [(l, ancestors)],
                  potential_labels,
                  plug_acc,
                  record,
              )
  
imports: from functools import reduce
  from nltk.parse import load_parser
  from nltk.sem.logic import AllExpression, AndExpression, ApplicationExpression, ExistsExpression, IffExpression, ImpExpression, LambdaExpression, NegatedExpression, OrExpression
  from nltk.sem.skolemize import skolemize
label_desc: Use image node_id 9 for calling the HoleSemantics obj's underlying member method code with example usage: obj._plug_hole(hole, ancestors0, queue, potential_labels0, plug_acc0, record) without return types