Examples of FSArray


Examples of org.apache.uima.jcas.cas.FSArray

            final QueryComposite queryComposite, Type matchedType, Type ruleApplyType,
            Type blockApplyType, Feature innerApplyFeature, Feature ruleApplyFeature) {
      int ret = 0;
      if (fs.getType().equals(blockApplyType)) {
        FeatureStructure featureValue = fs.getFeatureValue(innerApplyFeature);
        FSArray array = (FSArray) featureValue;
        for (int i = 0; i < array.size(); i++) {
          AnnotationFS eachApply = (AnnotationFS) array.get(i);
          ret += findRuleMatches(result, eachApply, file, queryComposite, matchedType,
                  ruleApplyType, blockApplyType, innerApplyFeature, ruleApplyFeature);
        }
      } else if (fs.getType().equals(ruleApplyType)) {
        FeatureStructure featureValue = fs.getFeatureValue(ruleApplyFeature);
        FSArray array = (FSArray) featureValue;
        for (int i = 0; i < array.size(); i++) {
          AnnotationFS eachApply = (AnnotationFS) array.get(i);
          ret += findRuleMatches(result, eachApply, file, queryComposite, matchedType,
                  ruleApplyType, blockApplyType, innerApplyFeature, ruleApplyFeature);
        }
      } else if (fs.getType().equals(matchedType)) {
        result.add(new QueryResult(fs.getBegin(), fs.getEnd(), fs.getCoveredText(), file));
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

      Annotation crossAnnot = gerCrossAnnot.getOtherAnnotation();
      assertTrue((CAS.TYPE_NAME_ANNOTATION).equals(crossAnnot.getType().getName()));
      assertTrue(("this").equals(crossAnnot.getCoveredText()));

      // Test that annotations accessed from a reference in the base CAS work correctly
      FSArray anArray = new FSArray(jcas, 3);
      anArray.set(0, engAnnot);
      anArray.set(1, frAnnot);
      anArray.set(2, gerCrossAnnot);
      Annotation tstAnnot = (Annotation) anArray.get(0);
      assertTrue(("this").equals(tstAnnot.getCoveredText()));
      tstAnnot = (Annotation) anArray.get(1);
      assertTrue(("cette").equals(tstAnnot.getCoveredText()));
      tstAnnot = (Annotation) anArray.get(2);
      assertTrue(("das").equals(tstAnnot.getCoveredText()));
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

      r1.setArrayFloat(1, (float) 2.5);
      assertTrue(3.0 == r1.getArrayFloat(0));
      assertTrue(2.5 == r1.getArrayFloat(1));

      Root r2 = new Root(jcas);
      r2.setArrayRef(new FSArray(jcas, 3));
      EndOfSentence eos1 = new EndOfSentence(jcas);
      EndOfSentence eos2 = new EndOfSentence(jcas);

      r2.setArrayRef(0, eos1);
      r2.setArrayRef(1, eos2);
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

   *
   * @see org.apache.uima.jcas.JCas#getFSArray0L()
   */
  public FSArray getFSArray0L() {
    if (null == sharedView.fsArray0L)
      sharedView.fsArray0L = new FSArray(this, 0);
    return sharedView.fsArray0L;
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

  public static ArrayFS createArrayFS(CAS aCas, FeatureStructure[] aArray) {
    return fillArrayFS(aCas.createArrayFS(aArray.length), asList(aArray));
  }

  public static FSArray createFSArray(JCas aJCas, Collection<? extends FeatureStructure> aCollection) {
    return fillArrayFS(new FSArray(aJCas, aCollection.size()), aCollection);
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

  public static FSArray createFSArray(JCas aJCas, Collection<? extends FeatureStructure> aCollection) {
    return fillArrayFS(new FSArray(aJCas, aCollection.size()), aCollection);
  }

  public static FSArray createFSArray(JCas aJCas, FeatureStructure[] aArray) {
    return fillArrayFS(new FSArray(aJCas, aArray.length), asList(aArray));
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

        eventMention.setConfidence(1.0f);
        eventMention.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);

        // add the links between event, mention and properties
        event.setProperties(eventProperties);
        event.setMentions(new FSArray(jCas, 1));
        event.setMentions(0, eventMention);
        eventMention.setEvent(event);

        // add the annotations to the indexes
        eventProperties.addToIndexes();
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

      UmlsConcept umlsConcept = new UmlsConcept(jCas);
      umlsConcept.setCui(code);
      ontologyConcept = umlsConcept;
    }
    ontologyConcept.addToIndexes();
    entityMention.setOntologyConceptArr(new FSArray(jCas, 1));
    entityMention.setOntologyConceptArr(0, ontologyConcept);

    // add entity mention to CAS
    entityMention.addToIndexes();
    idAnnotationMap.put(annotation.id, entityMention);
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

          Set conceptSet = (Set) conceptMap.get(neType);

          // Skip updating CAS if all Concepts for this type were filtered out
          // for this span.
          if (conceptSet.size() > 0) {
            FSArray conceptArr = new FSArray(jcas, conceptSet.size());
            int arrIdx = 0;
            Iterator conceptItr = conceptSet.iterator();
            while (conceptItr.hasNext())
            {
              UmlsConcept uc = (UmlsConcept) conceptItr.next();
              conceptArr.set(arrIdx, uc);
              arrIdx++;
            }

            IdentifiedAnnotation neAnnot;
            if (neType.intValue() == CONST.NE_TYPE_ID_DRUG) {
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSArray

        }
      }

      if (validCodeCol.size() > 0)
      {
        FSArray ocArr = createOntologyConceptArr(jcas, validCodeCol);
        IdentifiedAnnotation neAnnot = new MedicationEventMention(jcas); // medication NEs are EventMention
        neAnnot.setTypeID(CONST.NE_TYPE_ID_DRUG);
        neAnnot.setBegin(neBegin);
        neAnnot.setEnd(neEnd);
        neAnnot.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_DICT_LOOKUP);
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.