net.sourceforge.nite.datainspection.timespan
Class SegmentAligner

java.lang.Object
  extended by net.sourceforge.nite.datainspection.timespan.SegmentAligner

public class SegmentAligner
extends java.lang.Object

Aligns two 'segment annotations'. See design on paper for documentation


Constructor Summary
SegmentAligner()
           
 
Method Summary
static SegmentAlignment alignSegments(java.util.ArrayList segmentList1, java.util.ArrayList segmentList2, double th, Predicate isIgnoreP)
          This default alignment method takes two segments to be 'equal' if the difference in time is at most 'th'.
static java.util.ArrayList createFinalMatching(java.util.ArrayList candidates, java.util.Set unmatched1, java.util.Set unmatched2)
          recursive: make one heaviest match final, then split in left and right and do again method taken from {kuper2004,IJCAI, MUMIS merging} candidatematching lists are sorted on weight! but final matching list will automatically be sorted on time! also modifies the unmatchedSegmentLists...
static WeightedPair getCandidate(NOMWriteElement nwe1, NOMWriteElement nwe2, double th, Predicate isIgnoreP)
          Given two segments from different coders, return null if they cannot be aligned (e.g.
static void selectFinalMatchings(SegmentAlignment data, java.util.ArrayList candidateMatchings)
          Use a derivation of the MUMIS merging algorithm to select final alignments between segments of different annotators.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SegmentAligner

public SegmentAligner()
Method Detail

alignSegments

public static SegmentAlignment alignSegments(java.util.ArrayList segmentList1,
                                             java.util.ArrayList segmentList2,
                                             double th,
                                             Predicate isIgnoreP)
This default alignment method takes two segments to be 'equal' if the difference in time is at most 'th'. First all potential candidates are selected (based on th); then the final matchings are selected, searching through the candidates for the 'best' matches. It is certain that each segments is aligned only once, but there is no garantuee about how this is achieved.


getCandidate

public static WeightedPair getCandidate(NOMWriteElement nwe1,
                                        NOMWriteElement nwe2,
                                        double th,
                                        Predicate isIgnoreP)
Given two segments from different coders, return null if they cannot be aligned (e.g. too far away), or a weighted pair as candidate if they MIGHT be aligned. Parameters & rules for deciding candidates, in order of application: If one of the elements is an ignore element, there is no alignment. To be considered a candidate alginemt, the start points, and the end points, should be apart no more than /th/ seconds.

If the timing constraints are met, the pair is a candidate for alignment. The WEIGHT of the alignments is calculated based on timing difference

NOT APPLIED YET is the following extension. (see also package documentation) as a special case, the elements should be 'very large'. In the last case there should be a large /overlap/ between the segments. (The rationale is that if segments are 20 seconds long, then a delay of 2 seconds is not as bad as long as the /overlap/ between the segments is e.g. 15 seconds). 'Large enough': overlap divided by sum of lengths should be .25 or larger ( they overlap for more than half (equalsized) or e.g. one is no more than 3 times size of other (unequalsized containment))

NOT APPLIED YET is the following extension. (see also package documentation) WEIGHT is also determined by the labelling difference as calculated by the DistanceMetric from the constructor.


selectFinalMatchings

public static void selectFinalMatchings(SegmentAlignment data,
                                        java.util.ArrayList candidateMatchings)
Use a derivation of the MUMIS merging algorithm to select final alignments between segments of different annotators.


createFinalMatching

public static java.util.ArrayList createFinalMatching(java.util.ArrayList candidates,
                                                      java.util.Set unmatched1,
                                                      java.util.Set unmatched2)
recursive: make one heaviest match final, then split in left and right and do again method taken from {kuper2004,IJCAI, MUMIS merging} candidatematching lists are sorted on weight! but final matching list will automatically be sorted on time! also modifies the unmatchedSegmentLists...