protected void documentDone(CAS cas) { // TODO: Create confidence FS // contains String name type // contains Double prob if (documentConfidenceType != null) { FeatureStructure confidenceFS = cas.createFS(documentConfidenceType); confidenceFS.setDoubleValue(documentConfidenceFeature, documentConfidence.mean()); confidenceFS.setStringValue(documentConfidenceNameTypeFeature, mNameType.getName()); cas.addFsToIndexes(confidenceFS); } // Clears the adaptive data which was created for the current document mNameFinder.clearAdaptiveData(); documentConfidence = new Mean(); }
private void createTokenAnnotation(CAS cas, int start, int end) { AnnotationFS tokenAnno = cas.createAnnotation(tokenType, start, end); cas.addFsToIndexes(tokenAnno); }
public void addAnnotation(AnnotationFS annotation, boolean addToIndex, RuleMatch creator) { if (addToIndex) { cas.addFsToIndexes(annotation); } addAnnotation(annotation, creator); }
private void createTokenAnnotation(CAS cas, int start, int end) { AnnotationFS tokenAnno = cas.createAnnotation(tokenType, start, end); cas.addFsToIndexes(tokenAnno); } }
@Override public void finished(RutaStream stream, List<RutaInferenceVisitor> visitors) { for (FeatureStructure each : fsList) { each.getCAS().addFsToIndexes(each); } }
/** * add this FS to indexes in a specific view, perhaps different from the creation view * @param jcas the JCas */ public void addToIndexes(JCas jcas) { jcas.getCas().addFsToIndexes(this); }
public void finished(TextMarkerStream stream, List<TextMarkerInferenceVisitor> visitors) { for (FeatureStructure each : fsList) { each.getCAS().addFsToIndexes(each); } }
/** * Copies a generic {@code FeatureStructure} to another of the same type. * * @param from {@code FeatureStructure} to copy from. * @param to {@code FeatureStructure} to copy to. */ public void copy(FeatureStructure from, FeatureStructure to) { fsCopiers.getOrDefault(from.getType().getName(), this::defaultCopy).accept(from, to); to.getCAS().addFsToIndexes(to); } }
private RutaBasic createRutaBasic(int begin, int end) { RutaBasic newTMB = new RutaBasic(getJCas(), begin, end); newTMB.setLowMemoryProfile(lowMemoryProfile); beginAnchors.put(begin, newTMB); endAnchors.put(end, newTMB); cas.addFsToIndexes(newTMB); return newTMB; }
private void chunkComplete() { if (openChunk != null) { Type chunkType = mappingProvider.getTagType(openChunk); AnnotationFS chunk = cas.createAnnotation(chunkType, start, end); chunk.setStringValue(chunkValue, internTags && openChunk != null ? openChunk.intern() : openChunk); cas.addFsToIndexes(chunk); openChunk = null; } } }
private void chunkComplete() { if (openChunk != null) { Type chunkType = mappingProvider.getTagType(openChunk); AnnotationFS chunk = cas.createAnnotation(chunkType, start, end); chunk.setStringValue(chunkValue, internTags && openChunk != null ? openChunk.intern() : openChunk); cas.addFsToIndexes(chunk); openChunk = null; } } }
private void chunkComplete() { if (openChunk != null) { Type chunkType = mappingProvider.getTagType(openChunk); AnnotationFS chunk = cas.createAnnotation(chunkType, start, end); chunk.setStringValue(chunkValue, internTags && openChunk != null ? openChunk.intern() : openChunk); cas.addFsToIndexes(chunk); openChunk = null; } } }
private void chunkComplete() { if (openChunk != null) { Type chunkType = mappingProvider.getTagType(openChunk); AnnotationFS chunk = cas.createAnnotation(chunkType, start, end); chunk.setStringValue(chunkValue, internTags && openChunk != null ? openChunk.intern() : openChunk); cas.addFsToIndexes(chunk); openChunk = null; } } }
private void chunkComplete() { if (openChunk != null) { Type chunkType = mappingProvider.getTagType(openChunk); Chunk chunk = (Chunk) cas.createAnnotation(chunkType, start, end); chunk.setChunkValue(openChunk.intern()); cas.addFsToIndexes(chunk); openChunk = null; } } };
private void annotate(CAS cas, Feature feature, int begin, int end, String value) { Type type = feature.getDomain(); AnnotationFS annotation = cas.createAnnotation(type, begin, end); annotation.setStringValue(feature,value); cas.addFsToIndexes(annotation); }
/** * Create a new link annotation. Already adds the chain to the CAS. */ private AnnotationFS newLink(JCas aJCas, int aBegin, int aEnd) { Type linkType = CasUtil.getType(aJCas.getCas(), getAnnotationTypeName()); AnnotationFS newLink = aJCas.getCas().createAnnotation(linkType, aBegin, aEnd); aJCas.getCas().addFsToIndexes(newLink); return newLink; }
public static <T extends TOP> T getOrCreate(JCas jcas, Class<T> targetClass) { if (JCasUtil.exists(jcas, targetClass)) { return JCasUtil.selectSingle(jcas, targetClass); } else { T annotation = (T) jcas.getCas().createFS(JCasUtil.getType(jcas, targetClass)); jcas.getCas().addFsToIndexes(annotation); return annotation; } } }
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); }
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; }
public static AnnotationFS makeLinkHostMultiSPanFeatureFS(JCas aJCas, int aBegin, int aEnd, Feature aSpanFeature, String aValue, 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))); hostA1.setStringValue(aSpanFeature, aValue); aJCas.getCas().addFsToIndexes(hostA1); return hostA1; }