Package org.apache.uima.jcas.cas

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


        }
        replacementNode.setParent(tree);
       
        tree.setNodeType("CONCEPT");
//        tree.children = new ArrayList<SimpleTree>();
        FSArray children = new FSArray(jcas, 1);
        children.set(0, replacementNode);
        tree.setChildren(children);
//        tree.addChild(replacementNode);
      }
    }
  }
View Full Code Here


    while (uniqueNER.hasNext())
    {

      tokenAnt = (MedicationMention) uniqueNER.next();
      boolean isDrugNER = false;
      FSArray ocArr = tokenAnt.getOntologyConceptArr();
      if (ocArr != null)
      {
        for (int i = 0; i < ocArr.size() && !isDrugNER; i++)
        {
          OntologyConcept oc = (OntologyConcept) ocArr.get(i);

          String scheme = oc.getCodingScheme();
          //if (scheme.compareTo("RXNORM") == 0)
          //{
            isDrugNER = true;
View Full Code Here

    if (resultMatchedTextFeature != null) {
      annotation.setStringValue(resultMatchedTextFeature, matchedText);
    }

    if (matchedTokensFeature != null) {
      FSArray matchedTokens = new FSArray(getJCas(), matched.size());
      FeatureStructure[] featureStructArray = new FeatureStructure[matched.size()];
      matched.toArray(featureStructArray);
      matchedTokens.copyFromArray(featureStructArray, 0, 0, featureStructArray.length);
      annotation.setFeatureValue(matchedTokensFeature, matchedTokens);
      /*
       * FSArray tmp = (FSArray) annotation.getFeatureValue (matchedTokensFeature); FeatureStructure []
       * tmpfs = tmp.toArray (); System.err.println ("FSArray: begin"); for (int i = 0; i <
       * tmpfs.length; i++) { System.err.println (((Annotation) tmpfs[i]).getCoveredText ()); }
View Full Code Here

      uaTerm.setTypeID(new Integer(mfIsStandAlone).intValue());
    }


    List<?> list = getTokenData(jcas, uaTerm);
    FSArray fsArr = new FSArray(jcas, list.size());
   
    for(int i=0; i<list.size(); i++)
      fsArr.set(i, (WordToken)list.get(i));
   
    uaTerm.setRelatedTokens(fsArr);
  
    if (segStatus.compareTo("-1")==0 || segStatus.compareTo("1")!=0) {
      String segId = getSegmentIdContaining(uaTerm, jcas);
View Full Code Here

      return;

    Pairs props = (Pairs) itr.next();

    // create a new property array that is one item bigger
    FSArray propArr = props.getPairs();
    FSArray newPropArr = new FSArray(jcas, propArr.size() + 1);
    for (int i = 0; i < propArr.size(); i++) {
      newPropArr.set(i, propArr.get(i));
    }

    Pair annotVerProp = new Pair(jcas);       
    annotVerProp.setAttribute(iv_annotVerPropKey);
    annotVerProp.setValue(String.valueOf(iv_annotVer));

    // add annotation version prop as last item in array
    newPropArr.set(newPropArr.size() - 1, annotVerProp);
    props.setPairs(newPropArr);
  }
View Full Code Here

          break;
        }
      }

      // assign ontology concept OID values
      FSArray ocArr = neAnnot.getOntologyConceptArr();
      if (ocArr != null) {
        for (int i = 0; i < ocArr.size(); i++) {
          OntologyConcept oc = (OntologyConcept) ocArr.get(i);
          String code = oc.getCode();
          String scheme = oc.getCodingScheme();

          StringBuffer oid = new StringBuffer();
          oid.append(code);
View Full Code Here

  private List<FeatureStructure> getTokens(Annotation ann)
  {
    List<FeatureStructure> l = new ArrayList<FeatureStructure>();
    if(ann instanceof PADLocation)
    {
      FSArray fsa = (((PADLocation)ann).getRelatedTokens());
     
      for(int i=0; fsa!= null && i<fsa.size(); i++)
      {
        if(fsa.get(i)!=null)
        l.add(fsa.get(i));
      }
    }
   
    if(ann instanceof PADTerm)
    {
      FSArray fsa = (((PADTerm)ann).getRelatedTokens());
     
      for(int i=0; fsa!= null && i<fsa.size(); i++)
      {
        if(fsa.get(i)!=null)
        l.add(fsa.get(i));
      }
    }
   
    return l;
  }
View Full Code Here

  {
    WordToken wta = null;
   
    if(ann instanceof PADLocation)
    {
      FSArray fsa = (((PADLocation)ann).getRelatedTokens());
     
      if(fsa!= null && fsa.size()>0)
        wta = (WordToken)fsa.get(0);
    }
   
    if(ann instanceof PADTerm)
    {
      FSArray fsa = (((PADTerm)ann).getRelatedTokens());
     
      if(fsa!= null && fsa.size()>0)
        wta = (WordToken)fsa.get(0);
    }
    if(wta == null)
    {
      System.err.println("Error:");
      System.err.println("["+((ann!=null)?ann.getCoveredText():"")+"] does not have Word Token - "+getClass().getName());
View Full Code Here

  {
    WordToken wta = null;

    if(ann instanceof PADLocation)
    {
      FSArray fsa = (((PADLocation)ann).getRelatedTokens());
     
      for(int i=0;(fsa!= null && i<fsa.size() && fsa.get(i) !=null);i++)
        wta = (WordToken)fsa.get(i);
    }
   
    if(ann instanceof PADTerm)
    {
      FSArray fsa = (((PADTerm)ann).getRelatedTokens());

      for(int i=0;(fsa!= null && i<fsa.size() && fsa.get(i) !=null);i++)
        wta = (WordToken)fsa.get(i);
     
    }
    if(wta == null)
      System.err.println("Error: ["+ann.getCoveredText()+"] does not have Word Token - "+getClass().getName());
   
View Full Code Here

    TopTreebankNode copy = new TopTreebankNode(jcas);
    copy.setNodeType(orig.getNodeType());
    copy.setBegin(orig.getBegin());
    copy.setEnd(orig.getEnd());
    copy.setParent(null);
    copy.setChildren(new FSArray(jcas,1));
    copy.setTreebankParse(orig.getTreebankParse());
    if(orig.getChildren() == null || orig.getChildren().size() == 0){
      System.err.println("WHAT?");
    }
    copy.setChildren(0, getTreeCopy(jcas, orig.getChildren(0)));
View Full Code Here

TOP

Related Classes of org.apache.uima.jcas.cas.FSArray

Copyright © 2018 www.massapicom. 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.