@Override public List<Feature> extract(JCas view, FOCUS_T focusAnnotation) throws CleartkExtractorException { return this.extract(view, focusAnnotation, new NoBounds()); }
instance.addAll(extractor.extractWithin(identifiedAnnotationView, entityOrEventMention, coveringSent)); }else{ instance.addAll(extractor.extract(identifiedAnnotationView, entityOrEventMention));
/** * Extract features from the annotations around the focus annotation and within the given bounds. * * @param view * The JCas containing the focus annotation. * @param focusAnnotation * The annotation whose context is to be searched. * @param boundsAnnotation * The boundary within which context annotations may be identified. * @return The features extracted in the context of the focus annotation. */ public List<Feature> extractWithin(JCas view, FOCUS_T focusAnnotation, Annotation boundsAnnotation) throws CleartkExtractorException { Bounds bounds = new SpanBounds(boundsAnnotation.getBegin(), boundsAnnotation.getEnd()); return this.extract(view, focusAnnotation, bounds); }
public List<Feature> extractBetween(JCas view, FOCUS_T annotation1, FOCUS_T annotation2) throws CleartkExtractorException { int begin = annotation1.getEnd(); int end = annotation2.getBegin(); // FIXME: creating a new annotation may leak memory - is there a better approach? Annotation focusAnnotation = new Annotation(view, begin, end); return this.extract(view, focusAnnotation, new NoBounds()); }
List<Feature> features = new ArrayList<Feature>(); features.addAll(this.extractor.extract(jCas, token)); features.addAll(this.contextExtractor.extract(jCas, token)); featureLists.add(features);
public void process(JCas jCas) throws AnalysisEngineProcessException { // use the extractor to create features for the document DocumentAnnotation doc = (DocumentAnnotation) jCas.getDocumentAnnotationFs(); List<Feature> features = this.extractor.extract(jCas, doc); // during training, get the label for this document from the CAS if (isTraining()) { UsenetDocument document = JCasUtil.selectSingle(jCas, UsenetDocument.class); this.dataWriter.write(new Instance<String>(document.getCategory(), features)); } // during classification, use the classifier's output to create a CAS annotation else { String category = this.classifier.classify(features); UsenetDocument document = new UsenetDocument(jCas, 0, jCas.getDocumentText().length()); document.setCategory(category); document.addToIndexes(); } } }