Examples of FrequencyAnnotation


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

      {

        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.FrequencyAnnotation

          int holdFrequencyBeginOffset = 0, holdFrequencyEndOffset = 0;
          boolean onlyNeedOneFrequency = false;

          while (frequencyItr.hasNext() && !onlyNeedOneFrequency)
          {
            FrequencyAnnotation fa = (FrequencyAnnotation) frequencyItr.next();

            if (dm.frequency != null
                && dm.frequency.getFrequencyMention() == null)
            {
              double curFrequencyValue = new Double(dm.convertFromTextToNum(fa.getCoveredText())).doubleValue();
              String curFreqValueText = new Double(curFrequencyValue).toString();
              dm.setFrequencyElement(curFreqValueText, fa.getBegin(), fa.getEnd());
              frequencyText = curFreqValueText;
            }
            onlyNeedOneFrequency = true;

            holdFrequency.add(fa);
            holdFrequencyBeginOffset = fa.getBegin();
            holdFrequencyEndOffset = fa.getEnd();
          }
        }
        boolean foundPRN = false;
        String frequencyUnitText = null;
        if (!keepNoChangeStatus || (drugTokenAnt.getFrequencyUnit() == null)) {
View Full Code Here

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

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

        if (nea.getBegin()>=begin && nea.getEnd() <= end ) {
          if (!highest) wantMuliple = false;
          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.FrequencyAnnotation

          counter++;
        }
      }
    } else if (elementType == FrequencyAnnotation.type) {
      while (neItr.hasNext()) {
        FrequencyAnnotation nea = (FrequencyAnnotation) 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 == 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 == MedicationMention.type) {
      while (neItr.hasNext()) {
        MedicationMention nea = (MedicationMention) 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.FrequencyAnnotation

    }
    neItr = FSUtil.getAnnotationsIteratorInSpan(jcas,
        FrequencyAnnotation.type, begin, end);
    while (neItr.hasNext()) {
      FrequencyAnnotation nea = (FrequencyAnnotation) 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.FrequencyAnnotation

        }
      }
    } else if (elementType == FrequencyAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
        FrequencyAnnotation nea = (FrequencyAnnotation) 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 == 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 == MedicationMention.type) {
      int holdEndElement = 0;
      while (neItr.hasNext()) {
        MedicationMention nea = (MedicationMention) 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

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

      }
    }
    Iterator frequencyTokenItr = FSUtil.getAnnotationsIteratorInSpan(jcas,
        FrequencyAnnotation.type, beginPos, endPos);
    while (frequencyTokenItr.hasNext()){
      FrequencyAnnotation focusToken = (FrequencyAnnotation) frequencyTokenItr.next();
      String localFreq = null;
      if ((localFreq = findFrequencyElement(jcas, focusToken
          .getBegin(), focusToken.getEnd())) == null) {

        frequency = new FrequencyElement(focusToken
            .getCoveredText(), focusToken.getBegin(),
            focusToken.getEnd());
      } else if ((frequency != null && localFreq != null)
          && (frequency.getFrequencyMention().compareTo("") != 0)
          && (localFreq.compareTo("") != 0)
          && (parseIntValue(localFreq) > parseIntValue(frequency
              .getFrequencyMention()) && findMaxValue == true)) {
        // Need a way to find the largest frequency and/or convert
        // it to factor daily dosage

        setFrequencyElement(localFreq, focusToken.getBegin(),
            focusToken.getEnd());
    } else {
      setFrequencyElement(localFreq, focusToken.getBegin(),
          focusToken.getEnd());
    }
    } 
      Iterator frequencyUnitTokenItr = FSUtil.getAnnotationsIteratorInSpan(jcas,
          FrequencyUnitAnnotation.type, beginPos, endPos);
      while (frequencyUnitTokenItr.hasNext()){
        FrequencyUnitAnnotation focusToken = (FrequencyUnitAnnotation) frequencyUnitTokenItr.next();
        String localFreq = null;
        if ((localFreq = findFrequencyUnitElement(jcas,
                focusToken.getBegin(), focusToken.getEnd())) == null) {
          frequencyUnit = new FrequencyUnitElement(focusToken
              .getCoveredText(), focusToken.getBegin(),
              focusToken.getEnd());
        } else if (frequencyUnit == null
            && findMaxValue == true) {
          // Need a way to find the largest frequency and/or convert
          // it to factor daily dosage
          setFrequencyUnitElement(localFreq, focusToken.getBegin(),
              focusToken.getEnd());
        }
      }
      Iterator strengthUnitTokenItr = FSUtil.getAnnotationsIteratorInSpan(jcas, StrengthUnitAnnotation.type, beginPos, endPos);
      while (strengthUnitTokenItr.hasNext()){
        StrengthUnitAnnotation focusToken = (StrengthUnitAnnotation) strengthUnitTokenItr.next();
        setStrengthUnitElement(focusToken.getCoveredText(),
            focusToken.getBegin(), focusToken.getEnd());
      }
      Iterator strengthTokenItr = FSUtil.getAnnotationsIteratorInSpan(jcas, StrengthAnnotation.type, beginPos, endPos);
      while (strengthTokenItr.hasNext()){
        StrengthAnnotation focusToken = (StrengthAnnotation) strengthTokenItr.next();
        

            String localStrength = null;
            if ((localStrength = findStrengthElement(jcas, focusToken
                .getBegin(), focusToken.getEnd())) == null) {
              strength = new StrengthElement(focusToken.getCoveredText(),
                  focusToken.getBegin(), focusToken.getEnd());
            } else {
              if (strength != null) {
                // check for range and compare
                int spacePosition = strength.getStrengthMention()
                    .indexOf(" ");
                int spacePos = localStrength
                .indexOf(" ");
                if (spacePosition > 0 && spacePos > 0
                    && parseDoubleValue(strength
                        .getStrengthMention().substring(0,
                            spacePosition)) < parseDoubleValue(localStrength
                        .substring(0, localStrength
                            .indexOf(" ")))&& findMaxValue == true) {
                  setStrengthElement(localStrength, focusToken
                      .getBegin(), focusToken.getEnd());
                } else {
                  String stringRange = strength.getStrengthMention();
                  int hyphPosition = 0;
                  if ((stringRange.length() > 0)
                      && (stringRange.indexOf('-') > 0)) {
                    hyphPosition = stringRange.indexOf('-');
                    Double firstValue = new Double(
                        parseDoubleValue(stringRange
                            .subSequence(0, hyphPosition)));
                    Double secondValue = new Double(
                        parseDoubleValue(stringRange
                            .substring(hyphPosition + 2)));
                    if (firstValue.doubleValue() >= secondValue
                        .doubleValue() && findMaxValue == true) {
                      setStrengthElement(firstValue.toString(),
                          focusToken.getBegin(), focusToken
                              .getEnd());
                    } else {
                      setStrengthElement(firstValue.toString(),
                          focusToken.getBegin(), focusToken
                              .getEnd());
                    }
                  }
                }
              } else if ((localStrength.length() > 0)
                  && (localStrength.indexOf('-') > 0)) {

                int hyphPosition = 0;

                hyphPosition = localStrength.indexOf('-');
                Double firstValue = new Double(
                    parseDoubleValue(localStrength.subSequence(0,
                        hyphPosition)));
                Double secondValue = new Double(
                    parseDoubleValue(localStrength
                        .substring(hyphPosition + 2)));
                if (firstValue.doubleValue() >= secondValue
                    .doubleValue() && findMaxValue == true) {
                  setStrengthElement(firstValue.toString(),
                      focusToken.getBegin(), focusToken.getEnd());
                } else {
                  setStrengthElement(firstValue.toString(),
                      focusToken.getBegin(), focusToken.getEnd());
                }

                setStrengthElement(localStrength,
                    focusToken.getBegin(), focusToken.getEnd());
              } else {
                setStrengthElement(localStrength,
                    focusToken.getBegin(), focusToken.getEnd());
              }
            }
      }
      Iterator formTokenItr = FSUtil.getAnnotationsIteratorInSpan(jcas, FormAnnotation.type, beginPos, endPos);
      while (formTokenItr.hasNext()){
        FormAnnotation focusToken = (FormAnnotation) formTokenItr.next();
        String localForm = null;
        if ((localForm = findFormElement(jcas, focusToken.getBegin(),
            focusToken.getEnd())) == null) {
          form = new FormElement(focusToken.getCoveredText(),
              focusToken.getBegin(), focusToken.getEnd());
        } else {
          setFormElement(localForm, focusToken.getBegin(), focusToken
              .getEnd());
        }
      }
      Iterator routeTokenItr = FSUtil.getAnnotationsIteratorInSpan(jcas, RouteAnnotation.type, beginPos, endPos);
      while (routeTokenItr.hasNext()){
        RouteAnnotation focusToken = (RouteAnnotation) routeTokenItr.next();
        String localRoute = null;
        if ((localRoute = findRouteElement(jcas, focusToken.getBegin(),
            focusToken.getEnd())) == null) {
          route = new RouteElement(focusToken.getCoveredText(),
              focusToken.getBegin(), focusToken.getEnd());
        } else {
          setRouteElement(localRoute, focusToken.getBegin(),
              focusToken.getEnd());
        }
      }
      Iterator durationTokenItr = FSUtil.getAnnotationsIteratorInSpan(jcas, DurationAnnotation.type, beginPos, endPos);
      while (durationTokenItr.hasNext()){
        DurationAnnotation focusToken = (DurationAnnotation) durationTokenItr.next();
        String localDuration = null;
        if ((localDuration = findDurationElement(jcas, focusToken
            .getBegin(), focusToken.getEnd())) == null) {
          duration = new DurationElement(focusToken.getCoveredText(),
              focusToken.getBegin(), focusToken.getEnd());
        } else {
          setDurationElement(localDuration, focusToken.getBegin(),
              focusToken.getEnd());
        }
      }

     
 
