public static double getGap(SingleTreeEvaluations evaluations) { return evaluations.getMissingLemmas()+ evaluations.getMissingNodes()+ evaluations.getMissingRelations(); }
if (currentEvaluation.getMissingLemmas()<ancestorEvaluation.getMissingLemmas()) improved=true; if (currentEvaluation.getMissingNodes()<ancestorEvaluation.getMissingNodes())
public static double getFutureEstimation(SingleTreeEvaluations evaluations) { return evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations(); }
private static double getGapOfEvaluations(SingleTreeEvaluations evaluations) { return (double)(evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations()); }
public static double generateUnweightedFutureEstimationWithBelief(SingleTreeEvaluations evaluations,double belief,Set<String> hypothesisLemmasLowerCase,int numberOfHypothesisNodes) { double ret = 0; int missingRelations = evaluations.getMissingRelations(); if (0==missingRelations) // if it is goal { ret = 0; } else { int missingNodes = evaluations.getMissingNodes(); int missingLemmas = evaluations.getMissingLemmas(); missingRelations-=belief; missingNodes-=belief; missingLemmas-=belief; double missingNodesPortion = ((double)missingNodes) / ((double)numberOfHypothesisNodes); double missingRelationsPortion = ((double)missingRelations) / ((double)(numberOfHypothesisNodes-1)); double missingLemmasPortion = ((double)missingLemmas) / ((double)(hypothesisLemmasLowerCase.size())); ret = missingLemmasPortion+missingNodesPortion+missingRelationsPortion; } return ret; }
protected double getHeuristicGap(TreeAndParentMap<ExtendedInfo, ExtendedNode> tree) { SingleTreeEvaluations evaluations = new AlignmentCalculator(operationsEnvironment.getAlignmentCriteria(), tree, operationsEnvironment.getHypothesis()).getEvaluations(operationsEnvironment.getHypothesisLemmasLowerCase(), operationsEnvironment.getHypothesisNumberOfNodes()); return (double)(evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations()); // return TreeUtilities.getHeuristicGap(tree, this.operationsEnvironment); }
private double gapOf(ExtendedNode textTree) throws TreeAndParentMapException { TreeAndParentMap<ExtendedInfo, ExtendedNode> tapm = new TreeAndParentMap<ExtendedInfo, ExtendedNode>(textTree); // SingleTreeEvaluations evaluations = SingleTreeEvaluations.create(tapm, this.operationsEnvironment.getHypothesis(), this.operationsEnvironment.getHypothesisLemmasLowerCase(),this.operationsEnvironment.getHypothesisNumberOfNodes()); SingleTreeEvaluations evaluations = new AlignmentCalculator(operationsEnvironment.getAlignmentCriteria(), tapm, operationsEnvironment.getHypothesis()).getEvaluations(operationsEnvironment.getHypothesisLemmasLowerCase(), operationsEnvironment.getHypothesisNumberOfNodes()); return (double) evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations(); }
/** * Returns a number that describes the gap between the given tree and the * hypothesis tree.<BR> * This number is based on the number of missing words, missing nodes * and missing relations (where "relation" is parent-child-label). * For more information see {@link SingleTreeEvaluations}. * @param tree * @return * @throws GapException */ @Override protected double getHeuristicGap(TreeAndParentMap<ExtendedInfo, ExtendedNode> tree, Map<Integer, Double> featureVector) throws GapException { if (hybridGapMode) { return gapTools.getGapHeuristicMeasure().measure(tree,featureVector,gapEnvironment); } else { // SingleTreeEvaluations evaluations = SingleTreeEvaluations.create(tree,operationsEnvironment.getHypothesis(),hypothesisLemmasLowerCase,hypothesisNumberOfNodes); SingleTreeEvaluations evaluations = new AlignmentCalculator(this.teSystemEnvironment.getAlignmentCriteria(),tree,operationsEnvironment.getHypothesis()).getEvaluations(hypothesisLemmasLowerCase,hypothesisNumberOfNodes); return (double)(evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations()); } }