当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationFS.getCoveredText方法代码示例

本文整理汇总了Java中org.apache.uima.cas.text.AnnotationFS.getCoveredText方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationFS.getCoveredText方法的具体用法?Java AnnotationFS.getCoveredText怎么用?Java AnnotationFS.getCoveredText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.uima.cas.text.AnnotationFS的用法示例。


在下文中一共展示了AnnotationFS.getCoveredText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Override
public void process(CAS cas) throws AnalysisEngineProcessException {
    String docUriStr = DocumentUtils.getDocumentUri(cas);
    if (docUriStr == null) {
        throw new IllegalStateException("Can't extract document URI");
    }
    Path docUriPath = IoUtils.extractPathFromURI(docUriStr);
    if (docUriPath.isAbsolute()) {
        docUriPath = Paths.get("/").relativize(docUriPath);
    }
    Path outputPath = outputDir.resolve(docUriPath);
    outputPath = IoUtils.addExtension(outputPath, outputFileSuffix);
    try (PrintWriter out = IoUtils.openPrintWriter(outputPath.toFile())) {
        for (AnnotationFS anno : CasUtil.select(cas, targetType)) {
            String text = anno.getCoveredText();
            text = StringUtils.replaceChars(text, "\r\n", "  ");
            out.println(text);
        }
    } catch (IOException e) {
        throw new AnalysisEngineProcessException(e);
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:23,代码来源:AnnotationPerLineWriter.java

示例2: mapEvent

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
private void mapEvent(UimaBratEventMapping evMapping, AnnotationFS uEvent) {
    if (context.isMapped(uEvent)) {
        return;
    }
    BratEventType bType = evMapping.bratType;
    // use UIMA event annotation boundaries as Brat event trigger boundaries
    BratEventTrigger trigger = new BratEventTrigger(bType,
            uEvent.getBegin(), uEvent.getEnd(), uEvent.getCoveredText());
    // assign id to trigger
    trigger = bac.register(trigger);
    // fill slots
    Multimap<String, BratAnnotation<?>> roleAnnotations = makeRoleMap(
            uEvent, bType, evMapping.roleFeatures);
    // create
    BratEvent bEvent = new BratEvent(bType, trigger, roleAnnotations);
    // assign id
    bEvent = bac.register(bEvent);
    // map to note
    mapNotes(evMapping, bEvent, uEvent);
    // memorize
    context.mapped(uEvent, bEvent);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:23,代码来源:UIMA2BratAnnotator.java

示例3: apply

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Override
public String apply(AnnotationFS anno) {
    if (anno == null) {
        return null;
    }
    return anno.getCoveredText();
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:8,代码来源:AnnotationUtils.java

示例4: mapEntity

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
private void mapEntity(UimaBratEntityMapping entMapping, AnnotationFS uEntity) {
    if (context.isMapped(uEntity)) {
        return;
    }
    BratEntityType bType = entMapping.bratType;
    // create brat annotation instance
    BratEntity bEntity = new BratEntity(bType,
            uEntity.getBegin(), uEntity.getEnd(), uEntity.getCoveredText());
    // add to container - it assigns ID
    bEntity = bac.register(bEntity);
    // map to note
    mapNotes(entMapping, bEntity, uEntity);
    // memorize
    context.mapped(uEntity, bEntity);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:16,代码来源:UIMA2BratAnnotator.java

示例5: selectArc

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
public void selectArc(VID aVid, AnnotationFS aOriginFs, AnnotationFS aTargetFs)
{
    arc = true;
    selectedAnnotationId = aVid;
    text = "[" + aOriginFs.getCoveredText() + "] - [" + aTargetFs.getCoveredText() + "]";
    beginOffset = Math.min(aOriginFs.getBegin(), aTargetFs.getBegin());
    endOffset = Math.max(aOriginFs.getEnd(), aTargetFs.getEnd());
    
    // Properties used when an arc is selected
    originSpanId = getAddr(aOriginFs);
    targetSpanId = getAddr(aTargetFs);
    
    LOG.debug("Arc: {}", this);
}
 
开发者ID:webanno,项目名称:webanno,代码行数:15,代码来源:Selection.java

示例6: getPosition

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Override
public Position getPosition(int aCasId, FeatureStructure aFS, String aFeature, String aRole,
        int aLinkTargetBegin, int aLinkTargetEnd, LinkCompareBehavior aLinkCompareBehavior)
{
    AnnotationFS annoFS = (AnnotationFS) aFS;
    
    String collectionId = null;
    String documentId = null;
    try {
        DocumentMetaData dmd = DocumentMetaData.get(aFS.getCAS());
        collectionId = dmd.getCollectionId();
        documentId = dmd.getDocumentId();
    }
    catch (IllegalArgumentException e) {
        // We use this information only for debugging - so we can ignore if the information
        // is missing.
    }
    
    String linkTargetText = null;
    if (aLinkTargetBegin != -1 && aFS.getCAS().getDocumentText() != null) {
        linkTargetText = aFS.getCAS().getDocumentText()
                .substring(aLinkTargetBegin, aLinkTargetEnd);
    }
    
    return new SpanPosition(collectionId, documentId, aCasId, getType(), annoFS.getBegin(),
            annoFS.getEnd(), annoFS.getCoveredText(), aFeature, aRole, aLinkTargetBegin,
            aLinkTargetEnd, linkTargetText, aLinkCompareBehavior);
}
 
开发者ID:webanno,项目名称:webanno,代码行数:29,代码来源:CasDiff2.java

示例7: getString

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String getString(AnnotationFS anno) {
    return anno == null ? null : anno.getCoveredText();
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:8,代码来源:CoveredTextAnnotationPrinter.java

示例8: isLeftQM

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
public static boolean isLeftQM(AnnotationFS anno) {
    String chars = anno.getCoveredText();
    return undirectedQMs.contains(chars) || leftQMs.contains(chars);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:5,代码来源:SegmentationUtils.java

示例9: isRightQM

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
public static boolean isRightQM(AnnotationFS anno) {
    String chars = anno.getCoveredText();
    return undirectedQMs.contains(chars) || rightQMs.contains(chars);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:5,代码来源:SegmentationUtils.java

示例10: isAbbreviation

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
private boolean isAbbreviation(AnnotationFS coveringAnnotation) {
	String string = coveringAnnotation.getCoveredText();
	return isAbbreviation(string);
}
 
开发者ID:nantesnlp,项目名称:uima-tokenizer,代码行数:5,代码来源:Lexer.java


注:本文中的org.apache.uima.cas.text.AnnotationFS.getCoveredText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。