/** Returns a clone of the current annotation study which contains * only the annotation units of the raters with the given indexes. * All other units will be removed. This method is useful for * converting an annotation study with multiple raters into a * (pairwise) annotation study with two raters. */ public CodingAnnotationStudy extractRaters(final int... raters) { CodingAnnotationStudy result = new CodingAnnotationStudy(raters.length); for (ICodingAnnotationItem item : getItems()) { CodingAnnotationItem newItem = new CodingAnnotationItem(raters.length); for (int r = 0; r < raters.length; r++) { IAnnotationUnit unit = item.getUnit(raters[r]); newItem.addUnit(result.createUnit(result.items.size(), r, unit.getCategory())); } result.items.add(newItem); } return result; }
/** 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. */ public CodingAnnotationStudy stripCategories(final Object keepCategory, final Object nullCategory) { CodingAnnotationStudy result = new CodingAnnotationStudy(getRaterCount()); for (ICodingAnnotationItem item : getItems()) { CodingAnnotationItem newItem = new CodingAnnotationItem(raters.size()); for (IAnnotationUnit unit : item.getUnits()) { Object newCategory; if (!keepCategory.equals(unit.getCategory())) newCategory = nullCategory; else newCategory = keepCategory; newItem.addUnit(result.createUnit(result.items.size(), unit.getRaterIdx(), newCategory)); } result.items.add(newItem); } return result; }
@Override public CodingAnnotationStudy clone() { CodingAnnotationStudy result = new CodingAnnotationStudy(getRaterCount()); for (ICodingAnnotationItem item : getItems()) { CodingAnnotationItem newItem = new CodingAnnotationItem(raters.size()); for (IAnnotationUnit unit : item.getUnits()) newItem.addUnit(result.createUnit(result.items.size(), unit.getRaterIdx(), unit.getCategory())); result.items.add(newItem); } for (Object category : getCategories()) result.addCategory(category); return result; }
List<ConfigurationSet> pluralitySets = new ArrayList<>(); List<ConfigurationSet> irrelevantSets = new ArrayList<>(); CodingAnnotationStudy study = new CodingAnnotationStudy(users.size());