def pairwithcompletes(self, e, completes): """ Run the fundamental rule for everything in `completes` that goes with `e`. Updates the `agenda` by adding to its end. Probabilities, if present, are propagated. Updates the `agenda`. :type completes: set<Edge> :param completes: the potential partners of e :type e: Edge :param e: The partial edge that should be completed. """ for c in completes: if self.compat(e.needed[0],c.label): newedge = Edge(label=e.label, left=e.left, right=c.right, needed=e.needed[1:], constraints=e.constraints) if self.using_features: newedge = newedge.percolate(c.label) hpush(self.agenda,self.add_prev(newedge, c))
def pairwithpartials(self, partials, e): """ Run the fundamental rule for everything in `partials` that goes with `e`. Updates the `agenda` by adding to its end. Parameters ---------- partials: set<Edge> the potential partners of `e` e: Edge The complete edge that should be augmented. """ for p in partials: if self.compat(e.label,p.needed[0]): newedge = Edge(label=p.label, left=p.left, right=e.right, needed=p.needed[1:], constraints=p.constraints) if self.using_features: newedge = newedge.percolate(e.label) hpush(self.agenda, self.add_prev(newedge, e))