org.apache.uima.fit.util.FSUtil.setFeature()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(89)

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

FSUtil.setFeature介绍

暂无

代码示例

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

private static AnnotationFS makeChainLink(Type aType, CAS aCas,
    int aBegin, int aEnd, String aLabel, String aLinkLabel, AnnotationFS aNext)
{
  AnnotationFS link = aCas.createAnnotation(aType, aBegin, aEnd);
  FSUtil.setFeature(link, "next", aNext);
  FSUtil.setFeature(link, "referenceType", aLabel);
  FSUtil.setFeature(link, "referenceRelation", aLinkLabel);
  aCas.addFsToIndexes(link);
  return link;
}

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

@Test
public void testSingleTokenRelationWithMultipleFeatureValues() throws Exception
{
  JCas jcas = makeJCasOneSentence();
  CAS cas = jcas.getCas();
  
  List<Token> tokens = new ArrayList<>(select(jcas, Token.class));
  
  Token gov = tokens.get(0);
  Token dep = tokens.get(tokens.size() - 1);
  Type relationType = cas.getTypeSystem().getType("webanno.custom.ComplexRelation");
  
  // One at the beginning
  // WebAnno legacy conventions
  // AnnotationFS fs1 = cas.createAnnotation(relationType, 
  //      min(dep.getBegin(), gov.getBegin()),
  //      max(dep.getEnd(), gov.getEnd()));
  // DKPro Core conventions
  AnnotationFS fs1 = cas.createAnnotation(relationType, dep.getBegin(), dep.getEnd());
  FSUtil.setFeature(fs1, "Governor", gov);
  FSUtil.setFeature(fs1, "Dependent", dep);
  FSUtil.setFeature(fs1, "value", "nsubj");
  FSUtil.setFeature(fs1, "boolValue", true);
  FSUtil.setFeature(fs1, "integerValue", 42);
  cas.addFsToIndexes(fs1);
  
  writeAndAssertEquals(jcas, 
      WebannoTsv3Writer.PARAM_RELATION_LAYERS, asList("webanno.custom.ComplexRelation"));
}

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

private static void makeChainHead(Type aType, AnnotationFS first)
{
  CAS cas = first.getCAS();
  FeatureStructure h = cas.createFS(aType);
  FSUtil.setFeature(h, "first", first);
  cas.addFsToIndexes(h);
}

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

@Test
public void testSingleTokenRelationWithFeatureValue() throws Exception
{
  JCas jcas = makeJCasOneSentence();
  CAS cas = jcas.getCas();
  
  List<Token> tokens = new ArrayList<>(select(jcas, Token.class));
  
  Token gov = tokens.get(0);
  Token dep = tokens.get(tokens.size() - 1);
  Type relationType = cas.getTypeSystem().getType("webanno.custom.Relation");
  
  // One at the beginning
  // WebAnno legacy conventions
  // AnnotationFS fs1 = cas.createAnnotation(relationType, 
  //         min(dep.getBegin(), gov.getBegin()),
  //         max(dep.getEnd(), gov.getEnd()));
  // DKPro Core conventions
  AnnotationFS fs1 = cas.createAnnotation(relationType, dep.getBegin(), dep.getEnd());
  FSUtil.setFeature(fs1, "Governor", gov);
  FSUtil.setFeature(fs1, "Dependent", dep);
  FSUtil.setFeature(fs1, "value", "nsubj");
  cas.addFsToIndexes(fs1);
  
  writeAndAssertEquals(jcas, 
      WebannoTsv3Writer.PARAM_RELATION_LAYERS, asList("webanno.custom.Relation"));
}

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

@Test
public void testSingleTokenRelationWithoutFeatureValue() throws Exception
{
  JCas jcas = makeJCasOneSentence();
  CAS cas = jcas.getCas();
  
  List<Token> tokens = new ArrayList<>(select(jcas, Token.class));
  
  Token gov = tokens.get(0);
  Token dep = tokens.get(tokens.size() - 1);
  Type relationType = cas.getTypeSystem().getType("webanno.custom.Relation");
  
  // One at the beginning
  // WebAnno legacy conventions
  // AnnotationFS fs1 = cas.createAnnotation(relationType, 
  //         min(dep.getBegin(), gov.getBegin()),
  //         max(dep.getEnd(), gov.getEnd()));
  // DKPro Core conventions
  AnnotationFS fs1 = cas.createAnnotation(relationType, dep.getBegin(), dep.getEnd());
  FSUtil.setFeature(fs1, "Governor", gov);
  FSUtil.setFeature(fs1, "Dependent", dep);
  cas.addFsToIndexes(fs1);
  
  writeAndAssertEquals(jcas, 
      WebannoTsv3Writer.PARAM_RELATION_LAYERS, asList("webanno.custom.Relation"));
}

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

setFeature(annotation, CAS.FEATURE_BASE_NAME_END, aUnit.getEnd());

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
FSUtil.setFeature(fs1, "value", "nsubj");
FSUtil.setFeature(fs1, "boolValue", true);
FSUtil.setFeature(fs1, "integerValue", 42);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

setFeature(host1, "value", "val1");
setFeature(host2, "value", "val2");

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
cas.addFsToIndexes(fs1);

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

private Dependency makeDependency(JCas aJCas, int govId, int depId, String label, String flavor,
    Int2ObjectMap<Token> tokens, String[] word)
{
  Dependency rel = new Dependency(aJCas);
  if (govId == 0) {
    rel.setGovernor(tokens.get(depId));
    rel.setDependent(tokens.get(depId));
  }
  else {
    rel.setGovernor(tokens.get(govId));
    rel.setDependent(tokens.get(depId));
  }
  rel.setDependencyType(label);
  // This is set via FSUtil because we still use the DKPro Core 1.7.0 JCas classes
  FSUtil.setFeature(rel, "flavor", flavor);
  rel.setBegin(rel.getDependent().getBegin());
  rel.setEnd(rel.getDependent().getEnd());
  rel.addToIndexes();
  return rel;
}

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

private Dependency makeDependency(JCas aJCas, int govId, int depId, String label, String flavor,
    Int2ObjectMap<Token> tokens, String[] word)
{
  Dependency rel = new Dependency(aJCas);
  if (govId == 0) {
    rel.setGovernor(tokens.get(depId));
    rel.setDependent(tokens.get(depId));
  }
  else {
    rel.setGovernor(tokens.get(govId));
    rel.setDependent(tokens.get(depId));
  }
  rel.setDependencyType(label);
  // This is set via FSUtil because we still use the DKPro Core 1.7.0 JCas classes
  FSUtil.setFeature(rel, "flavor", flavor);
  rel.setBegin(rel.getDependent().getBegin());
  rel.setEnd(rel.getDependent().getEnd());
  rel.addToIndexes();
  return rel;
}

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

private Dependency makeDependency(JCas aJCas, int govId, int depId, String label, String flavor,
    Int2ObjectMap<Token> tokens, String[] word)
{
  Dependency rel = new Dependency(aJCas);
  if (govId == 0) {
    rel.setGovernor(tokens.get(depId));
    rel.setDependent(tokens.get(depId));
  }
  else {
    rel.setGovernor(tokens.get(govId));
    rel.setDependent(tokens.get(depId));
  }
  rel.setDependencyType(label);
  // This is set via FSUtil because we still use the DKPro Core 1.7.0 JCas classes
  FSUtil.setFeature(rel, "flavor", flavor);
  rel.setBegin(rel.getDependent().getBegin());
  rel.setEnd(rel.getDependent().getEnd());
  rel.addToIndexes();
  return rel;
}

相关文章