Examples of SubSectionIndicator


Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

  {
    List holdList = new ArrayList();
    // SubSectionIndicator tempSsi = null;
    for (int i = 0; i < holdOutSet.length - 1; i++)
    {
      SubSectionIndicator hos1 = (SubSectionIndicator) holdOutSet[i];
      SubSectionIndicator hos2 = (SubSectionIndicator) holdOutSet[i + 1];

      if (hos1.getStartOffset() > hos2.getStartOffset())
      {
        // tempSsi = hos2;
        holdOutSet[i + 1] = hos1;
        holdOutSet[i] = hos2;
        sortSubSectionInd(holdOutSet);
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

      {
    List sortedSubSecInds = sortSubSectionInd(subSectionIndSet.toArray());

    for (int i = 0, endBodyOffset = 0; i < sortedSubSecInds.size(); i++, endBodyOffset = 0)
    {
      SubSectionIndicator ssi = (SubSectionIndicator) sortedSubSecInds.get(i);
      Segment segment = getSegmentContainingOffsets(jcas, ssi.getStartOffset(),
          ssi.getEndOffset());
      endBodyOffset = segment.getEnd(); // backup

      SubSectionAnnotation ssa = new SubSectionAnnotation(jcas);

      ssa.setBegin(ssi.getStartOffset());
      // header is marked by the indicator
      ssa.setSubSectionHeaderBegin(ssi.getStartOffset());
      ssa.setSubSectionHeaderEnd(ssi.getEndOffset());

      // body begins where SubSectionIndicator ends
      ssa.setSubSectionBodyBegin(ssi.getEndOffset() + 1);

      if (i + 1 < sortedSubSecInds.size()) // i is not the last element
      {
        SubSectionIndicator nextSsi = (SubSectionIndicator) sortedSubSecInds.get(i + 1);
        endBodyOffset = getSubSectionAnnotationBodyEnd(segment, nextSsi);

      } else
        // this was the last SubSectionIndicator
      {
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

  {
    List holdList = new ArrayList();
    // SubSectionIndicator tempSsi = null;
    for (int i = 0; i < holdOutSet.length - 1; i++)
    {
      SubSectionIndicator hos1 = (SubSectionIndicator) holdOutSet[i];
      SubSectionIndicator hos2 = (SubSectionIndicator) holdOutSet[i + 1];

      if (hos1.getStartOffset() > hos2.getStartOffset())
      {
        // tempSsi = hos2;
        holdOutSet[i + 1] = hos1;
        holdOutSet[i] = hos2;
        sortSubSectionInd(holdOutSet);
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

      {
    List sortedSubSecInds = sortSubSectionInd(subSectionIndSet.toArray());

    for (int i = 0, endBodyOffset = 0; i < sortedSubSecInds.size(); i++, endBodyOffset = 0)
    {
      SubSectionIndicator ssi = (SubSectionIndicator) sortedSubSecInds.get(i);
      Segment segment = getSegmentContainingOffsets(jcas, ssi.getStartOffset(),
          ssi.getEndOffset());
      endBodyOffset = segment.getEnd(); // backup

      SubSectionAnnotation ssa = new SubSectionAnnotation(jcas);

      ssa.setBegin(ssi.getStartOffset());
      // header is marked by the indicator
      ssa.setSubSectionHeaderBegin(ssi.getStartOffset());
      ssa.setSubSectionHeaderEnd(ssi.getEndOffset());

      // body begins where SubSectionIndicator ends
      ssa.setSubSectionBodyBegin(ssi.getEndOffset() + 1);

      if (i + 1 < sortedSubSecInds.size()) // i is not the last element
      {
        SubSectionIndicator nextSsi = (SubSectionIndicator) sortedSubSecInds.get(i + 1);
        endBodyOffset = getSubSectionAnnotationBodyEnd(segment, nextSsi);

      } else
        // this was the last SubSectionIndicator
      {
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

  {
    List holdList = new ArrayList();
    // SubSectionIndicator tempSsi = null;
    for (int i = 0; i < holdOutSet.length - 1; i++)
    {
      SubSectionIndicator hos1 = (SubSectionIndicator) holdOutSet[i];
      SubSectionIndicator hos2 = (SubSectionIndicator) holdOutSet[i + 1];

      if (hos1.getStartOffset() > hos2.getStartOffset())
      {
        // tempSsi = hos2;
        holdOutSet[i + 1] = hos1;
        holdOutSet[i] = hos2;
        sortSubSectionInd(holdOutSet);
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

      {
    List sortedSubSecInds = sortSubSectionInd(subSectionIndSet.toArray());

    for (int i = 0, endBodyOffset = 0; i < sortedSubSecInds.size(); i++, endBodyOffset = 0)
    {
      SubSectionIndicator ssi = (SubSectionIndicator) sortedSubSecInds.get(i);
      Segment segment = getSegmentContainingOffsets(jcas, ssi.getStartOffset(),
          ssi.getEndOffset());
      endBodyOffset = segment.getEnd(); // backup

      SubSectionAnnotation ssa = new SubSectionAnnotation(jcas);

      ssa.setBegin(ssi.getStartOffset());
      // header is marked by the indicator
      ssa.setSubSectionHeaderBegin(ssi.getStartOffset());
      ssa.setSubSectionHeaderEnd(ssi.getEndOffset());

      // body begins where SubSectionIndicator ends
      ssa.setSubSectionBodyBegin(ssi.getEndOffset() + 1);

      if (i + 1 < sortedSubSecInds.size()) // i is not the last element
      {
        SubSectionIndicator nextSsi = (SubSectionIndicator) sortedSubSecInds.get(i + 1);
        endBodyOffset = getSubSectionAnnotationBodyEnd(segment, nextSsi);

      } else
        // this was the last SubSectionIndicator
      {
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

            endToken = token;
          }

          BaseToken startToken = (BaseToken) tokens
              .get(tokenStartIndex);
          SubSectionIndicator subs = null;
          if (fsm.equals(iv_subSectionIDProbableMachine)) {
            subs = new SubSectionIndicator(startToken
                .getStartOffset(), endToken.getEndOffset(),
                SubSectionIndicator.PROBABLE_STATUS);
          } else if (fsm.equals(iv_subSectionIDHistoryMachine)) {
            subs = new SubSectionIndicator(startToken
                .getStartOffset(), endToken.getEndOffset(),
                SubSectionIndicator.HISTORY_STATUS);
          } else if (fsm.equals(iv_subSectionIDConfirmMachine)) {
            subs = new SubSectionIndicator(startToken
                .getStartOffset(), endToken.getEndOffset(),
                SubSectionIndicator.CONFIRMED_STATUS);
          } else
            subs = new SubSectionIndicator(startToken
                .getStartOffset(), endToken.getEndOffset(),
                SubSectionIndicator.FAMILY_HISTORY_STATUS);
          outSet.add(subs);

          fsm.reset();
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

  {
    List holdList = new ArrayList();
    // SubSectionIndicator tempSsi = null;
    for (int i = 0; i < holdOutSet.length - 1; i++)
    {
      SubSectionIndicator hos1 = (SubSectionIndicator) holdOutSet[i];
      SubSectionIndicator hos2 = (SubSectionIndicator) holdOutSet[i + 1];

      if (hos1.getStartOffset() > hos2.getStartOffset())
      {
        // tempSsi = hos2;
        holdOutSet[i + 1] = hos1;
        holdOutSet[i] = hos2;
        sortSubSectionInd(holdOutSet);
View Full Code Here

Examples of org.apache.ctakes.drugner.fsm.output.util.SubSectionIndicator

      {
    List sortedSubSecInds = sortSubSectionInd(subSectionIndSet.toArray());

    for (int i = 0, endBodyOffset = 0; i < sortedSubSecInds.size(); i++, endBodyOffset = 0)
    {
      SubSectionIndicator ssi = (SubSectionIndicator) sortedSubSecInds.get(i);
      Segment segment = getSegmentContainingOffsets(jcas, ssi.getStartOffset(),
          ssi.getEndOffset());
      endBodyOffset = segment.getEnd(); // backup

      SubSectionAnnotation ssa = new SubSectionAnnotation(jcas);

      ssa.setBegin(ssi.getStartOffset());
      // header is marked by the indicator
      ssa.setSubSectionHeaderBegin(ssi.getStartOffset());
      ssa.setSubSectionHeaderEnd(ssi.getEndOffset());

      // body begins where SubSectionIndicator ends
      ssa.setSubSectionBodyBegin(ssi.getEndOffset() + 1);

      if (i + 1 < sortedSubSecInds.size()) // i is not the last element
      {
        SubSectionIndicator nextSsi = (SubSectionIndicator) sortedSubSecInds.get(i + 1);
        endBodyOffset = getSubSectionAnnotationBodyEnd(segment, nextSsi);

      } else
        // this was the last SubSectionIndicator
      {
View Full Code Here

Examples of org.apache.ctakes.padtermspotter.fsm.output.SubSectionIndicator

      subSectionMatchTokenItr.next();

    while (subSectionTokenItr.hasNext()) {
      boolean correctOrder = false;

      SubSectionIndicator subsectionNext = null;
      SubSectionIndicator subsectionThis = (SubSectionIndicator) subSectionTokenItr
          .next();

      while (subSectionMatchTokenItr.hasNext() && !correctOrder) {
        subsectionNext = (SubSectionIndicator) subSectionMatchTokenItr
            .next();
        if (subsectionThis.getStartOffset() < subsectionNext
            .getStartOffset()) {
          correctOrder = true;
        }
      }

      SubSection subsectionAnnotation = new SubSection(jcas,
          subsectionThis.getStartOffset(),
          subsectionThis.getEndOffset());
      // Always set the beginning of the subsection at the next position
      // of the subsectionAnnotation
      subsectionAnnotation.setSubSectionBodyBegin(subsectionAnnotation
          .getEnd() + 1);

      boolean foundEnd = false;
      Set segmentSet = new HashSet();
      Iterator<?> segmentItr = indexes.getAnnotationIndex(Segment.type)
          .iterator();
      while (segmentItr.hasNext()) {
        segmentSet.add(segmentItr.next());
      }
      Iterator<?> segItr = segmentSet.iterator();
      // While there are segments
      while (segItr.hasNext()) {

        Segment segmentAnnotation = (Segment) segItr.next();
        if (segmentAnnotation.getBegin() <= subsectionThis
            .getStartOffset()
            && segmentAnnotation.getEnd() >= subsectionThis
                .getStartOffset()) {
          // Look at each sentence within the current segment
          Iterator<?> sentenceItr = FSUtil
              .getAnnotationsInSpanIterator(jcas, Sentence.type,
                  segmentAnnotation.getBegin(),
                  segmentAnnotation.getEnd());
          Sentence sentenceAnnotation = null;
          // while there are still sentences and current subsection
          // end isn't found
          while (sentenceItr.hasNext() && !foundEnd) {
            sentenceAnnotation = (Sentence) sentenceItr.next();
            if (!foundEnd && (subsectionNext != null)) {
              // correct order?
              if (subsectionNext.getStartOffset() > subsectionThis
                  .getStartOffset()) {

                // If the starting offset of the next subsection
                // is
                // greater than or equal to the end of the
                // current sentence
                // (and the end of this sentence is greater than
                // the end of
                // the current subsectionAnnotation) and the
                // beginning of the
                // current sentence is not equal to the current
                // subsection end.
                if (subsectionNext.getStartOffset() >= sentenceAnnotation
                    .getEnd()
                    && (sentenceAnnotation.getEnd() > subsectionAnnotation
                        .getEnd())
                    && (sentenceAnnotation.getBegin() != subsectionThis
                        .getStartOffset())) {
                  int newLineCount = 0;
                  Iterator<?> baseItr = FSUtil
                      .getAnnotationsInSpanIterator(
                          jcas,
                          org.apache.ctakes.typesystem.type.syntax.BaseToken.type,
                          sentenceAnnotation.getEnd(),
                          subsectionNext
                              .getStartOffset() - 1);
                  while (baseItr.hasNext()) {
                    org.apache.ctakes.typesystem.type.syntax.BaseToken checkToken = (org.apache.ctakes.typesystem.type.syntax.BaseToken) baseItr
                        .next();
                    if ((checkToken instanceof NewlineToken)
                        || (checkToken instanceof SymbolToken))
                      newLineCount++;

                  } // After taking in account the symbols and
                    // new line characters see
                    // if the ending of this sentence is
                    // adjacent to the next subsection
                    // then we found section end
                  if ((sentenceAnnotation.getEnd() + 1 + newLineCount) == subsectionNext
                      .getStartOffset()
                      || sentenceAnnotation.getEnd()
                          + newLineCount == subsectionNext
                          .getStartOffset()) {

                    foundEnd = true;
                    // set the end of the current subsection
                    // to sentence end and status
                    subsectionAnnotation
                        .setSubSectionBodyEnd(sentenceAnnotation
                            .getEnd());
                    subsectionAnnotation
                        .setStatus(subsectionThis
                            .getStatus());
                    // test new window code
                    subsectionAnnotation
                        .setSubSectionHeaderBegin(subsectionAnnotation
                            .getBegin());
                    subsectionAnnotation
                        .setSubSectionHeaderEnd(subsectionAnnotation
                            .getEnd());
                    subsectionAnnotation
                        .setEnd(subsectionAnnotation
                            .getSubSectionBodyEnd());
                    subsectionAnnotation
                        .setParentSectionId(segmentAnnotation
                            .getId());
                  }
                  // The next subsection end (or the next
                  // subsection plus one) is equal to the
                  // current
                  // sentence end then we found section end

                } else if (subsectionNext.getEndOffset() == sentenceAnnotation
                    .getEnd()
                    || subsectionNext.getEndOffset() < sentenceAnnotation
                        .getEnd()) {
                  foundEnd = true;
                  subsectionAnnotation
                      .setSubSectionBodyEnd(subsectionNext
                          .getStartOffset());
                  subsectionAnnotation
                      .setStatus(subsectionThis
                          .getStatus());
                  // test new window code
                  subsectionAnnotation
                      .setSubSectionHeaderBegin(subsectionAnnotation
                          .getBegin());
                  subsectionAnnotation
                      .setSubSectionHeaderEnd(subsectionAnnotation
                          .getEnd());
                  subsectionAnnotation
                      .setEnd(subsectionAnnotation
                          .getSubSectionBodyEnd());
                  subsectionAnnotation
                      .setParentSectionId(segmentAnnotation
                          .getId());
                }
                // if the current sentence ends at or before the
                // start of the current subsection
                // and the current sentence ends after the next
                // subsection ends (incorrect order?)
              } else if (subsectionThis.getStartOffset() <= sentenceAnnotation
                  .getEnd()
                  && (sentenceAnnotation.getEnd() > subsectionNext
                      .getEndOffset()))
                if ((sentenceAnnotation.getEnd() + 1) == subsectionThis
                    .getStartOffset()
                    || sentenceAnnotation.getEnd() == subsectionThis
                        .getStartOffset()) {
                  foundEnd = true;
                  subsectionAnnotation
                      .setSubSectionBodyEnd(sentenceAnnotation
                          .getEnd());
                  subsectionAnnotation
                      .setStatus(subsectionThis
                          .getStatus());
                  // test new window code
                  subsectionAnnotation
                      .setSubSectionHeaderBegin(subsectionAnnotation
                          .getBegin());
                  subsectionAnnotation
                      .setSubSectionHeaderEnd(subsectionAnnotation
                          .getEnd());
                  subsectionAnnotation
                      .setEnd(subsectionAnnotation
                          .getSubSectionBodyEnd());
                  subsectionAnnotation
                      .setParentSectionId(segmentAnnotation
                          .getId());
                }
              // No next subsection then
              // if there is a current subsection and end hasn't
              // been found and the subsection begin
              // is before the beginning of the current sentence,
              // but at or after the section beginning
              // and before the section ending then found end
            } else if ((subsectionThis != null)
                && (!foundEnd)
                && (subsectionThis.getStartOffset() < sentenceAnnotation
                    .getBegin())
                && (subsectionThis.getStartOffset() >= segmentAnnotation
                    .getBegin())
                && subsectionThis.getStartOffset() <= segmentAnnotation
                    .getEnd()) {
              foundEnd = true;
              subsectionAnnotation
                  .setSubSectionBodyEnd(sentenceAnnotation
                      .getEnd());
              subsectionAnnotation.setStatus(subsectionThis
                  .getStatus());
              // test new window code
              subsectionAnnotation
                  .setSubSectionHeaderBegin(subsectionAnnotation
                      .getBegin());
              subsectionAnnotation
                  .setSubSectionHeaderEnd(subsectionAnnotation
                      .getEnd());
              subsectionAnnotation.setEnd(subsectionAnnotation
                  .getSubSectionBodyEnd());
              subsectionAnnotation
                  .setParentSectionId(segmentAnnotation
                      .getId());
              // No next subsection then
              // if there is a current subsection and end hasn't
              // been found and
              // the end of the subsection heading is equal to the
              // end of the sentence (weird case)
            } else if ((subsectionThis != null)
                && (!foundEnd)
                && (subsectionThis.getEndOffset() == sentenceAnnotation
                    .getEnd())) {
              foundEnd = true;
              subsectionAnnotation
                  .setSubSectionBodyEnd(sentenceAnnotation
                      .getEnd());
              subsectionAnnotation.setStatus(subsectionThis
                  .getStatus());
              // test new window code
              subsectionAnnotation
                  .setSubSectionHeaderBegin(subsectionAnnotation
                      .getBegin());
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.