本文整理汇总了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);
}
}
示例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);
}
示例3: apply
import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Override
public String apply(AnnotationFS anno) {
if (anno == null) {
return null;
}
return anno.getCoveredText();
}
示例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);
}
示例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);
}
示例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);
}
示例7: getString
import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String getString(AnnotationFS anno) {
return anno == null ? null : anno.getCoveredText();
}
示例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);
}
示例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);
}
示例10: isAbbreviation
import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
private boolean isAbbreviation(AnnotationFS coveringAnnotation) {
String string = coveringAnnotation.getCoveredText();
return isAbbreviation(string);
}