本文整理了Java中org.apache.uima.cas.text.AnnotationFS.setStringValue()
方法的一些代码示例,展示了AnnotationFS.setStringValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotationFS.setStringValue()
方法的具体详情如下:
包路径:org.apache.uima.cas.text.AnnotationFS
类名称:AnnotationFS
方法名:setStringValue
暂无
代码示例来源:origin: apache/opennlp
final AnnotationFS tokenAnnotation = sentenceTokenIterator.next();
tokenAnnotation.setStringValue(this.posFeature, posTag);
代码示例来源:origin: apache/opennlp
private void addChunkAnnotation(CAS tcas, AnnotationFS[] tokenAnnotations,
String tag, int start, int end) {
AnnotationFS chunk = tcas.createAnnotation(mChunkType,
tokenAnnotations[start].getBegin(), tokenAnnotations[end - 1].getEnd());
chunk.setStringValue(mChunkFeature, tag);
tcas.getIndexRepository().addFS(chunk);
}
代码示例来源:origin: apache/opennlp
@Override
protected void setBestCategory(CAS tcas, String bestCategory) {
FSIndex<AnnotationFS> categoryIndex = tcas.getAnnotationIndex(mCategoryType);
AnnotationFS categoryAnnotation;
if (categoryIndex.size() > 0) {
categoryAnnotation = categoryIndex.iterator().next();
} else {
categoryAnnotation = tcas.createAnnotation(mCategoryType, 0,
tcas.getDocumentText().length());
tcas.getIndexRepository().addFS(categoryAnnotation);
}
categoryAnnotation.setStringValue(mCategoryFeature, bestCategory);
}
}
代码示例来源:origin: apache/opennlp
nameAnnotation.setStringValue(mStructureFeature, text);
} else {
代码示例来源:origin: apache/opennlp
protected AnnotationFS createAnnotation(CAS cas, int offset, Parse parse) {
Parse[] parseChildren = parse.getChildren();
AnnotationFS[] parseChildAnnotations = new AnnotationFS[parseChildren.length];
// do this for all children
for (int i = 0; i < parseChildren.length; i++) {
parseChildAnnotations[i] = createAnnotation(cas, offset, parseChildren[i]);
}
AnnotationFS parseAnnotation = cas.createAnnotation(mParseType, offset +
parse.getSpan().getStart(), offset + parse.getSpan().getEnd());
parseAnnotation.setStringValue(mTypeFeature, parse.getType());
if (probabilityFeature != null) {
parseAnnotation.setDoubleValue(probabilityFeature, parse.getProb());
}
ArrayFS childrenArray = cas.createArrayFS(parseChildAnnotations.length);
childrenArray.copyFromArray(parseChildAnnotations, 0, 0, parseChildAnnotations.length);
parseAnnotation.setFeatureValue(childrenFeature, childrenArray);
cas.getIndexRepository().addFS(parseAnnotation);
return parseAnnotation;
}
代码示例来源:origin: dkpro/dkpro-core
private void chunkComplete()
{
if (openChunk != null) {
Type chunkType = mappingProvider.getTagType(openChunk);
AnnotationFS chunk = cas.createAnnotation(chunkType, start, end);
chunk.setStringValue(chunkValue,
internTags && openChunk != null ? openChunk.intern() : openChunk);
cas.addFsToIndexes(chunk);
openChunk = null;
}
}
}
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.api.io-asl
private void chunkComplete()
{
if (openChunk != null) {
Type chunkType = mappingProvider.getTagType(openChunk);
AnnotationFS chunk = cas.createAnnotation(chunkType, start, end);
chunk.setStringValue(chunkValue,
internTags && openChunk != null ? openChunk.intern() : openChunk);
cas.addFsToIndexes(chunk);
openChunk = null;
}
}
}
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.api.io-asl
private void chunkComplete()
{
if (openChunk != null) {
Type chunkType = mappingProvider.getTagType(openChunk);
AnnotationFS chunk = cas.createAnnotation(chunkType, start, end);
chunk.setStringValue(chunkValue,
internTags && openChunk != null ? openChunk.intern() : openChunk);
cas.addFsToIndexes(chunk);
openChunk = null;
}
}
}
代码示例来源:origin: dkpro/dkpro-core
private void chunkComplete()
{
if (openChunk != null) {
Type chunkType = mappingProvider.getTagType(openChunk);
AnnotationFS chunk = cas.createAnnotation(chunkType, start, end);
chunk.setStringValue(chunkValue,
internTags && openChunk != null ? openChunk.intern() : openChunk);
cas.addFsToIndexes(chunk);
openChunk = null;
}
}
}
代码示例来源:origin: fr.univ-nantes.julestar/uima-tree-tagger-wrapper
private void annotate(CAS cas, Feature feature, int begin, int end, String value) {
Type type = feature.getDomain();
AnnotationFS annotation = cas.createAnnotation(type, begin, end);
annotation.setStringValue(feature,value);
cas.addFsToIndexes(annotation);
}
代码示例来源:origin: CLLKazan/UIMA-Ext
private void setDocumentMetadata(CAS cas, String docName, int docSize) {
AnnotationFS docMeta = cas.createAnnotation(documentMetadataType, 0, 0);
docMeta.setLongValue(docMetaSizeFeature, docSize);
docMeta.setStringValue(docMetaUriFeature, docName);
cas.addFsToIndexes(docMeta);
}
代码示例来源:origin: org.apache.uima/ruta-core
@Override
public void visitRemarkNode(Remark node) {
Type type = getType("REMARK", cas);
int begin = getBeginOffset(node);
int end = getEndOffset(node);
AnnotationFS annotation = cas.createAnnotation(type, begin, end);
Feature feature = type.getFeatureByBaseName("comment");
annotation.setStringValue(feature, node.getText());
annotations.add(annotation);
}
代码示例来源:origin: org.apache.uima/textmarker-core
public void visitRemarkNode(Remark node) {
Type type = getType("REMARK", cas);
int begin = getBeginOffset(node);
int end = getEndOffset(node);
AnnotationFS annotation = cas.createAnnotation(type, begin, end);
Feature feature = type.getFeatureByBaseName("comment");
annotation.setStringValue(feature, node.getText());
annotations.add(annotation);
}
代码示例来源:origin: nlpie/biomedicus
@Override
public void wroteToDestination(String destinationName,
int destinationIndex,
TextRange originalDocumentTextLocation) {
AnnotationFS viewIndex = originalDocumentView
.createAnnotation(viewIndexType, originalDocumentTextLocation.getStartIndex(),
originalDocumentTextLocation.getEndIndex());
viewIndex.setStringValue(destinationNameFeature, destinationName);
viewIndex.setIntValue(destinationIndexFeature, destinationIndex);
originalDocumentView.addFsToIndexes(viewIndex);
}
}
代码示例来源:origin: org.apache.opennlp/opennlp-uima
private void addChunkAnnotation(CAS tcas, AnnotationFS[] tokenAnnotations,
String tag, int start, int end) {
AnnotationFS chunk = tcas.createAnnotation(mChunkType,
tokenAnnotations[start].getBegin(), tokenAnnotations[end - 1].getEnd());
chunk.setStringValue(mChunkFeature, tag);
tcas.getIndexRepository().addFS(chunk);
}
代码示例来源:origin: org.apache.uima/textmarker-core
public static void addSourceDocumentInformation(CAS cas, File each) {
Type sdiType = cas.getTypeSystem()
.getType("org.apache.uima.examples.SourceDocumentInformation");
if (sdiType != null) {
if (cas.getAnnotationIndex(sdiType).size() == 0) {
AnnotationFS sdi = cas.createAnnotation(sdiType, cas.getDocumentAnnotation().getBegin(),
cas.getDocumentAnnotation().getEnd());
Feature uriFeature = sdiType.getFeatureByBaseName("uri");
sdi.setStringValue(uriFeature, each.toURI().getPath());
cas.addFsToIndexes(sdi);
}
}
}
代码示例来源:origin: webanno/webanno
private AnnotationFS createNEAnno(JCas aJCas, String aValue, int aBegin, int aEnd)
{
Type type = aJCas.getTypeSystem().getType(NamedEntity.class.getTypeName());
AnnotationFS clickedFs = aJCas.getCas().createAnnotation(type, aBegin, aEnd);
Feature value = type.getFeatureByBaseName("value");
clickedFs.setStringValue(value, aValue);
aJCas.addFsToIndexes(clickedFs);
return clickedFs;
}
代码示例来源:origin: webanno/webanno
private AnnotationFS createPOSAnno(JCas aJCas, String aValue, int aBegin, int aEnd)
{
Type type = aJCas.getTypeSystem().getType(POS.class.getTypeName());
AnnotationFS clickedFs = aJCas.getCas().createAnnotation(type, aBegin, aEnd);
Feature posValue = type.getFeatureByBaseName("PosValue");
clickedFs.setStringValue(posValue, aValue);
aJCas.addFsToIndexes(clickedFs);
return clickedFs;
}
代码示例来源:origin: webanno/webanno
public static AnnotationFS makeLinkHostMultiSPanFeatureFS(JCas aJCas, int aBegin, int aEnd,
Feature aSpanFeature, String aValue, FeatureStructure... aLinks)
{
Type hostType = aJCas.getTypeSystem().getType(HOST_TYPE);
AnnotationFS hostA1 = aJCas.getCas().createAnnotation(hostType, aBegin, aEnd);
hostA1.setFeatureValue(hostType.getFeatureByBaseName("links"),
FSCollectionFactory.createFSArray(aJCas, asList(aLinks)));
hostA1.setStringValue(aSpanFeature, aValue);
aJCas.getCas().addFsToIndexes(hostA1);
return hostA1;
}
代码示例来源:origin: webanno/webanno
public static AnnotationFS makeLinkHostMultiSPanFeatureFS(JCas aJCas, int aBegin, int aEnd,
Feature aSpanFeature, String aValue, FeatureStructure... aLinks)
{
Type hostType = aJCas.getTypeSystem().getType(HOST_TYPE);
AnnotationFS hostA1 = aJCas.getCas().createAnnotation(hostType, aBegin, aEnd);
hostA1.setFeatureValue(hostType.getFeatureByBaseName("links"),
FSCollectionFactory.createFSArray(aJCas, asList(aLinks)));
hostA1.setStringValue(aSpanFeature, aValue);
aJCas.getCas().addFsToIndexes(hostA1);
return hostA1;
}
内容来源于网络,如有侵权,请联系作者删除!