View Full Code Here

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

  private String findFrequencyElement(JCas jcas, int beginOffset, int endOffset) {

    Iterator firItr = FSUtil.getAnnotationsIteratorInSpan(jcas,
        FrequencyAnnotation.type, beginOffset, endOffset + 1);
    while (firItr.hasNext()) {
      FrequencyAnnotation da = (FrequencyAnnotation) firItr.next();
      if (da.getBegin() == beginOffset) {
        int posSpace = da.getCoveredText().indexOf(' ');
        int posHyph = da.getCoveredText().indexOf('-');
        int lastPosHyph = da.getCoveredText().lastIndexOf('-');
        String firstTerm = da.getCoveredText();
        String lastTerm = da.getCoveredText();
        if (posSpace > 0)
          firstTerm = da.getCoveredText().substring(0, posSpace);
        else if (posHyph > 0)
          firstTerm = firstTerm.substring(0, posHyph);
       
        if (lastPosHyph > 0){
          lastTerm = lastTerm.substring(lastPosHyph+1, lastTerm.length());
View Full Code Here

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

      {

        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.FrequencyAnnotation

          int holdFrequencyBeginOffset = 0, holdFrequencyEndOffset = 0;
          boolean onlyNeedOneFrequency = false;

          while (frequencyItr.hasNext() && !onlyNeedOneFrequency)
          {
            FrequencyAnnotation fa = (FrequencyAnnotation) frequencyItr.next();

            if (dm.frequency != null
                && dm.frequency.getFrequencyMention() == null)
            {
              double curFrequencyValue = new Double(dm.convertFromTextToNum(fa.getCoveredText())).doubleValue();
              String curFreqValueText = new Double(curFrequencyValue).toString();
              dm.setFrequencyElement(curFreqValueText, fa.getBegin(), fa.getEnd());
              frequencyText = curFreqValueText;
            }
            onlyNeedOneFrequency = true;

            holdFrequency.add(fa);
            holdFrequencyBeginOffset = fa.getBegin();
            holdFrequencyEndOffset = fa.getEnd();
          }
        }
        boolean foundPRN = false;
        String frequencyUnitText = null;
        if (!keepNoChangeStatus || (drugTokenAnt.getFrequencyUnit() == null)) {
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.