/** * Retrieves a type of the given name from the given type system. * * @param typeSystem * @param name * @return the type * @throws AnalysisEngineProcessException */ public static Type getType(TypeSystem typeSystem, String name) throws AnalysisEngineProcessException { Type type = typeSystem.getType(name); if (type == null) { throw new OpenNlpAnnotatorProcessException( ExceptionMessages.TYPE_NOT_FOUND, new Object[] {name}); } return type; }
nameTypeMap.put(parts[0].trim(), typeSystem.getType(parts[1].trim()));
@Override public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { super.typeSystemInit(typeSystem); containerType = AnnotatorUtil.getOptionalTypeParameter(context, typeSystem, "opennlp.uima.ContainerType"); if (containerType == null) { containerType = typeSystem.getType(CAS.TYPE_NAME_DOCUMENT_ANNOTATION); } sentenceType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.SENTENCE_TYPE_PARAMETER); }
/** * Initializes a new instance. * * @param typeSystem the type system * @param editor the editor */ public ModeMenu(TypeSystem typeSystem, AnnotationEditor editor) { super(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION), typeSystem); this.editor = editor; }
/** * Initializes a new instance. * * @param typeSystem the type system * @param shownTypes the shown types */ public ShowAnnotationsMenu(TypeSystem typeSystem, Collection<Type> shownTypes) { super(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION), typeSystem); for (Type type : shownTypes) { typesToDisplay.add(type); } }
public static Type getType(JCas jcas, String typeName) { TypeSystem ts = jcas.getTypeSystem(); return ts.getType(typeName); } }
public static Type getType(JCas jcas, String typeName) { TypeSystem ts = jcas.getTypeSystem(); return ts.getType(typeName); } }
private static boolean isListType(TypeSystem aTS, Type aType) { return aTS.subsumes(aTS.getType(CAS.TYPE_NAME_LIST_BASE), aType); }
public void typeInit(TypeSystem ts) throws ResourceInitializationException { // initialize annotation type if (this.matchTypeStr != null) { this.matchType = ts.getType(this.matchTypeStr); if (this.matchType == null) { throw new RegexAnnotatorConfigException( "regex_annotator_error_resolving_types", new Object[] { this.matchTypeStr }); } } }
public static PredicateSignature mapPredicateSignature(eu.excitementproject.eop.transformations.representation.annotations.PredicateSignature sig,JCas jcas,int begin,int end){ Type type = jcas.getTypeSystem().getType(SIG_MAP.get(sig).getName()); PredicateSignature ret = (PredicateSignature)jcas.getCas().createAnnotation(type, begin, end); return ret; }
@Override public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { super.typeSystemInit(typeSystem); containerType = AnnotatorUtil.getOptionalTypeParameter(context, typeSystem, "opennlp.uima.ContainerType"); if (containerType == null) { containerType = typeSystem.getType(CAS.TYPE_NAME_DOCUMENT_ANNOTATION); } sentenceType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.SENTENCE_TYPE_PARAMETER); }
String getJavaRangeType(FeatureDescription fd) { String rangeTypeNameCAS = fd.getRangeTypeName(); if (null != typeSystem) { Type rangeCasType = typeSystem.getType(rangeTypeNameCAS); if (typeSystem.subsumes(casStringType, rangeCasType)) { // type is a subtype of string, make its java type = to string return "String"; } } return getJavaName(rangeTypeNameCAS); }
private void addTCSequenceAnnotation(JCas jcas) { Type type = jcas.getCas().getTypeSystem().getType(nameSequence); Collection<AnnotationFS> sequenceAnnotation = CasUtil.select(jcas.getCas(), type); for (AnnotationFS seq : sequenceAnnotation) { TextClassificationSequence tcs = new TextClassificationSequence(jcas, seq.getBegin(), seq.getEnd()); tcs.addToIndexes(); } }
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; }
private static AnnotationFS makeLinkHostFS(JCas aJCas, String aType, int aBegin, int aEnd, FeatureStructure... aLinks) { Type hostType = aJCas.getTypeSystem().getType(aType); AnnotationFS hostA1 = aJCas.getCas().createAnnotation(hostType, aBegin, aEnd); if (aLinks != null) { hostA1.setFeatureValue(hostType.getFeatureByBaseName("links"), FSCollectionFactory.createFSArray(aJCas, asList(aLinks))); } aJCas.getCas().addFsToIndexes(hostA1); return hostA1; }
public static void makeLinkHostFS(JCas aJCas, int aBegin, int aEnd, 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))); aJCas.getCas().addFsToIndexes(hostA1); }
private static FeatureStructure makeLinkFS(JCas aJCas, String aType, String aSlotLabel, AnnotationFS aTarget) { Type linkType = aJCas.getTypeSystem().getType(aType); FeatureStructure linkA1 = aJCas.getCas().createFS(linkType); linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel); linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), aTarget); aJCas.getCas().addFsToIndexes(linkA1); return linkA1; }