use of com.joliciel.talismane.machineLearning.features.RuntimeEnvironment in project jochre by urieli.
the class RecursiveShapeSplitter method shouldSplit.
public double shouldSplit(Split splitCandidate) {
List<FeatureResult<?>> featureResults = new ArrayList<FeatureResult<?>>();
// analyse features
for (SplitFeature<?> feature : splitFeatures) {
RuntimeEnvironment env = new RuntimeEnvironment();
FeatureResult<?> featureResult = feature.check(splitCandidate, env);
if (featureResult != null) {
featureResults.add(featureResult);
if (LOG.isTraceEnabled()) {
LOG.trace(featureResult.toString());
}
}
}
List<Decision> decisions = decisionMaker.decide(featureResults);
double yesProb = 0.0;
for (Decision decision : decisions) {
if (decision.getOutcome().equals(SplitOutcome.DO_SPLIT.name())) {
yesProb = decision.getProbability();
break;
}
}
if (LOG.isTraceEnabled()) {
LOG.trace("splitCandidate: left=" + splitCandidate.getShape().getLeft() + ", pos=" + splitCandidate.getPosition());
LOG.trace("yesProb: " + yesProb);
}
return yesProb;
}
Aggregations