org.apache.uima.cas.text.AnnotationFS.getType()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.apache.uima.cas.text.AnnotationFS.getType()方法的一些代码示例,展示了AnnotationFS.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotationFS.getType()方法的具体详情如下:
包路径:org.apache.uima.cas.text.AnnotationFS
类名称:AnnotationFS
方法名:getType

AnnotationFS.getType介绍

暂无

代码示例

代码示例来源:origin: hltfbk/Excitement-Open-Platform

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;
}

代码示例来源:origin: CLLKazan/UIMA-Ext

private boolean checkType(AnnotationFS anno) {
    if (targetType == null) {
      return true;
    }
    return ts.subsumes(targetType, anno.getType());
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat

/**
 * Set the link following the current link.
 */
private void setNextLink(AnnotationFS aLink, AnnotationFS aNext)
{
  aLink.setFeatureValue(
      aLink.getType().getFeatureByBaseName(linkNextFeatureName), aNext);
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat

/**
 * Get the link following the current link.
 */
private AnnotationFS getNextLink(AnnotationFS aLink)
{
  return (AnnotationFS) aLink.getFeatureValue(aLink.getType().getFeatureByBaseName(
      linkNextFeatureName));
}

代码示例来源:origin: CLLKazan/UIMA-Ext

/**
 * {@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);
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-annotation

/**
 * Set the link following the current link.
 */
private void setNextLink(AnnotationFS aLink, AnnotationFS aNext)
{
  aLink.setFeatureValue(
      aLink.getType().getFeatureByBaseName(getLinkNextFeatureName()), aNext);
}

代码示例来源:origin: webanno/webanno

/**
 * Set the link following the current link.
 */
private void setNextLink(AnnotationFS aLink, AnnotationFS aNext)
{
  aLink.setFeatureValue(
      aLink.getType().getFeatureByBaseName(getLinkNextFeatureName()), aNext);
}

代码示例来源:origin: webanno/webanno

/**
 * Get the link following the current link.
 */
private AnnotationFS getNextLink(AnnotationFS aLink)
{
  return (AnnotationFS) aLink.getFeatureValue(aLink.getType().getFeatureByBaseName(
      getLinkNextFeatureName()));
}

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

/**
 * Initializes a new instance.
 *
 * @param annotation the annotation
 */
public EclipseAnnotationPeer(AnnotationFS annotation) {
 super(annotation.getType().getName(), false, "");
 this.annotation = annotation;
 setText(annotation.getCoveredText());
}

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

@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);
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-annotation

/**
 * Get the link following the current link.
 */
private AnnotationFS getNextLink(AnnotationFS aLink)
{
  return (AnnotationFS) aLink.getFeatureValue(aLink.getType().getFeatureByBaseName(
      getLinkNextFeatureName()));
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-ui-curation

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));
}

代码示例来源:origin: webanno/webanno

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));
}

代码示例来源:origin: CLLKazan/UIMA-Ext

/**
 * {@inheritDoc}
 */
@Override
public void onMissing(AnnotationFS goldAnno) {
  printRow(goldAnno.getType().getShortName(), "Missing",
      annoPrinter.getString(goldAnno), String.valueOf(goldAnno.getBegin()),
      null, null, currentDocUri);
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-ui-curation

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());
}

代码示例来源:origin: org.apache.uima/ruta-core-ext

@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;
}

代码示例来源:origin: webanno/webanno

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());
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat

@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;
}

代码示例来源:origin: webanno/webanno

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;
}

代码示例来源:origin: org.apache.uima/ruta-core

@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);
}

相关文章