Class UnitizingAnnotationStudy
java.lang.Object
org.dkpro.statistics.agreement.AnnotationStudy
org.dkpro.statistics.agreement.unitizing.UnitizingAnnotationStudy
- All Implemented Interfaces:
java.io.Serializable,IAnnotationStudy,IUnitizingAnnotationStudy
public class UnitizingAnnotationStudy extends AnnotationStudy implements IUnitizingAnnotationStudy, java.io.Serializable
Default implementation of the
IUnitizingAnnotationStudy interface. Instantiate this class
for representing the annotation units of a unitizing study (i.e., an annotation setup in which
the (human) raters are asked to identify the boundaries of the annotation units themselves). The
standard way of representing the annotation units is using the
addUnit(long, long, int, Object) method for each identified segment by each rater.- Author:
- Christian M. Meyer
- See Also:
IUnitizingAnnotationStudy,IUnitizingAnnotationUnit, Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected longbeginprotected longlengthprotected java.util.Set<IUnitizingAnnotationUnit>units -
Constructor Summary
Constructors Constructor Description UnitizingAnnotationStudy(int length)Initializes and empty annotation study for a unitizing task with no raters.UnitizingAnnotationStudy(int raterCount, int length)Initializes and empty annotation study for a unitizing task with the given number of raters.UnitizingAnnotationStudy(int raterCount, long begin, long length)Initializes and empty annotation study for a unitizing task with the given number of raters. -
Method Summary
Modifier and Type Method Description IUnitizingAnnotationUnitaddUnit(long offset, long length, int raterIdx, java.lang.Object category)Creates a newUnitizingAnnotationUnitand adds it to the present annotation study.voidaddUnit(IUnitizingAnnotationUnit unit)Add the given annotation unit to this study.protected IUnitizingAnnotationUnitcreateUnit(long offset, long length, int raterIdx, java.lang.Object category)static IUnitizingAnnotationUnitfindNextUnit(java.util.Iterator<IUnitizingAnnotationUnit> units, int raterIdx)Utility method for moving on the cursor of the given iterator until a unit of the specified rater is returned.static IUnitizingAnnotationUnitfindNextUnit(java.util.Iterator<IUnitizingAnnotationUnit> units, int raterIdx, java.lang.Object category)Utility method for moving on the cursor of the given iterator until a unit of the specified rater and category is returned.static IUnitizingAnnotationUnitfindNextUnit(java.util.Iterator<IUnitizingAnnotationUnit> units, java.lang.Object category)Utility method for moving on the cursor of the given iterator until a unit of the specified category is returned.longgetContinuumBegin()Returns the begin of the continuum (i.e., the first offset that is considered valid for annotation units).longgetContinuumLength()Returns the length of the continuum (i.e., the last possible right delimiter of an annotation unit).intgetUnitCount()Returns the number of annotation units defined by the study.longgetUnitCount(int raterIdx)Returns the number of units rated by the given rater.java.util.Collection<IUnitizingAnnotationUnit>getUnits()Allows iterating all annotation units of this study.Methods inherited from class org.dkpro.statistics.agreement.AnnotationStudy
addCategory, addRater, findRater, getCategories, getCategoryCount, getRaterCount, isDichotomousMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dkpro.statistics.agreement.IAnnotationStudy
findRater, getCategories, getCategoryCount, getRaterCount, isDichotomous
-
Field Details
-
Constructor Details
-
UnitizingAnnotationStudy
public UnitizingAnnotationStudy(int length)Initializes and empty annotation study for a unitizing task with no raters. Add raters using theAnnotationStudy.addRater(String)method. The basic setup of a unitizing study is identifying units within a given continuum. The continuum is initialized to start at position 0 and end at the given length. -
UnitizingAnnotationStudy
public UnitizingAnnotationStudy(int raterCount, int length)Initializes and empty annotation study for a unitizing task with the given number of raters. The basic setup of a unitizing study is identifying units within a given continuum. The continuum is initialized to start at position 0 and end at the given length. -
UnitizingAnnotationStudy
public UnitizingAnnotationStudy(int raterCount, long begin, long length)Initializes and empty annotation study for a unitizing task with the given number of raters. The basic setup of a unitizing study is identifying units within a given continuum. The continuum is initialized to start at the given position and end after the specified length (i.e., at position start + length).
-
-
Method Details
-
addUnit
Add the given annotation unit to this study. The specified unit should never be null. When relying on the default implementationUnitizingAnnotationUnit, it is recommended to useaddUnit(long, long, int, Object)instead. -
addUnit
public IUnitizingAnnotationUnit addUnit(long offset, long length, int raterIdx, java.lang.Object category)Creates a newUnitizingAnnotationUnitand adds it to the present annotation study. The parameters define the position of the unit within the continuum (indicated by the offset/start position and the length of the unit), the rater who identified this unit and the category assigned to it. If the unitzing study does not distinguish any categories, use some dummy object, such as "X" to distinguish identified units from gaps (i.e., units whose category is null). -
createUnit
protected IUnitizingAnnotationUnit createUnit(long offset, long length, int raterIdx, java.lang.Object category) -
getUnits
Description copied from interface:IUnitizingAnnotationStudyAllows iterating all annotation units of this study.- Specified by:
getUnitsin interfaceIUnitizingAnnotationStudy
-
getUnitCount
public long getUnitCount(int raterIdx)Description copied from interface:IUnitizingAnnotationStudyReturns the number of units rated by the given rater.- Specified by:
getUnitCountin interfaceIUnitizingAnnotationStudy
-
getUnitCount
public int getUnitCount()Description copied from interface:IAnnotationStudyReturns the number of annotation units defined by the study. That is, the number of annotations coded by the raters.- Specified by:
getUnitCountin interfaceIAnnotationStudy
-
findNextUnit
public static IUnitizingAnnotationUnit findNextUnit(java.util.Iterator<IUnitizingAnnotationUnit> units, int raterIdx)Utility method for moving on the cursor of the given iterator until a unit of the specified rater is returned. -
findNextUnit
public static IUnitizingAnnotationUnit findNextUnit(java.util.Iterator<IUnitizingAnnotationUnit> units, java.lang.Object category)Utility method for moving on the cursor of the given iterator until a unit of the specified category is returned. -
findNextUnit
public static IUnitizingAnnotationUnit findNextUnit(java.util.Iterator<IUnitizingAnnotationUnit> units, int raterIdx, java.lang.Object category)Utility method for moving on the cursor of the given iterator until a unit of the specified rater and category is returned. Both the rater index and the category may be null if those filter conditions are to be ignored. -
getContinuumBegin
public long getContinuumBegin()Description copied from interface:IUnitizingAnnotationStudyReturns the begin of the continuum (i.e., the first offset that is considered valid for annotation units).- Specified by:
getContinuumBeginin interfaceIUnitizingAnnotationStudy
-
getContinuumLength
public long getContinuumLength()Description copied from interface:IUnitizingAnnotationStudyReturns the length of the continuum (i.e., the last possible right delimiter of an annotation unit).- Specified by:
getContinuumLengthin interfaceIUnitizingAnnotationStudy
-