public class CodingAnnotationStudy extends AnnotationStudy implements ICodingAnnotationStudy, Cloneable
ICodingAnnotationStudy
interface.
Instantiate this class for representing the annotation item of a
coding study (i.e., an annotation setup in which the (human) raters
are asked to code a set of given annotation items). The standard way of
representing the annotation units (i.e., the category assigned by a
certain rater) of an annotation item is using the
addItem(Object...)
method which allows specifying the list of
categories assigned by the raters.ICodingAnnotationStudy
,
ICodingAnnotationItem
Modifier and Type | Field and Description |
---|---|
protected List<ICodingAnnotationItem> |
items |
categories, raters
Modifier | Constructor and Description |
---|---|
protected |
CodingAnnotationStudy()
Initializes and empty annotation study for a coding task.
|
|
CodingAnnotationStudy(int raterCount)
Initializes and empty annotation study for a coding task with the given
number of raters.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addItem(ICodingAnnotationItem item)
Add the given annotation item to this study.
|
ICodingAnnotationItem |
addItem(Object... annotations)
Creates a new
CodingAnnotationItem which has been coded with
the given annotation categories. |
ICodingAnnotationItem |
addItemAsArray(Object[] annotations)
Creates a new
CodingAnnotationItem which has been coded with
the given annotation categories. |
void |
addMultipleItems(int times,
Object... values)
Shorthand for invoking
addItem(Object...) with the same
parameters multiple times. |
CodingAnnotationStudy |
clone() |
static Map<Object,int[]> |
countAnnotationsPerCategory(ICodingAnnotationStudy study)
Returns a two-dimensional map of categories and raters and the
corresponding usage frequencies in the given annotation study
(i.e., how often a certain rater used a certain category for
coding an annotation unit).
|
static Map<Object,Map<Object,Double>> |
countCategoryCoincidence(ICodingAnnotationItem item)
Returns a two dimensional map of category pairs and their co-occurrence
frequencies for the given annotation item.
|
static Map<Object,Map<Object,Double>> |
countCategoryCoincidence(ICodingAnnotationStudy study)
Returns a two dimensional map of category pairs and their co-occurrence
frequencies for the given annotation study.
|
static Map<Object,Integer> |
countTotalAnnotationsPerCategory(ICodingAnnotationItem item)
Returns a map of categories and their usage frequencies (i.e.,
how often they are used in annotation units) within the given
annotation item.
|
static Map<Object,Integer> |
countTotalAnnotationsPerCategory(ICodingAnnotationStudy study)
Returns a map of categories and their usage frequencies (i.e.,
how often they are used in annotation units) within the given
annotation study.
|
protected IAnnotationUnit |
createUnit(int index,
int raterIdx,
Object category) |
CodingAnnotationStudy |
extractRaters(int... raters)
Returns a clone of the current annotation study which contains
only the annotation units of the raters with the given indexes.
|
ICodingAnnotationItem |
getItem(int index)
Returns the annotation item with the given index.
|
int |
getItemCount()
Returns the number of annotation items defined by the study.
|
Iterable<ICodingAnnotationItem> |
getItems()
Allows iterating all annotation items of this study.
|
int |
getUnitCount()
Returns the number of annotation units defined by the study.
|
boolean |
hasMissingValues()
Returns true if, and only if, the annotation study contains at least
one item with a missing value (i.e., an annotation item containing
an annotation unit with category null).
|
CodingAnnotationStudy |
stripCategories(Object keepCategory,
Object nullCategory)
Returns a clone of the current annotation study in which all categories
are replaced by the given nullCategory except the categories matching
the specified keepCategory.
|
addCategory, addRater, findRater, getCategories, getCategoryCount, getRaterCount, isDichotomous
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCategories, getCategoryCount, getRaterCount, isDichotomous
protected List<ICodingAnnotationItem> items
protected CodingAnnotationStudy()
public CodingAnnotationStudy(int raterCount)
protected void addItem(ICodingAnnotationItem item)
CodingAnnotationItem
, it is recommended to use
addItem(Object...)
instead.public ICodingAnnotationItem addItem(Object... annotations)
CodingAnnotationItem
which has been coded with
the given annotation categories. Note that the order of the categories
must correspond to the raters' indexes. Use null to represent missing
annotations, Invoking addItem("A", "B", null, "A")
indicates an annotation item which has been coded as category "A"
by rater 0 and 3 and as category "B" by rater 1. Rater 2 did not
assign any category to the item. The method is a shorthand for
addItemAsArray(Object[])
.IllegalArgumentException
- if the number of annotations does
not match the number of raters.public ICodingAnnotationItem addItemAsArray(Object[] annotations)
CodingAnnotationItem
which has been coded with
the given annotation categories. Note that the order of the categories
must correspond to the raters' indexes. Use null to represent missing
annotations, Invoking addItem(new Object[]{"A", "B", null,
"A"})
indicates an annotation item which has been coded as
category "A" by rater 0 and 3 and as category "B" by rater 1. Rater 2
did not assign any category to the item.IllegalArgumentException
- if the number of annotations does
not match the number of raters.public void addMultipleItems(int times, Object... values)
addItem(Object...)
with the same
parameters multiple times. This method is useful for modeling
annotation data based on a contingency table.protected IAnnotationUnit createUnit(int index, int raterIdx, Object category)
public ICodingAnnotationItem getItem(int index)
ICodingAnnotationStudy
getItem
in interface ICodingAnnotationStudy
public Iterable<ICodingAnnotationItem> getItems()
ICodingAnnotationStudy
getItems
in interface ICodingAnnotationStudy
public int getItemCount()
ICodingAnnotationStudy
getItemCount
in interface ICodingAnnotationStudy
public int getUnitCount()
ICodingAnnotationStudy
getUnitCount
in interface ICodingAnnotationStudy
getUnitCount
in interface IAnnotationStudy
public boolean hasMissingValues()
ICodingAnnotationStudy
hasMissingValues
in interface ICodingAnnotationStudy
public CodingAnnotationStudy clone()
public CodingAnnotationStudy stripCategories(Object keepCategory, Object nullCategory)
public CodingAnnotationStudy extractRaters(int... raters)
public static Map<Object,int[]> countAnnotationsPerCategory(ICodingAnnotationStudy study)
public static Map<Object,Integer> countTotalAnnotationsPerCategory(ICodingAnnotationStudy study)
public static Map<Object,Integer> countTotalAnnotationsPerCategory(ICodingAnnotationItem item)
public static Map<Object,Map<Object,Double>> countCategoryCoincidence(ICodingAnnotationStudy study)
Copyright © 2011–2015 Ubiquitous Knowledge Processing (UKP) Lab. All rights reserved.