/** Calculates the confidence in the tagging of a {@link Instance}. */ public double estimateConfidenceFor (Instance instance, Object[] startTags, Object[] inTags) { SegmentIterator iter = new SegmentIterator (model, instance, startTags, inTags); double instanceConfidence = 1; while (iter.hasNext()) { Segment s = (Segment) iter.nextSegment(); instanceConfidence *= segmentEstimator.estimateConfidenceFor (s); } return instanceConfidence; } }
/** Useful when no {@link Transduce} is specified. A list of sequences specifies the output. @param ilist InstanceList containing sequence. @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment @param predictions list of {@link Sequence}s that are the predicted output of some {@link Transducer} */ public SegmentIterator (InstanceList ilist, Object[] startTags, Object[] inTags, ArrayList predictions) { setSubIterator (ilist, startTags, inTags, predictions); }
/** Calculates the confidence in the tagging of a {@link Instance}. */ public double estimateConfidenceFor (Instance instance, Object[] startTags, Object[] inTags) { SegmentIterator iter = new SegmentIterator (model, instance, startTags, inTags); double instanceConfidence = 1; while (iter.hasNext()) { Segment s = (Segment) iter.nextSegment(); instanceConfidence *= segmentEstimator.estimateConfidenceFor (s); } return instanceConfidence; } }
/** Useful when no {@link Transduce} is specified. A list of sequences specifies the output. @param ilist InstanceList containing sequence. @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment @param predictions list of {@link Sequence}s that are the predicted output of some {@link Transducer} */ public SegmentIterator (InstanceList ilist, Object[] startTags, Object[] inTags, ArrayList predictions) { setSubIterator (ilist, startTags, inTags, predictions); }
/** Calculates the confidence in the tagging of a {@link Instance}. */ public double estimateConfidenceFor (Instance instance, Object[] startTags, Object[] inTags) { SegmentIterator iter = new SegmentIterator (model, instance, startTags, inTags); double lowestConfidence = 9999; while (iter.hasNext()) { Segment s = (Segment) iter.nextSegment(); double currConf = segmentEstimator.estimateConfidenceFor (s); if (currConf < lowestConfidence) lowestConfidence = currConf; } return lowestConfidence; } }
/** NOTE!: Assumes that <code>segmentStartTags[i]</code> corresponds to <code>segmentContinueTags[i]</code>. @param model model to segment input sequences @param ilist list of instances to be segmented @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment */ public SegmentIterator (Transducer model, InstanceList ilist, Object[] segmentStartTags, Object[] segmentContinueTags) { setSubIterator (model, ilist, segmentStartTags, segmentContinueTags); }
/** Calculates the confidence in the tagging of a {@link Instance}. */ public double estimateConfidenceFor (Instance instance, Object[] startTags, Object[] inTags) { SegmentIterator iter = new SegmentIterator (model, instance, startTags, inTags); double instanceConfidence = 1; while (iter.hasNext()) { Segment s = (Segment) iter.nextSegment(); instanceConfidence *= segmentEstimator.estimateConfidenceFor (s); } return instanceConfidence; } }
/** NOTE!: Assumes that <code>segmentStartTags[i]</code> corresponds to <code>segmentContinueTags[i]</code>. @param model model to segment input sequences @param ilist list of instances to be segmented @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment */ public SegmentIterator (Transducer model, InstanceList ilist, Object[] segmentStartTags, Object[] segmentContinueTags) { setSubIterator (model, ilist, segmentStartTags, segmentContinueTags); }
/** Calculates the confidence in the tagging of a {@link Instance}. */ public double estimateConfidenceFor (Instance instance, Object[] startTags, Object[] inTags) { SegmentIterator iter = new SegmentIterator (model, instance, startTags, inTags); double lowestConfidence = 9999; while (iter.hasNext()) { Segment s = (Segment) iter.nextSegment(); double currConf = segmentEstimator.estimateConfidenceFor (s); if (currConf < lowestConfidence) lowestConfidence = currConf; } return lowestConfidence; } }
/** NOTE!: Assumes that <code>segmentStartTags[i]</code> corresponds to <code>segmentContinueTags[i]</code>. @param model model to segment input sequences @param ilist list of instances to be segmented @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment */ public SegmentIterator (Transducer model, InstanceList ilist, Object[] segmentStartTags, Object[] segmentContinueTags) { setSubIterator (model, ilist, segmentStartTags, segmentContinueTags); }
/** Calculates the confidence in the tagging of a {@link Instance}. */ public double estimateConfidenceFor (Instance instance, Object[] startTags, Object[] inTags) { SegmentIterator iter = new SegmentIterator (model, instance, startTags, inTags); double lowestConfidence = 9999; while (iter.hasNext()) { Segment s = (Segment) iter.nextSegment(); double currConf = segmentEstimator.estimateConfidenceFor (s); if (currConf < lowestConfidence) lowestConfidence = currConf; } return lowestConfidence; } }
/** Useful when no {@link Transduce} is specified. A list of sequences specifies the output. @param ilist InstanceList containing sequence. @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment @param predictions list of {@link Sequence}s that are the predicted output of some {@link Transducer} */ public SegmentIterator (InstanceList ilist, Object[] startTags, Object[] inTags, ArrayList predictions) { setSubIterator (ilist, startTags, inTags, predictions); }
/** Ranks all {@link Segment}s in this {@link InstanceList} by confidence estimate. @param ilist list of segmentation instances @param startTags represent the labels for the start states (B-) of all segments @param continueTags represent the labels for the continue state (I-) of all segments @return array of {@link Segment}s ordered by non-decreasing confidence scores, as calculated by <code>estimateConfidenceFor</code> */ public Segment[] rankSegmentsByConfidence (InstanceList ilist, Object[] startTags, Object[] continueTags) { ArrayList segmentList = new ArrayList (); SegmentIterator iter = new SegmentIterator (this.model, ilist, startTags, continueTags); if (this.segmentConfidences == null) segmentConfidences = new java.util.Vector (); while (iter.hasNext ()) { Segment segment = (Segment) iter.nextSegment (); double confidence = estimateConfidenceFor (segment); segment.setConfidence (confidence); logger.fine ("confidence=" + segment.getConfidence() + " for segment\n" + segment.sequenceToString() + "\n"); segmentList.add (segment); } Collections.sort (segmentList); Segment[] ret = new Segment[1]; ret = (Segment[]) segmentList.toArray (ret); return ret; }
/** Iterate over segments in one instance. @param ilist InstanceList containing sequence. @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment @param predictions list of {@link Sequence}s that are the predicted output of some {@link Transducer} */ public SegmentIterator (Instance instance, Object[] startTags, Object[] inTags, Sequence prediction) { InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet())); ilist.add (instance); ArrayList predictions = new ArrayList(); predictions.add (prediction); setSubIterator (ilist, startTags, inTags, predictions); }
/** Ranks all {@link Segment}s in this {@link InstanceList} by confidence estimate. @param ilist list of segmentation instances @param startTags represent the labels for the start states (B-) of all segments @param continueTags represent the labels for the continue state (I-) of all segments @return array of {@link Segment}s ordered by non-decreasing confidence scores, as calculated by <code>estimateConfidenceFor</code> */ public Segment[] rankSegmentsByConfidence (InstanceList ilist, Object[] startTags, Object[] continueTags) { ArrayList segmentList = new ArrayList (); SegmentIterator iter = new SegmentIterator (this.model, ilist, startTags, continueTags); if (this.segmentConfidences == null) segmentConfidences = new java.util.Vector (); while (iter.hasNext ()) { Segment segment = (Segment) iter.nextSegment (); double confidence = estimateConfidenceFor (segment); segment.setConfidence (confidence); logger.fine ("confidence=" + segment.getConfidence() + " for segment\n" + segment.sequenceToString() + "\n"); segmentList.add (segment); } Collections.sort (segmentList); Segment[] ret = new Segment[1]; ret = (Segment[]) segmentList.toArray (ret); return ret; }
/** Iterate over segments in one instance. @param ilist InstanceList containing sequence. @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment @param predictions list of {@link Sequence}s that are the predicted output of some {@link Transducer} */ public SegmentIterator (Instance instance, Object[] startTags, Object[] inTags, Sequence prediction) { InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet())); ilist.add (instance); ArrayList predictions = new ArrayList(); predictions.add (prediction); setSubIterator (ilist, startTags, inTags, predictions); }
/** Ranks all {@link Segment}s in this {@link InstanceList} by confidence estimate. @param ilist list of segmentation instances @param startTags represent the labels for the start states (B-) of all segments @param continueTags represent the labels for the continue state (I-) of all segments @return array of {@link Segment}s ordered by non-decreasing confidence scores, as calculated by <code>estimateConfidenceFor</code> */ public Segment[] rankSegmentsByConfidence (InstanceList ilist, Object[] startTags, Object[] continueTags) { ArrayList segmentList = new ArrayList (); SegmentIterator iter = new SegmentIterator (this.model, ilist, startTags, continueTags); if (this.segmentConfidences == null) segmentConfidences = new java.util.Vector (); while (iter.hasNext ()) { Segment segment = (Segment) iter.nextSegment (); double confidence = estimateConfidenceFor (segment); segment.setConfidence (confidence); logger.fine ("confidence=" + segment.getConfidence() + " for segment\n" + segment.sequenceToString() + "\n"); segmentList.add (segment); } Collections.sort (segmentList); Segment[] ret = new Segment[1]; ret = (Segment[]) segmentList.toArray (ret); return ret; }
/** Iterate over segments in one instance. @param ilist InstanceList containing sequence. @param segmentStartTags array of tags indicating the start of a segment @param segmentContinueTags array of tags indicating the continuation of a segment @param predictions list of {@link Sequence}s that are the predicted output of some {@link Transducer} */ public SegmentIterator (Instance instance, Object[] startTags, Object[] inTags, Sequence prediction) { InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet())); ilist.add (instance); ArrayList predictions = new ArrayList(); predictions.add (prediction); setSubIterator (ilist, startTags, inTags, predictions); }
/** Iterates over {@link Segment}s for only one {@link Instance}. */ public SegmentIterator (Transducer model, Instance instance, Object[] segmentStartTags, Object[] segmentContinueTags) { InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet())); ilist.add (instance); setSubIterator (model, ilist, segmentStartTags, segmentContinueTags); }
/** Iterates over {@link Segment}s for only one {@link Instance}. */ public SegmentIterator (Transducer model, Instance instance, Object[] segmentStartTags, Object[] segmentContinueTags) { InstanceList ilist = new InstanceList (new Noop (instance.getDataAlphabet(), instance.getTargetAlphabet())); ilist.add (instance); setSubIterator (model, ilist, segmentStartTags, segmentContinueTags); }