Examples of DerivationHistory


Examples of opennlp.ccg.parse.DerivationHistory

                merged.insert(edgeToAdd);
            }
            return;
        }
        // otherwise unpack via input signs
        DerivationHistory history = alt.sign.getDerivationHistory();
        Sign[] inputSigns = history.getInputs();
        // base case: no inputs
        if (inputSigns == null) {
            merged.insert(alt); return;
        }
        // otherwise recursively unpack
        Edge[] inputEdges = new Edge[inputSigns.length];
        for (int i = 0; i < inputSigns.length; i++) {
            inputEdges[i] = signMap.get(inputSigns[i]); // get input edge using signMap
            unpack(inputEdges[i], unpacked);
        }
        // then make edges for new combos, and add to merged (if unseen)
        Category resultCat = alt.sign.getCategory();
        boolean lefthead = (alt.sign.getLexHead() == inputSigns[0].getLexHead());
        List<Sign[]> altCombos = inputCombos(inputEdges, 0);
        for (Sign[] combo : altCombos) {
          Sign lexHead = (lefthead) ? combo[0].getLexHead() : combo[1].getLexHead();
            Sign sign = Sign.createDerivedSignWithNewLF(resultCat, combo, history.getRule(), lexHead);
            Edge edgeToAdd = (sign.equals(alt.sign))
                ? alt // use this alt for equiv sign
                : edgeFactory.makeAltEdge(sign, alt); // otherwise make edge for new alt
            merged.insert(edgeToAdd);
        }
View Full Code Here

Examples of opennlp.ccg.parse.DerivationHistory

    private String edgeDerivation(Edge edge, int index, List<Edge> edgeList) {
      if (index < 0) return "";
      if (edge.optCompletes != null) {
        return " (" + edgeList.indexOf(edge.optCompletes) + " optC)";
      }
      DerivationHistory history = edge.sign.getDerivationHistory();
      Sign[] inputs = history.getInputs();
      if (inputs == null) return " (lex)";
      String retval = " (";
    for (Sign sign : inputs) {
      Edge repEdge = signMap.get(sign);
      if (repEdge != null) retval += edgeList.indexOf(repEdge) + " ";
    }
    retval += history.getRule().name() + ")";
      return retval;
    }
View Full Code Here

Examples of opennlp.ccg.parse.DerivationHistory

      retval = lexStep(sign);
      cache(sign, retval);
      return retval;
    }
    // recursive case
    DerivationHistory dh = sign.getDerivationHistory();
    Sign[] inputs = dh.getInputs();
    // unary case
    if (inputs.length == 1) {
      Sign headChild = inputs[0];
      retval = unaryStep(sign, headChild);
      cache(sign, retval);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.