Examples of JFSIndexRepository


Examples of org.apache.uima.jcas.JFSIndexRepository

   * @param end
   * @return int[] - int[0] is begin offset and int[1] is end offset
   */
  private int[] getSentenceSpanContainingGivenSpan(JCas jcas, int begin, int end)
  {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator iter = indexes.getAnnotationIndex(Sentence.type).iterator();
    int[] span = new int[2];

    while (iter.hasNext())
    {
      Sentence sa = (Sentence) iter.next();
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

   * @param end
   * @return int[] - int[0] is begin offset and int[1] is end offset of subsequent sentence end (if available)
   */
private int[] getNarrativeSpansContainingGivenSpanType(JCas jcas, int begin, int annotType)
{
  JFSIndexRepository indexes = jcas.getJFSIndexRepository();
  Iterator iter = indexes.getAnnotationIndex(annotType).iterator();
  int[] span = new int[2];
  boolean foundFirstTypeSpan = false;
  boolean foundSecondTypeSpan = false;
  int spanSizeCount = 0;
  while (iter.hasNext() && !foundSecondTypeSpan)
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

   * @param begin
   * @param end
   * @return
   */
  private int [] findOffsetsInPattern(JCas jcas, int begin, int end, int elementType, int[][] location, boolean highest) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator neItr = indexes.getAnnotationIndex(elementType).iterator();//FSUtil.getAnnotationsInSpanIterator(jcas, elementType, begin, end);
    int [] lastLocation =  {-1,-1};
    boolean wantMuliple = true;
    if (elementType == StrengthUnitAnnotation.type) {
      while (neItr.hasNext() && wantMuliple) {
        StrengthUnitAnnotation nea = (StrengthUnitAnnotation) neItr.next();
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

   * @return int[0] is begin offset and int[1] is end offset
   * @throws Exception
   */
  private int[] getAdjustedWindowSpan(JCas jcas,  int begin, int end, boolean highestRange) throws Exception {
    int[] spanStrength = {-1, -1}, spanFrequency = {-1, -1}, spanDose = {-1, -1};
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    int[] senSpan = {begin, end };

    // Up to 10 of each type of signature item and drug mentions are allowed.  If more than that are available the
    // ArrayIndexOutOfBoundsException is thrown/caught and the sentence is skipped

View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

   * @param begin
   * @param end
   * @return
   */
  private int findInPattern(JCas jcas, int begin, int end, int elementType, int[][] location) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator neItr = indexes.getAnnotationIndex(elementType).iterator();//FSUtil.getAnnotationsInSpanIterator(jcas, elementType, begin, end);
    int [] lastLocation =  {-1,-1};
    int counter = 0;
    if (elementType == StrengthUnitAnnotation.type) {
      while (neItr.hasNext()) {
        StrengthUnitAnnotation nea = (StrengthUnitAnnotation) neItr.next();
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

   * @param begin
   * @param end
   * @return
   */
  private int lastInPattern(JCas jcas, int begin, int end, int elementType, int[][] location) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator neItr = indexes.getAnnotationIndex(elementType).iterator();
    int [] lastLocation =  {-1,-1};
    int counter = 0;
    if (elementType == StrengthAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

    */
   @Override
   public Iterator<LookupToken> getLookupTokenIterator( final JCas jcas ) throws AnnotatorInitializationException {
      final List<LookupToken> ltList = new ArrayList<>();

      final JFSIndexRepository indexes = jcas.getJFSIndexRepository();
      final AnnotationIndex<Annotation> annotationIndex = indexes.getAnnotationIndex( BaseToken.type );
      for ( Annotation annotation : annotationIndex ) {
         if ( !(annotation instanceof BaseToken) ) {
            iv_logger.warn( getClass().getName() + " getLookupTokenIterator(..) Annotation is not a BaseToken" );
            continue;
         }
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

    * {@inheritDoc}
    */
   @Override
   public Iterator<Annotation> getLookupWindowIterator( final JCas jcas ) throws AnnotatorInitializationException {
      try {
         final JFSIndexRepository indexes = jcas.getJFSIndexRepository();
         final String objClassName = iv_props.getProperty( WINDOW_ANNOT_PRP_KEY );
         int windowType;
         try {
            windowType = JCasUtil.getType( objClassName );
         } catch ( IllegalArgumentException iaE ) {
            // thrown by JCasUtil.getType()
            throw new AnnotatorInitializationException( iaE );
         }
         return indexes.getAnnotationIndex( windowType ).iterator();
      } catch ( Exception e ) {
         // TODO specify exceptions, get rid of the catch for "Exception"
         throw new AnnotatorInitializationException( e );
      }
   }
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

      if ( iv_annotTypeArr == null ) {
         return Collections.emptyMap();
      }
      final List<LookupAnnotation> list = new ArrayList<>();
      // 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<>( 1 );
      m.put( FirstTokenPermutationImpl.CTX_KEY_WINDOW_ANNOTATIONS, list );
      return m;
View Full Code Here

Examples of org.apache.uima.jcas.JFSIndexRepository

    */
   @Override
   public Iterator<LookupToken> getLookupTokenIterator( final JCas jcas ) throws AnnotatorInitializationException {
      final List<LookupToken> ltList = new ArrayList<LookupToken>();

      final JFSIndexRepository indexes = jcas.getJFSIndexRepository();
      final AnnotationIndex<Annotation> annotationIndex = indexes.getAnnotationIndex( BaseToken.type );
      for ( Annotation annotation : annotationIndex ) {
         if ( !(annotation instanceof BaseToken) ) {
            iv_logger.warn( getClass().getName() + " getLookupTokenIterator(..) Annotation is not a BaseToken" );
            continue;
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.