docs: public CcgParse decodeParseFromSpan(int spanStart, int spanEnd, int beamIndex, CcgParser parser) {
      DiscreteVariable syntaxVarType = parser.getSyntaxVarType();
      ChartEntry entry = getChartEntriesForSpan(spanStart, spanEnd)[beamIndex];
      HeadedSyntacticCategory syntax = (HeadedSyntacticCategory) syntaxVarType.getValue(
          entry.getHeadedSyntax());
  
      if (entry.isTerminal()) {
        List<String> terminals = getWords();
        List<String> posTags = getPosTags();
        // rightSpanStart and rightSpanEnd are used to track the trigger span
        // in chart entries for terminals.
        LexiconEntryInfo lexiconEntryInfo = new LexiconEntryInfo(entry.getLexiconEntry(),
            entry.getLexiconTrigger(), entry.getLexiconIndex(), spanStart, spanEnd,
            entry.getRightSpanStart(), entry.getRightSpanEnd()); 
        
        return CcgParse.forTerminal(syntax, lexiconEntryInfo, posTags.subList(spanStart, spanEnd + 1),
            parser.variableToIndexedPredicateArray(syntax.getHeadVariable(), entry.getAssignments()),
            Arrays.asList(parser.longArrayToFilledDependencyArray(entry.getDependencies())),
            terminals.subList(spanStart, spanEnd + 1), getChartEntryProbsForSpan(spanStart, spanEnd)[beamIndex],
            entry.getRootUnaryRule(), spanStart, spanEnd);
      } else {
        CcgParse left = decodeParseFromSpan(entry.getLeftSpanStart(), entry.getLeftSpanEnd(),
            entry.getLeftChartIndex(), parser);
        CcgParse right = decodeParseFromSpan(entry.getRightSpanStart(), entry.getRightSpanEnd(),
            entry.getRightChartIndex(), parser);
  
        if (entry.getLeftUnaryRule() != null) {
          left = left.addUnaryRule(entry.getLeftUnaryRule(), (HeadedSyntacticCategory)
              syntaxVarType.getValue(entry.getLeftUnaryRule().getSyntax()));
        }
        if (entry.getRightUnaryRule() != null) {
          right = right.addUnaryRule(entry.getRightUnaryRule(), (HeadedSyntacticCategory)
              syntaxVarType.getValue(entry.getRightUnaryRule().getSyntax()));
        }
  
        double nodeProb = getChartEntryProbsForSpan(spanStart, spanEnd)[beamIndex] /
            (left.getSubtreeProbability() * right.getSubtreeProbability());
  
        return CcgParse.forNonterminal(syntax,
            parser.variableToIndexedPredicateArray(syntax.getHeadVariable(), entry.getAssignments()),
            Arrays.asList(parser.longArrayToFilledDependencyArray(entry.getDependencies())), nodeProb,
            left, right, entry.getCombinator(), entry.getRootUnaryRule(), spanStart, spanEnd);
      }
    }