leftItems = chart.get(start, split); while (leftItems.hasNext()) { CKYItem leftItem = (CKYItem)leftItems.next(); if (leftItem.stop()) { rightItems = chart.get(split + 1, end); while (rightItems.hasNext()) { CKYItem rightItem = (CKYItem)rightItems.next(); if (!rightItem.stop()) joinItems(rightItem, leftItem, Constants.LEFT);
int modifierStartIdx = modifyLeft ?    start :     split + 1; int modifierEndIdx =   modifyLeft ?    split :     end;  if (debugComplete && debugSpans) System.err.println(className + ": modifying [" + modificandStartIdx + "," + modificandEndIdx + "]" + " with [" + modifierStartIdx + "," + modifierEndIdx + "]");    if (chart.numItems(modifierStartIdx, modifierEndIdx) > 0 && chart.numItems(modificandStartIdx, modificandEndIdx) > 0) { Iterator modifierItems = chart.get(modifierStartIdx, modifierEndIdx); while (modifierItems.hasNext()) { CKYItem modifierItem = (CKYItem)modifierItems.next(); if (modifierItem.stop()) { Iterator modificandItems = chart.get(modificandStartIdx, modificandEndIdx); while (modificandItems.hasNext()) { CKYItem modificandItem = (CKYItem)modificandItems.next(); if (debugComplete) System.err.println(className + ".complete: trying to modify\n\t" + modificandItem + "\n\twith\n\t" + modifierItem); if (!modificandItem.stop()) joinItems(modificandItem, modifierItem, modifierSide); } }
  protected void complete(int start, int end) throws RemoteException {    for (int split = start; split < end; split++) {      if (commaConstraintViolation(start, split, end)) {	if (debugCommaConstraint) {	  System.err.println(className +                             ": constraint violation at (start,split,end+1)=(" +			     start + "," + split + "," + (end + 1) +			     "); word at end+1 = " + getSentenceWord(end + 1));	}	continue;      }      Iterator leftItems, rightItems;      // for each possible right modifier (something in the span [split+1,end]      // that HAS received its stop probabilities), try to find a left      // modificand (something in the span [start,split] that has NOT received      // its stop probabilities)      rightItems = chart.get(split + 1, end);      while (rightItems.hasNext()) {        CKYItem rightItem = (CKYItem)rightItems.next();        if (rightItem.stop()) {          leftItems = chart.get(start, split);          while (leftItems.hasNext()) {            CKYItem leftItem = (CKYItem)leftItems.next();            if (!leftItem.stop())              joinItems(leftItem, rightItem, Constants.RIGHT);          }        }      }      // for each possible left modifier (something in the span [start,split]      // that HAS received its stop probabilities), try to find a right      // modificand (something in the span [split+1,end] that has NOT received      // its stop probabilities)      leftItems = chart.get(start, split);      while (leftItems.hasNext()) {        CKYItem leftItem = (CKYItem)leftItems.next();        if (leftItem.stop()) {          rightItems = chart.get(split + 1, end);          while (rightItems.hasNext()) {            CKYItem rightItem = (CKYItem)rightItems.next();            if (!rightItem.stop())              joinItems(rightItem, leftItem, Constants.LEFT);          }        }      }    }    addUnariesAndStopProbs(start, end);    chart.prune(start, end);  }