Label trueLabel = trueSpan.getLabel (); boolean predNonBgrnd = !predSpan.isBackground (); boolean trueNonBgrnd = !trueSpan.isBackground (); boolean isBackground = !predNonBgrnd && !trueNonBgrnd;
Label trueLabel = trueSpan.getLabel (); boolean predNonBgrnd = !predSpan.isBackground (); boolean trueNonBgrnd = !trueSpan.isBackground (); boolean isBackground = !predNonBgrnd && !trueNonBgrnd;
Label trueLabel = trueSpan.getLabel (); boolean predNonBgrnd = !predSpan.isBackground (); boolean trueNonBgrnd = !trueSpan.isBackground (); boolean isBackground = !predNonBgrnd && !trueNonBgrnd;
public Record (String name, LabeledSpans spans) { this.name = name; fieldMap = new THashMap (); for (int i = 0; i < spans.size(); i++) { LabeledSpan span = spans.getLabeledSpan (i); if (!span.isBackground()) { Label tag = span.getLabel (); Field field = (Field) fieldMap.get (tag); if (field == null) { field = new Field (span); fieldMap.put (tag, field); } else { field.addFiller (span); } } } }
public Record (String name, LabeledSpans spans) { this.name = name; fieldMap = new THashMap (); for (int i = 0; i < spans.size(); i++) { LabeledSpan span = spans.getLabeledSpan (i); if (!span.isBackground()) { Label tag = span.getLabel (); Field field = (Field) fieldMap.get (tag); if (field == null) { field = new Field (span); fieldMap.put (tag, field); } else { field.addFiller (span); } } } }
public Record (String name, LabeledSpans spans) { this.name = name; fieldMap = new THashMap (); for (int i = 0; i < spans.size(); i++) { LabeledSpan span = spans.getLabeledSpan (i); if (!span.isBackground()) { Label tag = span.getLabel (); Field field = (Field) fieldMap.get (tag); if (field == null) { field = new Field (span); fieldMap.put (tag, field); } else { field.addFiller (span); } } } }
public void estimateConfidence (DocumentExtraction documentExtraction) { Tokenization input = documentExtraction.getInput(); // WARNING: input Tokenization will likely already have many // features appended from the last time it was passed through a // featurePipe. To avoid a redundant calculation of features, the // caller may want to set this.featurePipe = // TokenSequence2FeatureVectorSequence Instance carrier = this.featurePipe.pipe(new Instance(input, null, null, null)); Sequence pipedInput = (Sequence) carrier.getData(); Sequence prediction = documentExtraction.getPredictedLabels(); LabeledSpans labeledSpans = documentExtraction.getExtractedSpans(); SumLatticeDefault lattice = new SumLatticeDefault (this.confidenceEstimator.getTransducer(), pipedInput); for (int i=0; i < labeledSpans.size(); i++) { LabeledSpan span = labeledSpans.getLabeledSpan(i); if (span.isBackground()) continue; int[] segmentBoundaries = getSegmentBoundaries(input, span); Segment segment = new Segment(pipedInput, prediction, prediction, segmentBoundaries[0], segmentBoundaries[1], null, null); span.setConfidence(confidenceEstimator.estimateConfidenceFor(segment, lattice)); } }
public void estimateConfidence (DocumentExtraction documentExtraction) { Tokenization input = documentExtraction.getInput(); // WARNING: input Tokenization will likely already have many // features appended from the last time it was passed through a // featurePipe. To avoid a redundant calculation of features, the // caller may want to set this.featurePipe = // TokenSequence2FeatureVectorSequence Instance carrier = this.featurePipe.pipe(new Instance(input, null, null, null)); Sequence pipedInput = (Sequence) carrier.getData(); Sequence prediction = documentExtraction.getPredictedLabels(); LabeledSpans labeledSpans = documentExtraction.getExtractedSpans(); SumLatticeDefault lattice = new SumLatticeDefault (this.confidenceEstimator.getTransducer(), pipedInput); for (int i=0; i < labeledSpans.size(); i++) { LabeledSpan span = labeledSpans.getLabeledSpan(i); if (span.isBackground()) continue; int[] segmentBoundaries = getSegmentBoundaries(input, span); Segment segment = new Segment(pipedInput, prediction, prediction, segmentBoundaries[0], segmentBoundaries[1], null, null); span.setConfidence(confidenceEstimator.estimateConfidenceFor(segment, lattice)); } }
public void estimateConfidence (DocumentExtraction documentExtraction) { Tokenization input = documentExtraction.getInput(); // WARNING: input Tokenization will likely already have many // features appended from the last time it was passed through a // featurePipe. To avoid a redundant calculation of features, the // caller may want to set this.featurePipe = // TokenSequence2FeatureVectorSequence Instance carrier = this.featurePipe.pipe(new Instance(input, null, null, null)); Sequence pipedInput = (Sequence) carrier.getData(); Sequence prediction = documentExtraction.getPredictedLabels(); LabeledSpans labeledSpans = documentExtraction.getExtractedSpans(); SumLatticeDefault lattice = new SumLatticeDefault (this.confidenceEstimator.getTransducer(), pipedInput); for (int i=0; i < labeledSpans.size(); i++) { LabeledSpan span = labeledSpans.getLabeledSpan(i); if (span.isBackground()) continue; int[] segmentBoundaries = getSegmentBoundaries(input, span); Segment segment = new Segment(pipedInput, prediction, prediction, segmentBoundaries[0], segmentBoundaries[1], null, null); span.setConfidence(confidenceEstimator.estimateConfidenceFor(segment, lattice)); } }