private void addChunkAnnotation(CAS tcas, AnnotationFS[] tokenAnnotations, String tag, int start, int end) { AnnotationFS chunk = tcas.createAnnotation(mChunkType, tokenAnnotations[start].getBegin(), tokenAnnotations[end - 1].getEnd()); chunk.setStringValue(mChunkFeature, tag); tcas.getIndexRepository().addFS(chunk); }
+ tokenSpans[i].getEnd()); cas.getIndexRepository().addFS(tokenAnnotations[i]);
cas.getIndexRepository().addFS(nameAnnotations[i]);
@Override protected void setBestCategory(CAS tcas, String bestCategory) { FSIndex<AnnotationFS> categoryIndex = tcas.getAnnotationIndex(mCategoryType); AnnotationFS categoryAnnotation; if (categoryIndex.size() > 0) { categoryAnnotation = categoryIndex.iterator().next(); } else { categoryAnnotation = tcas.createAnnotation(mCategoryType, 0, tcas.getDocumentText().length()); tcas.getIndexRepository().addFS(categoryAnnotation); } categoryAnnotation.setStringValue(mCategoryFeature, bestCategory); } }
protected AnnotationFS createAnnotation(CAS cas, int offset, Parse parse) { Parse[] parseChildren = parse.getChildren(); AnnotationFS[] parseChildAnnotations = new AnnotationFS[parseChildren.length]; // do this for all children for (int i = 0; i < parseChildren.length; i++) { parseChildAnnotations[i] = createAnnotation(cas, offset, parseChildren[i]); } AnnotationFS parseAnnotation = cas.createAnnotation(mParseType, offset + parse.getSpan().getStart(), offset + parse.getSpan().getEnd()); parseAnnotation.setStringValue(mTypeFeature, parse.getType()); if (probabilityFeature != null) { parseAnnotation.setDoubleValue(probabilityFeature, parse.getProb()); } ArrayFS childrenArray = cas.createArrayFS(parseChildAnnotations.length); childrenArray.copyFromArray(parseChildAnnotations, 0, 0, parseChildAnnotations.length); parseAnnotation.setFeatureValue(childrenFeature, childrenArray); cas.getIndexRepository().addFS(parseAnnotation); return parseAnnotation; }
sentPositions[i].getEnd() + containerAnnotation.getBegin()); cas.getIndexRepository().addFS(sentences[i]);
/** * @deprecated * @param fs - */ @Deprecated public void commitFS(FeatureStructure fs) { getIndexRepository().addFS(fs); }
void addSofaFsToIndex(SofaFS sofa) { this.svd.baseCAS.getBaseIndexRepository().addFS(sofa); }
/** * Internally removes an annotation from the {@link CAS}. * * @param featureStructure the feature structure */ private void addFeatureStructureInternal(FeatureStructure featureStructure) { getCAS().getIndexRepository().addFS(featureStructure); }
public void addSofa(FeatureStructure sofa, String sofaName, String mimeType) { if (this.svd.sofaNameSet.contains(sofaName)) { CASRuntimeException e = new CASRuntimeException(CASRuntimeException.SOFANAME_ALREADY_EXISTS, new String[] { sofaName }); throw e; } final int llsofa = ll_getFSRef(sofa); if (0 == ll_getIntValue(llsofa, TypeSystemImpl.sofaNumFeatCode)) { ll_setIntValue(llsofa, TypeSystemImpl.sofaNumFeatCode, ++this.svd.viewCount); } ll_setStringValue(llsofa, TypeSystemImpl.sofaIdFeatCode, sofaName); ll_setStringValue(llsofa, TypeSystemImpl.sofaMimeFeatCode, mimeType); this.getBaseIndexRepository().addFS(sofa); this.svd.sofaNameSet.add(sofaName); }
private void addChunkAnnotation(CAS tcas, AnnotationFS[] tokenAnnotations, String tag, int start, int end) { AnnotationFS chunk = tcas.createAnnotation(mChunkType, tokenAnnotations[start].getBegin(), tokenAnnotations[end - 1].getEnd()); chunk.setStringValue(mChunkFeature, tag); tcas.getIndexRepository().addFS(chunk); }
+ tokenSpans[i].getEnd()); cas.getIndexRepository().addFS(tokenAnnotations[i]);
@Override protected void setBestCategory(CAS tcas, String bestCategory) { FSIndex<AnnotationFS> categoryIndex = tcas.getAnnotationIndex(mCategoryType); AnnotationFS categoryAnnotation; if (categoryIndex.size() > 0) { categoryAnnotation = categoryIndex.iterator().next(); } else { categoryAnnotation = tcas.createAnnotation(mCategoryType, 0, tcas.getDocumentText().length()); tcas.getIndexRepository().addFS(categoryAnnotation); } categoryAnnotation.setStringValue(mCategoryFeature, bestCategory); } }
cas.getIndexRepository().addFS(nameAnnotations[i]);
public void process(CAS aCAS) throws AnalysisEngineProcessException { // get handle to CAS view containing XML document CAS xmlCas = aCAS.getView("xmlDocument"); InputStream xmlStream = xmlCas.getSofa().getSofaDataStream(); // parse with detag handler DetagHandler handler = new DetagHandler(); try { SAXParser parser = parserFactory.newSAXParser(); parser.parse(xmlStream, handler); } catch (Exception e) { throw new AnalysisEngineProcessException(e); } // create the plain text view and set its document text CAS plainTextView = aCAS.createView("plainTextDocument"); plainTextView.setDocumentText(handler.getDetaggedText()); plainTextView.setDocumentLanguage(aCAS.getView("_InitialView").getDocumentLanguage()); // Index the SourceDocumentInformation object, if there is one, in the new sofa. // This is needed by the SemanticSearchCasIndexer Iterator iter = xmlCas.getAnnotationIndex(sourceDocInfoType).iterator(); if (iter.hasNext()) { FeatureStructure sourceDocInfoFs = (FeatureStructure) iter.next(); plainTextView.getIndexRepository().addFS(sourceDocInfoFs); } }
tcas.getIndexRepository().addFS(annotation);
protected AnnotationFS createAnnotation(CAS cas, int offset, Parse parse) { Parse[] parseChildren = parse.getChildren(); AnnotationFS[] parseChildAnnotations = new AnnotationFS[parseChildren.length]; // do this for all children for (int i = 0; i < parseChildren.length; i++) { parseChildAnnotations[i] = createAnnotation(cas, offset, parseChildren[i]); } AnnotationFS parseAnnotation = cas.createAnnotation(mParseType, offset + parse.getSpan().getStart(), offset + parse.getSpan().getEnd()); parseAnnotation.setStringValue(mTypeFeature, parse.getType()); if (probabilityFeature != null) { parseAnnotation.setDoubleValue(probabilityFeature, parse.getProb()); } ArrayFS childrenArray = cas.createArrayFS(parseChildAnnotations.length); childrenArray.copyFromArray(parseChildAnnotations, 0, 0, parseChildAnnotations.length); parseAnnotation.setFeatureValue(childrenFeature, childrenArray); cas.getIndexRepository().addFS(parseAnnotation); return parseAnnotation; }
sentPositions[i].getEnd() + containerAnnotation.getBegin()); cas.getIndexRepository().addFS(sentences[i]);