org.apache.uima.jcas.tcas.Annotation.getCoveredText()方法的使用及代码示例

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

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

Annotation.getCoveredText介绍

暂无

代码示例

代码示例来源:origin: org.apache.ctakes/ctakes-dictionary-lookup

/**
  * {@inheritDoc}
  */
  @Override
  public String getText() {
   return _jcasAnnotation.getCoveredText();
  }
}

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

public static boolean isFamilyTerm(Annotation arg) {
  return arg.getCoveredText().toLowerCase()
  .matches("(father|dad|mother|mom|bro|sis|sib|cousin|aunt|uncle|grandm|grandp|grandf|" +
      "wife|spouse|husband|child|offspring|progeny|son|daughter|nephew|niece|kin|family).*");
}

代码示例来源:origin: org.apache.ctakes/ctakes-drug-ner

private boolean findCoveredTextInSpan(JCas jcas, int annotationType, int beginOffset, int endOffset, String[] searchStrs)
{
  boolean foundCoveredText = false;
  Iterator coveredTextIter = FSUtil.getAnnotationsIteratorInSpan(jcas, annotationType, beginOffset, endOffset);
  while (coveredTextIter.hasNext() && !foundCoveredText)
  {
    Annotation ann= (Annotation) coveredTextIter.next();
    for(int i=0; i<searchStrs.length && !foundCoveredText; i++)
      foundCoveredText = searchStrs[i].equals(ann.getCoveredText());
  }
  return foundCoveredText;
}

代码示例来源:origin: de.unistuttgart.ims/cleartk-util

public List<Feature> extract(JCas view, T focusAnnotation) throws CleartkExtractorException {
    String surf = focusAnnotation.getCoveredText();
    boolean b = Character.isUpperCase(surf.charAt(0)) && surf.endsWith(suf);
    return Arrays.asList(new Feature("Suffix_" + suf, String.valueOf(b)));
  }
}

代码示例来源:origin: org.apache.ctakes/ctakes-relation-extractor

/**
 * Given an annotation, retrieve its last word.
 */
public static String getLastWord(JCas systemView, Annotation annotation) {
 
 List<WordToken> tokens = JCasUtil.selectCovered(systemView, WordToken.class, annotation);
 if(tokens.size() == 0) {
    return annotation.getCoveredText();
 }
 
 WordToken lastToken = tokens.get(tokens.size() - 1);
 return lastToken.getCoveredText();
}

代码示例来源:origin: fr.univ-nantes.julestar/uima-test

private String toString(Annotation a) {
  return String.format("%s[%d,%d]{%s}", 
      a.getClass().getSimpleName(),
      a.getBegin(), a.getEnd(),
      a.getCoveredText());
}

代码示例来源:origin: org.apache.ctakes/ctakes-dependency-parser

/** Equality expressions to aid in converting between DepNodes and CAS objects */
public static boolean equalCoverage(Annotation annot1,Annotation annot2) {
  if (annot1==null || annot2==null) 
    return false;
  return annot1.getBegin()==annot2.getBegin() && 
    annot1.getEnd()==annot2.getEnd() && 
    annot1.getCoveredText().equals(annot2.getCoveredText());
}

代码示例来源:origin: org.apache.ctakes/ctakes-dependency-parser

/** Checks if one annotation subsumes another */
public static boolean doesSubsume(Annotation annot1,Annotation annot2) {
  if (annot1==null || annot2==null) 
    return false;
  return annot1.getBegin()<=annot2.getBegin() && 
    annot1.getEnd()>=annot2.getEnd() && 
    annot1.getCoveredText().contains(annot2.getCoveredText());
}

代码示例来源:origin: uk.gov.dstl.baleen/baleen-uima

@Override
public String text() {
 if (getItem() == null) {
  return "";
 } else {
  return getItem().getCoveredText();
 }
}

代码示例来源:origin: org.apache.ctakes/ctakes-dependency-parser

/** Equality expressions to aid in converting between DepNodes and CAS objects */
  public static boolean equalCoverage(Annotation annot1,Annotation annot2) {
    return annot1.getBegin()==annot2.getBegin() && 
      annot1.getEnd()==annot2.getEnd() && 
      annot1.getCoveredText()==annot2.getCoveredText();
  }
//    public static boolean equalCoverage(Annotation annot,UimaDepNode udNode) {

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

