Java Code Examples for org.apache.uima.fit.util.CasUtil#selectCovered()
The following examples show how to use
org.apache.uima.fit.util.CasUtil#selectCovered() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenNlpPosRecommender.java From inception with Apache License 2.0 | 5 votes |
private String getFeatureValueCovering(CAS aCas, AnnotationFS aToken, Type aType, Feature aFeature) { List<AnnotationFS> annotations = CasUtil.selectCovered(aType, aToken); if (annotations.isEmpty()) { return PAD; } String value = annotations.get(0).getFeatureValueAsString(aFeature); return isNoneBlank(value) ? value : PAD; }
Example 2
Source File: NamedEntityLinker.java From inception with Apache License 2.0 | 5 votes |
@Override public void predict(RecommenderContext aContext, CAS aCas) throws RecommendationException { Type predictedType = getPredictedType(aCas); for (AnnotationFS sentence : selectSentences(aCas)) { for (AnnotationFS annotation : CasUtil.selectCovered(aCas, predictedType, sentence)) { int begin = annotation.getBegin(); int end = annotation.getEnd(); predictSingle(annotation.getCoveredText(), begin, end, aCas); } } }
Example 3
Source File: ValuesGenerator.java From webanno with Apache License 2.0 | 5 votes |
public static List<AnnotationFS> selectAt(CAS aCas, final Type type, int aBegin, int aEnd) { List<AnnotationFS> covered = CasUtil.selectCovered(aCas, type, aBegin, aEnd); // Remove all that do not have the exact same offset covered.removeIf(cur -> !(cur.getBegin() == aBegin && cur.getEnd() == aEnd)); return covered; }
Example 4
Source File: AutomationUtil.java From webanno with Apache License 2.0 | 5 votes |
@Deprecated private static void deleteSpanAnnotation(TypeAdapter aAdapter, AnnotatorState aState, CAS aCas, AnnotationFeature aFeature, int aBegin, int aEnd, Object aValue) { Type type = CasUtil.getType(aCas, aAdapter.getAnnotationTypeName()); for (AnnotationFS fs : CasUtil.selectCovered(aCas, type, aBegin, aEnd)) { if (fs.getBegin() == aBegin && fs.getEnd() == aEnd) { if (ObjectUtils.equals(aAdapter.getFeatureValue(aFeature, fs), aValue)) { aAdapter.delete(aState.getDocument(), aState.getUser().getUsername(), aCas, new VID(getAddr(fs))); } } } }
Example 5
Source File: WebAnnoCasUtil.java From webanno with Apache License 2.0 | 4 votes |
public static Collection<AnnotationFS> selectTokensCovered(CAS aCas, int aBegin, int aEnd) { return CasUtil.selectCovered(aCas, getType(aCas, Token.class), aBegin, aEnd); }
Example 6
Source File: WebAnnoCasUtil.java From webanno with Apache License 2.0 | 4 votes |
public static Collection<AnnotationFS> selectTokensCovered(AnnotationFS aCover) { return CasUtil.selectCovered(aCover.getCAS(), getType(aCover.getCAS(), Token.class), aCover); }