private static boolean getIfThereIsDependency(Collection<AnnotationFS> col) { for (AnnotationFS annotationFS : col) { Type type = annotationFS.getType(); String typeShortName = type.getShortName(); if(typeShortName.equals("Dependency")) return true; } return false; }
private boolean checkType(AnnotationFS anno) { if (targetType == null) { return true; } return ts.subsumes(targetType, anno.getType()); } }
/** * Set the link following the current link. */ private void setNextLink(AnnotationFS aLink, AnnotationFS aNext) { aLink.setFeatureValue( aLink.getType().getFeatureByBaseName(linkNextFeatureName), aNext); }
/** * Get the link following the current link. */ private AnnotationFS getNextLink(AnnotationFS aLink) { return (AnnotationFS) aLink.getFeatureValue(aLink.getType().getFeatureByBaseName( linkNextFeatureName)); }
/** * {@inheritDoc} */ @Override public void onSpurious(AnnotationFS sysAnno) { if (!partiallyMatched.contains(sysAnno)) { printRow(sysAnno.getType().getShortName(), "Spurious", null, null, annoPrinter.getString(sysAnno), String.valueOf(sysAnno.getBegin()), currentDocUri); } }
/** * Set the link following the current link. */ private void setNextLink(AnnotationFS aLink, AnnotationFS aNext) { aLink.setFeatureValue( aLink.getType().getFeatureByBaseName(getLinkNextFeatureName()), aNext); }
/** * Set the link following the current link. */ private void setNextLink(AnnotationFS aLink, AnnotationFS aNext) { aLink.setFeatureValue( aLink.getType().getFeatureByBaseName(getLinkNextFeatureName()), aNext); }
/** * Get the link following the current link. */ private AnnotationFS getNextLink(AnnotationFS aLink) { return (AnnotationFS) aLink.getFeatureValue(aLink.getType().getFeatureByBaseName( getLinkNextFeatureName())); }
/** * Initializes a new instance. * * @param annotation the annotation */ public EclipseAnnotationPeer(AnnotationFS annotation) { super(annotation.getType().getName(), false, ""); this.annotation = annotation; setText(annotation.getCoveredText()); }
@Override protected void addedAnnotation(Collection<AnnotationFS> annotations) { for (AnnotationFS annotation : annotations) { String name = annotation.getType().getName(); AnnotationTypeTreeNode typeNode = nameAnnotationTypeNodeMap .get(name); AnnotationTreeNode annotationNode = new AnnotationTreeNode(mInputDocument, annotation); typeNode.add(annotationNode); viewer.add(typeNode, annotationNode); } }
/** * Get the link following the current link. */ private AnnotationFS getNextLink(AnnotationFS aLink) { return (AnnotationFS) aLink.getFeatureValue(aLink.getType().getFeatureByBaseName( getLinkNextFeatureName())); }
private static Stream<AnnotationFS> getMergeFS(AnnotationFS aOldFs, JCas aJCas) { return selectCovered(aJCas.getCas(), aOldFs.getType(), aOldFs.getBegin(), aOldFs.getEnd()) .stream().filter(fs -> isSameAnno(fs, aOldFs)); }
private static Stream<AnnotationFS> getMergeFS(AnnotationFS aOldFs, JCas aJCas) { return selectCovered(aJCas.getCas(), aOldFs.getType(), aOldFs.getBegin(), aOldFs.getEnd()) .stream().filter(fs -> isSameAnno(fs, aOldFs)); }
/** * {@inheritDoc} */ @Override public void onMissing(AnnotationFS goldAnno) { printRow(goldAnno.getType().getShortName(), "Missing", annoPrinter.getString(goldAnno), String.valueOf(goldAnno.getBegin()), null, null, currentDocUri); }
private static List<AnnotationFS> getRelAnnosOnPosition(AnnotationFS aFs, AnnotationFS aOriginFs, AnnotationFS aTargetFs, JCas aJcas) { Type type = aFs.getType(); Feature sourceFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_SOURCE); Feature targetFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_TARGET); return selectCovered(aJcas.getCas(), type, aFs.getBegin(), aFs.getEnd()).stream() .filter(fs -> fs.getFeatureValue(sourceFeat).equals(aOriginFs) && fs.getFeatureValue(targetFeat).equals(aTargetFs)) .collect(Collectors.toList()); }
@Override public ScriptApply apply(RutaStream stream, InferenceCrowd crowd) { CAS cas = stream.getCas(); AnnotationFS documentAnnotation = cas.getDocumentAnnotation(); RutaStream completeStream = stream.getWindowStream(documentAnnotation, documentAnnotation.getType()); ScriptApply result = super.apply(completeStream, crowd); return result; }
private static List<AnnotationFS> getRelAnnosOnPosition(AnnotationFS aFs, AnnotationFS aOriginFs, AnnotationFS aTargetFs, JCas aJcas) { Type type = aFs.getType(); Feature sourceFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_SOURCE); Feature targetFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_TARGET); return selectCovered(aJcas.getCas(), type, aFs.getBegin(), aFs.getEnd()).stream() .filter(fs -> fs.getFeatureValue(sourceFeat).equals(aOriginFs) && fs.getFeatureValue(targetFeat).equals(aTargetFs)) .collect(Collectors.toList()); }
@Override public List<String> getAnnotation(JCas aJcas, AnnotationFeature aFeature, int begin, int end) { Type type = getType(aJcas.getCas(), getAnnotationTypeName()); List<String> annotations = new ArrayList<String>(); for (AnnotationFS fs : selectCovered(aJcas.getCas(), type, begin, end)) { Feature labelFeature = fs.getType().getFeatureByBaseName(aFeature.getName()); annotations.add(fs.getFeatureValueAsString(labelFeature)); } return annotations; }
private boolean equalsAnnotationFS(AnnotationFS aFS1, AnnotationFS aFS2) { // Null check if (aFS1 == null || aFS2 == null) { return false; } // Position check DiffAdapter adapter = getAdapter(aFS1.getType().getName()); Position pos1 = adapter.getPosition(0, aFS1); Position pos2 = adapter.getPosition(0, aFS2); return pos1.compareTo(pos2) == 0; }
@Override public EvaluatedCondition eval(MatchContext context, RutaStream stream, InferenceCrowd crowd) { AnnotationFS annotation = context.getAnnotation(); String typeWithFeature = annotation.getType().getName() + "." + featureStringExpression.getStringValue(context, stream); MatchReference mf = new MatchReference(typeWithFeature); FeatureMatchExpression fme = new FeatureMatchExpression(mf, "==", argExpr); boolean checkFeatureValue = fme.checkFeatureValue(annotation, context, stream); return new EvaluatedCondition(this, checkFeatureValue); }