本文整理汇总了Java中org.apache.uima.jcas.cas.FSArray.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java FSArray.toArray方法的具体用法?Java FSArray.toArray怎么用?Java FSArray.toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.uima.jcas.cas.FSArray
的用法示例。
在下文中一共展示了FSArray.toArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMultipleSlotMentionsByName
import org.apache.uima.jcas.cas.FSArray; //导入方法依赖的package包/类
public static List<CCPSlotMention> getMultipleSlotMentionsByName(CCPClassMention ccpClassMention,
String slotMentionName) {
List<CCPSlotMention> returnSlotMentions = new ArrayList<CCPSlotMention>();
FSArray slotMentionsArray = ccpClassMention.getSlotMentions();
if (slotMentionsArray != null) {
FeatureStructure[] slotMentions = slotMentionsArray.toArray();
for (FeatureStructure fs : slotMentions) {
CCPSlotMention ccpSlotMention = (CCPSlotMention) fs;
if (ccpSlotMention.getMentionName().equals(slotMentionName)) {
returnSlotMentions.add(ccpSlotMention);
}
}
return returnSlotMentions;
} else {
return null;
}
}
示例2: asString
import org.apache.uima.jcas.cas.FSArray; //导入方法依赖的package包/类
/**
* Convert an SFArray to a string.
*
* @param <S>
* the generic type
* @param array
* the array
* @param clazz
* the clazz
* @param toString
* the to string
* @param separator
* the separator
* @return the string
*/
// NOTE This is checked by the filter
@SuppressWarnings("unchecked")
protected <S> String asString(FSArray array, Class<S> clazz, Function<S, String> toString, String separator) {
if (array == null) {
return "";
}
final FeatureStructure[] fses = array.toArray();
if (fses == null) {
return "";
}
return Arrays.stream(fses)
.filter(Objects::nonNull)
.filter(fs -> clazz.isAssignableFrom(fs.getClass()))
.map(fs -> toString.apply((S) fs))
.collect(Collectors.joining(separator));
}
示例3: getCUIs
import org.apache.uima.jcas.cas.FSArray; //导入方法依赖的package包/类
/**
* @param identifiedAnnotation
* -
* @return list of all cuis
*/
static private Collection<String> getCUIs(
final IdentifiedAnnotation identifiedAnnotation) {
final FSArray fsArray = identifiedAnnotation.getOntologyConceptArr();
if (fsArray == null) {
return Collections.emptySet();
}
final FeatureStructure[] featureStructures = fsArray.toArray();
final Collection<String> cuis = new ArrayList<>(
featureStructures.length);
for (FeatureStructure featureStructure : featureStructures) {
if (featureStructure instanceof UmlsConcept) {
final UmlsConcept umlsConcept = (UmlsConcept) featureStructure;
final String cui = umlsConcept.getCui();
final String tui = umlsConcept.getTui();
if (tui != null && !tui.isEmpty()) {
cuis.add(cui + "_" + tui);
} else {
cuis.add(cui);
}
}
}
return cuis;
}