Package org.apache.uima.jcas

Examples of org.apache.uima.jcas.JFSIndexRepository


  /**
   * Generates normalized form for each token annotation.
   * Considers whether it is a <code>WordToken</code> with a canonical form
   */
  private void generateTokenNormForms(JCas jcas) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();

    // Determine and set the normalized form for each <code>BaseToken</code>
    Iterator btaItr = indexes.getAnnotationIndex(BaseToken.type).iterator();
    while (btaItr.hasNext()) {
      BaseToken bta = (BaseToken) btaItr.next();
      String normForm = null;
      if (!(bta instanceof WordToken)) {
        normForm = bta.getCoveredText();
View Full Code Here


  /**
   * Assigns OID and segmentID values to NamedEntities
   */
  private void assignNamedEntityFeats(JCas jcas) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    // Set keySet = new HashSet();
    // List dupList = new ArrayList();

    Set segmentSet = new HashSet();
    Iterator segmentItr = indexes.getAnnotationIndex(Segment.type).iterator();
    while (segmentItr.hasNext()) {
      segmentSet.add(segmentItr.next());
    }

    // For each NE, assign segment ID and assign ontology concept OIDs if applicable
    Iterator neItr = indexes.getAnnotationIndex(IdentifiedAnnotation.type).iterator();
    while (neItr.hasNext()) {
     
      IdentifiedAnnotation neAnnot = (IdentifiedAnnotation) neItr.next();

      // assign segment ID
View Full Code Here

   * passed in prevAnn and currAnn
   */
  private int countAnnotationsOfTypeInSpan(JCas jcas, Annotation prevAnn, Annotation currAnn, int annType)
  {
    int count = 1; //sentence containing the hit is the 0th
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator<?> annotItr = indexes.getAnnotationIndex(annType).iterator();

    while(annotItr.hasNext())
    {
      Annotation tempAnn = (Annotation)annotItr.next();

View Full Code Here

  private List<WordToken> getContainedWordTokens(JCas jcas, WordToken prevWta, WordToken currWta)
  {
    List<WordToken> list = new ArrayList<WordToken>();
   
   
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator<?> annotItr = indexes.getAnnotationIndex(WordToken.type).iterator();

    while (annotItr.hasNext())
    {
      WordToken wta = (WordToken)annotItr.next();
      if(wta.getBegin() >= prevWta.getEnd() && wta.getEnd() <= currWta.getBegin())
View Full Code Here

   * @throws CASException
   */
  private void gatherBoundaries(JCas jcas)
  throws CASException
  {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator<?> annotItr = indexes.getAnnotationIndex(iBoundaryAnnType).iterator();
   
    if(!annotItr.hasNext())
      annotItr = indexes.getAnnotationIndex(iBackupBoundaryAnnType).iterator();
   
    while(annotItr.hasNext())
      boundaryAnns.add(annotItr.next());
  }
View Full Code Here

  }

  private void gatherPairPartOne(JCas jcas, boolean filterOutNegated)
  throws CASException
  {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
   
    //process all PADTerms
    Iterator<?> annotItr = indexes.getAnnotationIndex(iAnnTypePartOneOfPair).iterator();

    //if terms present store them
    while(annotItr.hasNext())
    {
      PADTerm uaTerm = (PADTerm)annotItr.next();
View Full Code Here

    }

  }

  public void process(JCas jcas) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator<?> tokenItr = indexes.getAnnotationIndex(WordToken.type)
        .iterator();

    /*
     * some cases there is no word token for a given jcas So, if initial
     * classVal is "null" this null is assigned for class value and cause
     * error.
     */
    String classVal = Const.CLASS_UNKNOWN;
    while (tokenItr.hasNext()) {
      WordToken token = (WordToken) tokenItr.next();
      String strToken = token.getCoveredText();

      // System.out.println("***word:" + strToken);
      if (strToken == null)
        continue;
      if (!caseSensitive)
        strToken = strToken.toLowerCase();

      if (smokingWords.contains(strToken)) {
        classVal = Const.CLASS_KNOWN;
        // System.out.println("***smoking word found");
        break;
      }
    }

    // This is to check if there is unknown indication words when found
    // smoking related word
    // e.g.: Smoke Detector in-Home------ Yes
    if (classVal.equals(Const.CLASS_KNOWN)) {
      String sen = jcas.getDocumentText(); // This is sentence here!!

      Iterator<String> itr = unknownWords.iterator();
      while (itr.hasNext()) {
        String s = (String) itr.next();
        if (sen.toLowerCase().trim().matches(".*" + s + ".*")) { // need
                                      // trim()!!
          // System.out.println("***UnknownWords|"+s+"|");
          classVal = Const.CLASS_UNKNOWN;
          break;
        }
      }
    }

    // ---
    //
    Iterator<?> neItr = indexes.getAnnotationIndex(
        UnknownSmokerNamedEntityAnnotation.type).iterator();
    while (neItr.hasNext()) {
      UnknownSmokerNamedEntityAnnotation neAnn = (UnknownSmokerNamedEntityAnnotation) neItr
          .next();
      System.out.println("***UnknownNamedEntity|"
 
View Full Code Here

  }
 
  private void gatherPairPartTwo(JCas jcas, boolean filterOutNegated)
  throws CASException
  {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
   
    //process all PADTerms
    Iterator<?> annotItr = indexes.getAnnotationIndex(iAnnTypePartTwoOfPair).iterator();

    //if terms present store them
    while(annotItr.hasNext())
    {
      PADLocation uaLoc = (PADLocation)annotItr.next();
View Full Code Here

    List<ClassifiableEntry> entryList = new ArrayList<ClassifiableEntry>();
    String recordID = null;

    if (iv_logger.isInfoEnabled()) {
       JFSIndexRepository indexes = jcas.getJFSIndexRepository();
       FSIterator<TOP> documentIDIterator = indexes.getAllIndexedFS(DocumentID.type);
      if (documentIDIterator.hasNext()) {
        DocumentID didAnn = (DocumentID) documentIDIterator.next();
        recordID = didAnn.getDocumentID();

        if (iv_logger.isInfoEnabled())
View Full Code Here

  public void process(JCas jcas)
      throws AnalysisEngineProcessException
  {
    // iterate over source objects in JCas
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator srcObjItr = indexes.getAnnotationIndex(org.apache.ctakes.typesystem.type.textspan.Segment.type).iterator();
    org.apache.ctakes.typesystem.type.textspan.Segment segment = null;
   
    while (srcObjItr.hasNext())
    {
      TOP srcObj = (TOP) srcObjItr.next();
View Full Code Here

TOP

Related Classes of org.apache.uima.jcas.JFSIndexRepository

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.