*/
  public void prune(int start, int end) {    if (!pruning)      return;    MapToPrimitive items = chart[start][end].map;    if (pruneFact > 0.0) {      // remove the lowest probability elements until the lowest one      // left is within pruneFact of highest      double topProb = chart[start][end].topLogProb;      double lowestProbAllowed = topProb - pruneFact;      Iterator it = items.keySet().iterator();      while (it.hasNext()) {	Item currItem = (Item)it.next();	//if (currItem.logProb() < lowestProbAllowed) {	if (outsideBeam(currItem, topProb)) {	  if (debugPrune) {	    System.err.println(className + ": pruning away item: " + currItem +			       " because its prob is less than " +			       lowestProbAllowed);	  }	  if (debugNumPrunedItems) {	    numPruned++;	  }	  totalItems--;	  it.remove();	  reclaimItem(currItem);	}	else	  break;      }    }    if (cellLimit > 0) {      cellLimit = Math.max(10, Math.min(90, 350 / (end + 1 - start)));      if (end > start) { // don't do cell limiting on spans of length 1	int numItems = items.size();	if (numItems > cellLimit) { // don't create iterator if no need	  // reset sortedArr and numSorted	  if (numItems > sortedArr.length) {	    int newLen = Math.max(sortedArr.length * 2, numItems);	    sortedArr = new Item[newLen];	  }	  else {	    for (int i = 0; i < numSorted; i++)	      sortedArr[i] = null;	  }	  numSorted = 0;	  Iterator itemsIt = items.keySet().iterator();	  while (itemsIt.hasNext()) {	    Item item = (Item)itemsIt.next();	    sortedArr[numSorted++] = item;	  }	  items.clear();	  Arrays.sort(sortedArr, 0, numSorted);	  int sortedIdx = numSorted - 1;	  for (int counter = 0; counter < cellLimit; counter++, sortedIdx--)	    items.put(sortedArr[sortedIdx], sortedArr[sortedIdx].logProb());	  for ( ; sortedIdx >= 0; sortedIdx--)	    reclaimItem(sortedArr[sortedIdx]);	  /*	  // add all items that are eligible for limiting to sortedArr	  Iterator itemsIt = items.keySet().iterator();	  while (itemsIt.hasNext()) {	    Item item = (Item)itemsIt.next();	    if (cellLimitShouldApplyTo(item))	      sortedArr[numSorted++] = item;	  }	  if (numSorted > cellLimit) {	    Arrays.sort(sortedArr, 0, numSorted);	    // prune away and reclaim items below cellLimit	    int sortedIdx = numSorted - cellLimit - 1;	    for ( ; sortedIdx >= 0; sortedIdx--) {	      Item item = sortedArr[sortedIdx];	      items.remove(item);	      reclaimItem(item);	    }	  }	  */	}      }    }  }