static String format(Annotation ann) {
 String result;
 if (ann.getEnd() == Integer.MIN_VALUE || ann.getBegin() == Integer.MAX_VALUE) {
  result = "<no-spanned-text>";
 } else {
  result = String.format("\"%s\"[%d,%d]", ann.getCoveredText(), ann.getBegin(), ann.getEnd());
 }
 return String.format("%s(%s)", ann.getClass().getSimpleName(), result);
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.wsd/de.tudarmstadt.ukp.dkpro.wsd.core

@Override
protected Map<String, Double> getDisambiguation(JCas aJCas,
    WSDItem wsdItem, Annotation context)
  throws SenseInventoryException
{
  // TODO: Currently this just passes the covered text as the context.
  // It might be better to pass a collection of annotations (for example,
  // lemmas)
  return wsdMethod.getDisambiguation(
      wsdItem.getSubjectOfDisambiguation(), context.getCoveredText());
}

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

static String format(Annotation ann) {
 String result;
 if (ann.getEnd() == Integer.MIN_VALUE || ann.getBegin() == Integer.MAX_VALUE) {
  result = "<no-spanned-text>";
 } else {
  result = String.format("\"%s\"[%d,%d]", ann.getCoveredText(), ann.getBegin(), ann.getEnd());
 }
 return String.format("%s(%s)", ann.getClass().getSimpleName(), result);
}

代码示例来源:origin: ClearTK/cleartk

@Override
public List<Feature> extract(JCas view, Annotation focusAnnotation)
  throws CleartkExtractorException {
 String text = focusAnnotation.getCoveredText();
 return ccpf.apply(new Feature(null, text));
}

代码示例来源:origin: org.apache.ctakes/ctakes-dictionary-lookup-fast

public FastLookupToken( final Annotation jcasAnnotation ) {
 _textSpan = new DefaultTextSpan( jcasAnnotation.getBegin(), jcasAnnotation.getEnd() );
 _text = jcasAnnotation.getCoveredText().toLowerCase();
 if ( jcasAnnotation instanceof WordToken ) {
   final String canonicalForm = ((WordToken)jcasAnnotation).getCanonicalForm();
   // If canonical is not null AND not the same as the plain text then it is a valid variant for lookup
   if ( canonicalForm != null && !canonicalForm.equals( _text ) ) {
    _variant = canonicalForm;
   }
 }
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

public PairAttributeCalculator (JCas jcas, Markable m1, Markable m2) {
  super(jcas);
  this.m1 = m1;
  this.m2 = m2;
  this.a1 = m1.getContent();
  this.a2 = m2.getContent();
  ms1 = m1.getCoveredText();
  ms2 = m2.getCoveredText();
  es1 = a1.getCoveredText();
  es2 = a2.getCoveredText();
  alias = isAlias();
}

代码示例来源:origin: org.cleartk/cleartk-util

@Override
public void process(JCas jCas) throws AnalysisEngineProcessException {
 if (windowClass != null) {
  for (Annotation window : JCasUtil.select(jCas, windowClass)) {
   String text = window.getCoveredText();
   createParentheticals(jCas, text, window.getBegin());
  }
 } else {
  String text = jCas.getDocumentText();
  createParentheticals(jCas, text, 0);
 }
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.wsd/de.tudarmstadt.ukp.dkpro.wsd.core

@Override
protected Map<String, Double> getDisambiguation(JCas aJCas,
    WSDItem wsdItem, Annotation context)
  throws SenseInventoryException
{
  // TODO: Currently this just passes the covered text as the context.
  // It might be better to pass a collection of annotations (for example,
  // lemmas)
  return wsdMethod.getDisambiguation(
      wsdItem.getSubjectOfDisambiguation(),
      POS.valueOf(wsdItem.getPos()), context.getCoveredText());
}

代码示例来源:origin: fr.univ-nantes.julestar/uima-test

public CasAssert doesNotContainAnnotation(Type annotationType, int begin, int end) {
  for(Annotation a:getAnnotationList(annotationType)) 
    if(a.getBegin() == begin && a.getEnd() == end)
      failWithMessage("Expected to not contain annotation <%s[%s,%s]> but actually contains it:  <%s>",
          annotationType.getShortName(),begin, end,
          a.getCoveredText()
          );
  return this;
}

代码示例来源:origin: org.dkpro.argumentation/dkpro-argumentation-io

@Override
public ImmutableSpanTextLabel apply(final Annotation annotation)
{
  final ImmutableSpan span = new ImmutableSpan(annotation.getBegin(), annotation.getEnd());
  final ImmutableSpanText spanText = new ImmutableSpanText(span, annotation.getCoveredText());
  final Map<Attribute, Object> attrs = createAttrMap(annotation);
  return new ImmutableSpanTextLabel(spanText, annotation.getType().getShortName(), attrs);
}

相关文章