/** 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; }
/** 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; }
/** 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; }