public static <T extends FeatureStructure> T createStringList(CAS aCas, String... aValues) { return createStringList(aCas, asList(aValues)); }
public static StringList createStringList(JCas aJCas, String... aValues) { return createStringList(aJCas.getCas(), aValues); }
public static StringList createStringList(JCas aJCas, Collection<String> aCollection) { return createStringList(aJCas.getCas(), aCollection); }
public synchronized static QueryOperator createQueryOperator(JCas jcas, TypeConstants.QueryOperatorName name, List<Object> args) { QueryOperator ret = new QueryOperator(jcas); ret.setName(name.name()); List<String> argStrings = args.stream().map(Object::toString).collect(toList()); ret.setArgs(FSCollectionFactory.createStringList(jcas, argStrings)); return ret; }
public static void mergeConcept(JCas jcas, Concept dst, Concept src) { List<String> names = Stream.concat(getConceptNames(dst).stream(), getConceptNames(src).stream()) .filter(Objects::nonNull).distinct().collect(toList()); dst.setNames(FSCollectionFactory.createStringList(jcas, names)); List<String> ids = Stream.concat(getConceptIds(dst).stream(), getConceptIds(src).stream()) .filter(Objects::nonNull).distinct().collect(toList()); dst.setIds(FSCollectionFactory.createStringList(jcas, ids)); List<String> uris = Stream.concat(getConceptUris(dst).stream(), getConceptUris(src).stream()) .filter(Objects::nonNull).distinct().collect(toList()); dst.setUris(FSCollectionFactory.createStringList(jcas, uris)); List<ConceptType> types = Stream .concat(getConceptTypes(dst).stream(), getConceptTypes(src).stream()) .filter(Objects::nonNull).distinct().collect(toList()); dst.setTypes(FSCollectionFactory.createFSList(jcas, types)); List<ConceptMention> mentions = Stream .concat(getConceptMentions(dst).stream(), getConceptMentions(src).stream()) .filter(Objects::nonNull).distinct().collect(toList()); dst.setMentions(FSCollectionFactory.createFSList(jcas, mentions)); }
public synchronized static Concept createConcept(JCas jcas, List<String> names, List<String> uris, List<String> ids, List<ConceptMention> mentions, List<ConceptType> types) { Concept ret = new Concept(jcas); ret.setNames(FSCollectionFactory.createStringList(jcas, names)); ret.setUris(FSCollectionFactory.createStringList(jcas, uris)); ret.setIds(FSCollectionFactory.createStringList(jcas, ids)); ret.setMentions(FSCollectionFactory.createFSList(jcas, mentions)); mentions.stream().forEach(mention -> mention.setConcept(ret)); ret.setTypes(FSCollectionFactory.createFSList(jcas, types)); return ret; }
public synchronized static Summary createSummary(JCas jcas, String text, double score, List<String> variants) { Summary ret = new Summary(jcas); ret.setText(text); ret.setScore(score); ret.setVariants(FSCollectionFactory.createStringList(jcas, variants)); return ret; }
public synchronized static CandidateAnswerVariant createCandidateAnswerVariant(JCas jcas, List<CandidateAnswerOccurrence> caos, List<String> names, String docId) { CandidateAnswerVariant ret = new CandidateAnswerVariant(jcas); ret.setOccurrences(FSCollectionFactory.createFSList(jcas, caos)); ret.setNames(FSCollectionFactory.createStringList(jcas, names)); ret.setDocId(docId); return ret; }
public synchronized static AtomicQueryConcept createAtomicQueryConcept(JCas jcas, List<String> namedEntityTypes, TypeConstants.ConceptType conceptType, String text, String originalText) { AtomicQueryConcept ret = new AtomicQueryConcept(jcas); ret.setNamedEntityTypes(FSCollectionFactory.createStringList(jcas, namedEntityTypes)); ret.setConceptType(conceptType.name()); ret.setText(text); ret.setOriginalText(originalText); return ret; }
public synchronized static ComplexQueryConcept createComplexQueryConcept(JCas jcas, Collection<String> namedEntityTypes, TypeConstants.ConceptType conceptType, QueryOperator operator, List<? extends QueryConcept> operatorArgs) { ComplexQueryConcept ret = new ComplexQueryConcept(jcas); ret.setNamedEntityTypes(FSCollectionFactory.createStringList(jcas, namedEntityTypes)); ret.setConceptType(conceptType.name()); ret.setOperator(operator); ret.setOperatorArgs(FSCollectionFactory.createFSList(jcas, operatorArgs)); return ret; }
public static void setFeature(FeatureStructure aFS, String aFeature, String... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setStringValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else if (feat.getRange().isArray()) { aFS.setFeatureValue(feat, createStringArray(aFS.getCAS(), aValue)); } else { aFS.setFeatureValue(feat, createStringList(aFS.getCAS(), aValue)); } }
break; case CAS.TYPE_NAME_STRING_LIST: aFS.setFeatureValue(feat, createStringList(aFS.getCAS(), aValue)); break; default: