Examples of FrequencyUnitAnnotation


Examples of org.apache.ctakes.drugner.type.FrequencyUnitAnnotation

        FrequencyUnitToken fut = (FrequencyUnitToken) frequencyUnitTokenItr.next();

        begSegFUT = fut.getStartOffset();
        endSegFUT = fut.getEndOffset();
        FrequencyUnitAnnotation ma = new FrequencyUnitAnnotation(jcas,
            begSegFUT, endSegFUT);
        ma.setPeriod(new Float(fut.getFrequencyUnitQuantity()).floatValue());
        ma.addToIndexes();

      }
      // The frequencyFSM can take advantage of the frequencyUnit to
      // establish conditions via the override
      Set frequencyTokenSet = iv_frequencyFSM.execute(baseTokenList,
          frequencyUnitTokenSet, rangeTokenSet);
      boolean foundFrequency = false;
      Iterator frequencyTokenItr = frequencyTokenSet.iterator();
      int begSegFT = 0, endSegFT = 0;
      while (frequencyTokenItr.hasNext())
      {

        FrequencyToken ft = (FrequencyToken) frequencyTokenItr.next();
        begSegFT = ft.getStartOffset();
        endSegFT = ft.getEndOffset();
        FrequencyAnnotation ma = new FrequencyAnnotation(jcas, begSegFT,
            endSegFT);
        ma.addToIndexes();

      }

      /* Check again if confidence was found during frequency check */

      Set durationTokenSet = iv_durationFSM.execute(baseTokenList,
          rangeTokenSet);
      Iterator durationTokenItr = durationTokenSet.iterator();

      int begSegDU = 0, endSegDU = 0;
      while (durationTokenItr.hasNext())
      {
        DurationToken du = (DurationToken) durationTokenItr.next();
        begSegDU = du.getStartOffset();
        endSegDU = du.getEndOffset();
        DurationAnnotation ma = new DurationAnnotation(jcas, begSegDU, endSegDU);
        // dm.setDurationElement(jcas, begSegDU, endSegDU);
        ma.addToIndexes();
        // loadandAppend("./frequencyTable.csv", ma.getCoveredText(),
        // true);
      }

    } catch (Exception e)
View Full Code Here

Examples of org.apache.ctakes.drugner.type.FrequencyUnitAnnotation

          boolean onlyNeedOneFrequencyUnit = false;


          while (frequencyUnitItr.hasNext() && !onlyNeedOneFrequencyUnit)
          {
            FrequencyUnitAnnotation fua = (FrequencyUnitAnnotation) frequencyUnitItr.next();
            if (holdFrequencyUnitBeginOffset != fua.getBegin()
                && holdFrequencyUnitEndOffset != fua.getEnd()
                && relatedStatus != null)
            {
              double curFrequencyUnitValue = new Float(fua.getPeriod()).doubleValue();

              boolean findLowValue = true;
              if (relatedStatus[0].compareTo(DrugChangeStatusToken.INCREASE) == 0)
              {
                if (curFrequencyUnitValue > frequencyUnitValue)
                {
                  frequencyUnitValue = curFrequencyUnitValue;
                  frequencyUnitText = dm.getFrequencyUnitElement();
                }
              } else if (relatedStatus[0] == null
                  || relatedStatus[0].compareTo(DrugChangeStatusToken.DECREASE) == 0)
              {
                if (findLowValue)
                  frequencyUnitValue = curFrequencyUnitValue;
                if (curFrequencyUnitValue <= frequencyUnitValue)
                {
                  frequencyUnitValue = curFrequencyUnitValue;
                  frequencyUnitText = dm.getFrequencyUnitElement();
                }
                findLowValue = false;
              }
            } else
            {
              if (fua.getPeriod() == FrequencyUnitToken.QUANTITY_PRN)
                foundPRN = true;
              else
              {
                frequencyUnitText = dm.getFrequencyUnitElement();

                if (!maxExists)
                {
                  onlyNeedOneStrength = true;
                }

              }
            }

            holdFrequencyUnit.add(fua);
            holdFrequencyUnitBeginOffset = fua.getBegin();
            holdFrequencyUnitEndOffset = fua.getEnd();
          }

        }
        if (recurseNER != null && recurseNER.getDrugChangeStatus() != null
            && relatedStatus[0] != null  && dm.changeStatus == null)
View Full Code Here

Examples of org.apache.ctakes.drugner.type.FrequencyUnitAnnotation

          lastLocation[0] = nea.getBegin();
          lastLocation[1] = nea.getEnd();
        }      }
    } else if (elementType == FrequencyUnitAnnotation.type) {
      while (neItr.hasNext()&& wantMuliple) {
        FrequencyUnitAnnotation nea = (FrequencyUnitAnnotation) neItr.next();

        if (nea.getBegin()>=begin && nea.getEnd() <= end ) {
          if (!highest) wantMuliple = false;
          lastLocation[0] = nea.getBegin();
          lastLocation[1] = nea.getEnd();
        }      }
    } else if (elementType == DosagesAnnotation.type) {
      while (neItr.hasNext()&& wantMuliple) {
        DosagesAnnotation nea = (DosagesAnnotation) neItr.next();

        if (nea.getBegin()>=begin && nea.getEnd() <= end ) {
          if (!highest) wantMuliple = false;
          lastLocation[0] = nea.getBegin();
          lastLocation[1] = nea.getEnd();
        }
      }
    }

    return lastLocation;
View Full Code Here

Examples of org.apache.ctakes.drugner.type.FrequencyUnitAnnotation

          location[counter][1]= lastLocation[1];
          counter++;
        }      }
    } else if (elementType == FrequencyUnitAnnotation.type) {
      while (neItr.hasNext()) {
        FrequencyUnitAnnotation nea = (FrequencyUnitAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (nea.getBegin()>=begin && nea.getEnd() <= end && (counter == || (counter> 0 && lastLocation[0] !=  location[counter - 1][0]))) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    }    else if (elementType == DosagesAnnotation.type) {
      while (neItr.hasNext()) {
        DosagesAnnotation nea = (DosagesAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (nea.getBegin()>=begin && nea.getEnd() <= end && (counter == || (counter> 0 && lastLocation[0] !=  location[counter - 1][0]))) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    }else if (elementType == RouteAnnotation.type) {
      while (neItr.hasNext()) {
        RouteAnnotation nea = (RouteAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (nea.getBegin()>=begin && nea.getEnd() <= end) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    } else if (elementType == FormAnnotation.type) {
      while (neItr.hasNext()) {
        FormAnnotation nea = (FormAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (nea.getBegin()>=begin && nea.getEnd() <= end && (counter == || (counter> 0 && lastLocation[0] !=  location[counter - 1][0]))) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    }   
    else if (elementType == DurationAnnotation.type) {
      while (neItr.hasNext()) {
        DurationAnnotation nea = (DurationAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (nea.getBegin()>=begin && nea.getEnd() <= end && (counter == || (counter> 0 && lastLocation[0] !=  location[counter - 1][0]))) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }

    }
    else if (elementType == DrugChangeStatusAnnotation.type) {
      while (neItr.hasNext()) {
        DrugChangeStatusAnnotation nea = (DrugChangeStatusAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (nea.getBegin()>=begin && nea.getEnd() <= end && (counter == || (counter> 0 && lastLocation[0] !=  location[counter - 1][0]))) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }

    } else if (elementType == MedicationEventMention.type) {
      while (neItr.hasNext()) {
        MedicationEventMention nea = (MedicationEventMention) neItr.next();
        if(nea.getTypeID()==1 || nea.getTypeID()==0) {
          lastLocation[0]= nea.getBegin();
          lastLocation[1] = nea.getEnd();
          if ((counter == 0 || lastLocation[0] != location[counter-1][0]) && (nea.getBegin()>=begin && nea.getEnd() <= end)) {
            location[counter][0]= lastLocation[0];
            location[counter][1]= lastLocation[1];
            counter++;
          }

        }
      }
    } else if (elementType == PunctuationToken.type) {
      while (neItr.hasNext()) {
        boolean foundPair = false;
        PunctuationToken nea = (PunctuationToken) neItr.next();
        if (nea.getCoveredText().compareTo("(")==0)
          lastLocation[0] = nea.getBegin();
        else if (nea.getCoveredText().compareTo(")")==0) {
          lastLocation[1] = nea.getEnd();
          foundPair = true;
        }
        if (nea.getBegin()>=begin && nea.getEnd() <= end && foundPair && (counter == || (counter> 0 && lastLocation[0] !=  location[counter - 1][0]))) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }
View Full Code Here

Examples of org.apache.ctakes.drugner.type.FrequencyUnitAnnotation

      // }
    }
    neItr = FSUtil.getAnnotationsIteratorInSpan(jcas,
        FrequencyUnitAnnotation.type, begin, end);
    while (neItr.hasNext()) {
      FrequencyUnitAnnotation nea = (FrequencyUnitAnnotation) neItr.next();
      // if (nea.getBegin() >= begin && nea.getEnd() <= end) {
      numElements++;
      // }
    }
    neItr = FSUtil.getAnnotationsIteratorInSpan(jcas,
View Full Code Here

Examples of org.apache.ctakes.drugner.type.FrequencyUnitAnnotation

          counter++;
        }      }
    } else if (elementType == FrequencyUnitAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
        FrequencyUnitAnnotation nea = (FrequencyUnitAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (holdBeginElement < nea.getBegin() && nea.getBegin()>=begin && nea.getEnd() <= end && nea.getEnd() > holdEndElement) {
          holdBeginElement = location[counter][0]= lastLocation[0];
          holdEndElement = location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    }    else if (elementType == DosagesAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
        DosagesAnnotation nea = (DosagesAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (holdBeginElement < nea.getBegin() && nea.getBegin()>=begin && nea.getEnd() <= end && nea.getEnd() > holdEndElement) {
          holdBeginElement = location[counter][0]= lastLocation[0];
          holdEndElement = location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    }else if (elementType == RouteAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
        RouteAnnotation nea = (RouteAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (holdBeginElement < nea.getBegin() && nea.getBegin()>=begin && nea.getEnd() <= end && nea.getEnd() > holdEndElement) {
          holdBeginElement = location[counter][0]= lastLocation[0];
          holdEndElement = location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    } else if (elementType == FormAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
        FormAnnotation nea = (FormAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (holdBeginElement < nea.getBegin() && nea.getBegin()>=begin && nea.getEnd() <= end && nea.getEnd() > holdEndElement) {
          holdBeginElement = location[counter][0]= lastLocation[0];
          holdEndElement = location[counter][1]= lastLocation[1];
          counter++;
        }
      }
    }   
    else if (elementType == DurationAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
        DurationAnnotation nea = (DurationAnnotation) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (holdBeginElement < nea.getBegin() && nea.getBegin()>=begin && nea.getEnd() <= end && nea.getEnd() > holdEndElement) {
          holdBeginElement = location[counter][0]= lastLocation[0];
          holdEndElement = location[counter][1]= lastLocation[1];
          counter++;
        }
      }

    }
    else if (elementType == NewlineToken.type) {
      int holdBeginElement = 0;
      while (neItr.hasNext()) {
        NewlineToken nea = (NewlineToken) neItr.next();
        lastLocation[0] = nea.getBegin();
        lastLocation[1] = nea.getEnd();
        if (holdBeginElement < nea.getBegin() && nea.getBegin()>=begin && nea.getEnd() <= end) {
          holdBeginElement = location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }

    } else if (elementType == MedicationEventMention.type) {
      int holdEndElement = 0;
      while (neItr.hasNext()) {
        MedicationEventMention nea = (MedicationEventMention) neItr.next();
        if(nea.getTypeID()==1 || nea.getTypeID()==0) {
          lastLocation[0]= nea.getBegin();
          lastLocation[1] = nea.getEnd();
          if ((counter == 0 || lastLocation[0] != location[counter-1][0]) && (nea.getBegin()>=begin && nea.getEnd() <= end)) {
            location[counter][0]= lastLocation[0];
            holdEndElement = location[counter][1] = lastLocation[1];
            counter++;
          } else if (counter > 0 && holdEndElement > lastLocation[1]) {
            holdEndElement = location[counter-1][1] = lastLocation[1];
          }

        }
      }
    } else if (elementType == PunctuationToken.type) {
      while (neItr.hasNext()) {
        int holdBeginElement = 0;
        boolean foundPair = false;
        PunctuationToken nea = (PunctuationToken) neItr.next();
        if (nea.getCoveredText().compareTo("(")==0 || nea.getCoveredText().compareTo("[")==0)
          lastLocation[0] = nea.getBegin();
        else if (nea.getCoveredText().compareTo(")")==0 || nea.getCoveredText().compareTo("]")==0) {
          lastLocation[1] = nea.getEnd();
          foundPair = true;
        }
        if (holdBeginElement < nea.getBegin() && nea.getBegin()>=begin && nea.getEnd() <= end && foundPair) {
          location[counter][0]= lastLocation[0];
          location[counter][1]= lastLocation[1];
          counter++;
        }
      }
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.