/** * {@inheritDoc} */ @Override public Iterator<Annotation> getLookupWindowIterator( final JCas jcas ) throws AnnotatorInitializationException { final JFSIndexRepository indexes = jcas.getJFSIndexRepository(); return indexes.getAnnotationIndex( Sentence.type ).iterator(); }
public static TOP getFS(JCas jcas, int typeID) { Iterator<TOP> it = jcas.getJFSIndexRepository().getAllIndexedFS(typeID); TOP fs = null; if (it.hasNext()) { fs = it.next(); } return fs; }
public Iterator getAnnotationIterator(JCas jcas) throws AnnotatorProcessException { // TODO Auto-generated method stub JFSIndexRepository indexes = jcas.getJFSIndexRepository(); return indexes.getAnnotationIndex(iAnnotationType).iterator(); }
/** * * @param jcas * the CAS in which we'll store this annotation * @param annotation * the annotation to be stored. Removes any instances of this annotation type fi */ public static void storeAnnotation(JCas jcas, TOP annotation, int typeID) { Iterator<TOP> it = jcas.getJFSIndexRepository().getAllIndexedFS(typeID); while (it.hasNext()) { TOP oldAnnotation = it.next(); oldAnnotation.removeFromIndexes(); } annotation.addToIndexes(); }
/** * {@inheritDoc} */ @Override public Iterator<Annotation> getLookupWindowIterator( final JCas jcas ) throws AnnotatorInitializationException { final JFSIndexRepository indexes = jcas.getJFSIndexRepository(); return indexes.getAnnotationIndex( Sentence.type ).iterator(); }
/** * * @param jcas * the CAS in which we'll store this annotation * @param fs * the annotation to be stored. Removes any instances of this annotation type fi */ @SuppressWarnings("unchecked") public static <T extends TOP> void storeFS(JCas jcas, T fs) { Iterator<TOP> it = jcas.getJFSIndexRepository().getAllIndexedFS(T.type); while (it.hasNext()) { T oldAnnotation = (T) it.next(); oldAnnotation.removeFromIndexes(); } fs.addToIndexes(); }
public Iterator getAnnotationIterator(JCas jcas) throws AnnotatorProcessException { // TODO Auto-generated method stub JFSIndexRepository indexes = jcas.getJFSIndexRepository(); return indexes.getAnnotationIndex(iAnnotationType).iterator(); }
/** * @param jcas ye olde jay-cas * @return the Metadata for the given jcas or null if one is not found */ static private Metadata getMetadata( final JCas jcas ) { // TODO I really dislike this index-everything-to-java1 paradigm final FSIterator<TOP> itr = jcas.getJFSIndexRepository().getAllIndexedFS( Metadata.type ); if ( itr == null || !itr.hasNext() ) { return null; } return (Metadata)itr.next(); }
private FSIterator<Annotation> getAllAnnotations(JCas jcas, int type) { JFSIndexRepository indexes = jcas.getJFSIndexRepository(); FSIterator<Annotation> annotationsIter = indexes.getAnnotationIndex(type).iterator(); // while (segmentItr.hasNext()) { // } return annotationsIter; }
/** * @param aCas the <code>JCas</code> object * * @return return the pairID of the T-H pair */ private String getPairID(JCas aCas) { FSIterator<TOP> pairIter = aCas.getJFSIndexRepository().getAllIndexedFS(Pair.type); Pair p = (Pair) pairIter.next(); return p.getPairID(); }
/** * {@inheritDoc} */ @Override public Map<String, List<LookupAnnotation>> getContextMap( final JCas jcas, final int windowBegin, final int windowEnd ) throws AnnotatorInitializationException { if ( iv_annotTypeArr == null ) { return Collections.emptyMap(); } final List<LookupAnnotation> list = new ArrayList<LookupAnnotation>(); // algorithm depends on a window for permutations final JFSIndexRepository indexes = jcas.getJFSIndexRepository(); for ( int annotationType : iv_annotTypeArr ) { final Iterator<Annotation> itr = indexes.getAnnotationIndex( annotationType ).iterator(); list.addAll( constrainToWindow( windowBegin, windowEnd, itr ) ); } final Map<String, List<LookupAnnotation>> m = new HashMap<String, List<LookupAnnotation>>( 1 ); m.put( FirstTokenPermutationImpl.CTX_KEY_WINDOW_ANNOTATIONS, list ); return m; }
/** * @param aCas * the <code>JCas</code> object * @return return the pairID of the T-H pair */ protected final String getPairID(JCas aCas) { FSIterator<TOP> pairIter = aCas.getJFSIndexRepository() .getAllIndexedFS(Pair.type); Pair p = (Pair) pairIter.next(); return p.getPairID(); }
/** * Generates UID values for all IdentifiedAnnotation objects. * This is just a numeric identifier, assigned sequentially. */ private void generateUidValues( JCas jcas ) { int uid = 0; Iterator itr = jcas.getJFSIndexRepository().getAnnotationIndex( IdentifiedAnnotation.type ).iterator(); while ( itr.hasNext() ) { IdentifiedAnnotation idAnnot = (IdentifiedAnnotation)itr.next(); idAnnot.setId( uid ); uid++; } }
/** * @param aCas * the <code>JCas</code> object * @return return the pairID of the T-H pair */ protected final String getPairID(JCas aCas) { FSIterator<TOP> pairIter = aCas.getJFSIndexRepository() .getAllIndexedFS(Pair.type); Pair p = (Pair) pairIter.next(); return p.getPairID(); }
/** * Generates UID values for all IdentifiedAnnotation objects. * This is just a numeric identifier, assigned sequentially. */ private void generateUidValues( JCas jcas ) { int uid = 0; Iterator itr = jcas.getJFSIndexRepository().getAnnotationIndex( IdentifiedAnnotation.type ).iterator(); while ( itr.hasNext() ) { IdentifiedAnnotation idAnnot = (IdentifiedAnnotation)itr.next(); idAnnot.setId( uid ); uid++; } }
/** * @param aCas * input T-H pair * @return return the pairID of the pair */ protected String getPairID(JCas aCas) { FSIterator<TOP> pairIter = aCas.getJFSIndexRepository() .getAllIndexedFS(Pair.type); Pair p = (Pair) pairIter.next(); return p.getPairID(); }
private int getNonSmokerNegatedCount(JCas jcas) { int nonSmokerCnt = 0; Iterator<?> neItr= jcas.getJFSIndexRepository().getAnnotationIndex( NonSmokerNamedEntityAnnotation.type).iterator(); while (neItr.hasNext()) { NonSmokerNamedEntityAnnotation neAnn = (NonSmokerNamedEntityAnnotation) neItr.next(); nonSmokerCnt++; iv_logger.info("***NonSmokerNameEntity***" + neAnn.getCoveredText() + " " + nonSmokerCnt + " " + neAnn.getPolarity()); } return nonSmokerCnt; }
/** * @param aCas * the <code>JCas</code> object * @return return the pairID of the T-H pair */ public static String getPairID(JCas aCas) { FSIterator<TOP> pairIter = aCas.getJFSIndexRepository() .getAllIndexedFS(Pair.type); Pair p = (Pair) pairIter.next(); return p.getPairID(); }
private int getNonSmokerNegatedCount(JCas jcas) { int nonSmokerCnt = 0; Iterator<?> neItr= jcas.getJFSIndexRepository().getAnnotationIndex( NonSmokerNamedEntityAnnotation.type).iterator(); while (neItr.hasNext()) { NonSmokerNamedEntityAnnotation neAnn = (NonSmokerNamedEntityAnnotation) neItr.next(); nonSmokerCnt++; iv_logger.info("***NonSmokerNameEntity***" + neAnn.getCoveredText() + " " + nonSmokerCnt + " " + neAnn.getPolarity()); } return nonSmokerCnt; }
/** * @param aCas the <code>JCas</code> object * * @return if the T-H pair contains the gold answer, return it; otherwise return null */ private String getGoldLabel(JCas aCas) { FSIterator<TOP> pairIter = aCas.getJFSIndexRepository() .getAllIndexedFS(Pair.type); Pair p = (Pair) pairIter.next(); if (null == p.getGoldAnswer() || p.getGoldAnswer().equals("") || p.getGoldAnswer().equals("ABSTAIN")) { return null; } else { return p.getGoldAnswer(); } }