Search in sources :

Example 1 with Annotator

use of edu.illinois.cs.cogcomp.annotation.Annotator in project cogcomp-nlp by CogComp.

the class CuratorAnnotatorService method addView.

@Override
public boolean addView(TextAnnotation ta, String viewName) throws AnnotatorException {
    if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName))
        return false;
    if (!viewProviders.containsKey(viewName))
        throw new AnnotatorException("View " + viewName + " is not supported.");
    boolean isUpdated = false;
    // AnnotatorService will not support caching
    if (ta.hasView(viewName))
        return false;
    Annotator annotator = viewProviders.get(viewName);
    for (String prereqView : annotator.getRequiredViews()) isUpdated = addView(ta, prereqView);
    ta.addView(annotator);
    // AnnotatorService will not support caching
    return isUpdated;
}
Also used : Annotator(edu.illinois.cs.cogcomp.annotation.Annotator) AnnotatorException(edu.illinois.cs.cogcomp.annotation.AnnotatorException)

Aggregations

Annotator (edu.illinois.cs.cogcomp.annotation.Annotator)1 AnnotatorException (edu.illinois.cs.cogcomp.annotation.AnnotatorException)1