org.apache.uima.cas.FSIndex.find()方法的使用及代码示例

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

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

FSIndex.find介绍

[英]Find an entry in the index "equal to" the given feature structure according to the comparators specified for this index. Note that this is in general not the same as feature structure identity. For BAG indexes, it is identity, for others it means the found feature structure compares equal with the parameter in terms of the defined comparators for the index.
[中]根据为该索引指定的比较器,在索引中查找与给定特征结构“相等”的条目。请注意,这通常与特征结构标识不同。对于行李索引,它是标识,对于其他索引,它意味着找到的特征结构在定义的索引比较器方面与参数进行相等的比较。

代码示例

代码示例来源:origin: apache/uima-uimaj

@Override
public FeatureStructure find(FeatureStructure fs) {
 return this.index.find(fs);
}

代码示例来源:origin: nlpie/biomedicus

@Nullable
@Override
public String get(Object key) {
 if (!(key instanceof String)) {
  return null;
 }
 FeatureStructure check = metadataCas.createFS(metadataType);
 check.setStringValue(keyFeature, (String) key);
 FeatureStructure fs = metadataIndex.find(check);
 return fs.getStringValue(valueFeature);
}

代码示例来源:origin: nlpie/biomedicus

@Nullable
@Override
public String put(String key, String value) {
 FeatureStructure check = metadataCas.createFS(metadataType);
 check.setStringValue(keyFeature, key);
 FeatureStructure fs = metadataIndex.find(check);
 String existing = null;
 if (fs != null) {
  existing = fs.getStringValue(valueFeature);
  metadataCas.removeFsFromIndexes(fs);
 } else {
  fs = check;
 }
 fs.setStringValue(valueFeature, value);
 metadataCas.addFsToIndexes(fs);
 return existing;
}

相关文章

微信公众号

最新文章

更多