docs: public void updateInsideEntryTerminal(int spanStart, int spanEnd,
        int terminalSpanStart, int terminalSpanEnd, Factor factor) {
      Preconditions.checkArgument(factor.getVars().size() == 2);
      // The first entry initializes the chart at this span.
      if (sumProduct) {
        updateEntrySumProduct(insideChart[spanStart][spanEnd], factor.coerceToDiscrete().getWeights().getValues(),
            factor.coerceToDiscrete().getWeights(), parentVar.getOnlyVariableNum());
      } else {
        Tensor weights = factor.coerceToDiscrete().getWeights();
  
        // Negative split indexes are used to represent terminal rules.
        int splitInd = -1 * (terminalSpanStart * numTerminals + terminalSpanEnd + 1); 
        updateInsideEntryMaxProduct(spanStart, spanEnd, weights.getValues(), weights, splitInd);
      }
    }