Examples of WordToken


Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

    nextID += la.size();

    ArrayList<WordToken> lw = AnnotationSelector.selectPronoun(aJCas, modalAdj, cogved, otherVerb, logger);
    for (int i = 0; i < lw.size(); ++i) {
      WordToken t = lw.get(i);
      PronounMarkable m = new PronounMarkable(aJCas, t.getBegin(), t.getEnd());
      m.setContent(t);
      m.setId(nextID + i);
      m.addToIndexes();
    }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

     
      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
          Iterator<?> tokenItr = indexes.getAnnotationIndex(WordToken.type).iterator();
          while (tokenItr.hasNext())
          {
            WordToken token = (WordToken) tokenItr.next();
            String tokenNormText = token.getCanonicalForm();
            normalizedText.append(tokenNormText+" ");         
          }           
      String documentID = DocumentIDAnnotationUtil.getDocumentID(jcas);
      writeToFile(documentID, normalizedText.toString());
    }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

      {
        Iterator chkNE = namedE.iterator();
        Iterator newNE = wordTokenList.iterator();
        boolean neFound = false;
      //  MedicationMention ne = null;
        WordToken we = null;
        Object mt = (ObjectmeasurementTokenItr.next();
        if (mt instanceof  StrengthUnitToken) {
          // StrengthUnitToken mt = (StrengthUnitToken) measurementTokenItr.next();
          int begSeg = ((StrengthUnitToken) mt).getStartOffset(), endSeg = ((StrengthUnitToken) mt).getEndOffset();
          StrengthUnitAnnotation ma = new StrengthUnitAnnotation(jcas, begSeg, endSeg);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

  private org.apache.ctakes.core.fsm.token.BaseToken adaptToFSMBaseToken(BaseToken obj)
  throws Exception
  {
    if (obj instanceof WordToken)
    {
      WordToken wta = (WordToken) obj;
      return new WordTokenAdapter(wta);
    } else if (obj instanceof NumToken)
    {
      NumToken nta = (NumToken) obj;
      if (nta.getNumType() == TokenizerAnnotator.TOKEN_NUM_TYPE_INTEGER)
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

  return span;
}
  private void findFSMInRange(JCas jcas, int begin, int end) throws Exception {
    MedicationMention ne = null;
    WordToken we = null;
    // grab iterator over tokens within this chunk
    Iterator btaItr = FSUtil.getAnnotationsInSpanIterator(jcas,
        BaseToken.type, begin,
        end+1);
    // do the same as above for named entities
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

      jcas = cas.getJCas();
      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
          Iterator<?> tokenItr = indexes.getAnnotationIndex(WordToken.type).iterator();
          while (tokenItr.hasNext())
          {
            WordToken token = (WordToken) tokenItr.next();
            String text = token.getCoveredText();
            if(!wordFreqs.containsKey(text))
            {
              wordFreqs.put(text, new int[1]);
            }
            ((int[])wordFreqs.get(text))[0]++;
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

        int end = beginPos + t.getEndOffset();

        switch (t.getType())
        {
        case Token.TYPE_WORD:
            WordToken wta = new WordToken(jcas);
            wta.setBegin(begin);
            wta.setEnd(end);
            int cap = -1;
            switch (t.getCaps())
            {
            case Token.CAPS_ALL:
                cap = TokenizerAnnotator.TOKEN_CAP_ALL;
                break;
            case Token.CAPS_FIRST_ONLY:
                cap = TokenizerAnnotator.TOKEN_CAP_FIRST_ONLY;
                break;
            case Token.CAPS_MIXED:
                cap = TokenizerAnnotator.TOKEN_CAP_MIXED;
                break;
            case Token.CAPS_NONE:
                cap = TokenizerAnnotator.TOKEN_CAP_NONE;
                break;
            }

            int numPos = -1;
            switch (t.getNumPosition())
            {
            case Token.NUM_FIRST:
                numPos = TokenizerAnnotator.TOKEN_NUM_POS_FIRST;
                break;
            case Token.NUM_MIDDLE:
                numPos = TokenizerAnnotator.TOKEN_NUM_POS_MIDDLE;
                break;
            case Token.NUM_LAST:
                numPos = TokenizerAnnotator.TOKEN_NUM_POS_LAST;
                break;
            case Token.NUM_NONE:
                numPos = TokenizerAnnotator.TOKEN_NUM_POS_NONE;
                break;
            }
            wta.setCapitalization(cap);
            wta.setNumPosition(numPos);
            bta = wta;
            break;
        case Token.TYPE_NUMBER:
            NumToken nta = new NumToken(jcas);
            nta.setBegin(begin);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

        Token token = new Token(bta.getBegin(), bta.getEnd());
        token.setText(bta.getCoveredText());

        if (bta instanceof WordToken)
        {
            WordToken wta = (WordToken) bta;
            token.setType(Token.TYPE_WORD);

            switch (wta.getCapitalization())
            {
            case TokenizerAnnotator.TOKEN_CAP_ALL:
                token.setCaps(Token.CAPS_ALL);
                break;
            case TokenizerAnnotator.TOKEN_CAP_FIRST_ONLY:
                token.setCaps(Token.CAPS_FIRST_ONLY);
                break;
            case TokenizerAnnotator.TOKEN_CAP_MIXED:
                token.setCaps(Token.CAPS_MIXED);
                break;
            case TokenizerAnnotator.TOKEN_CAP_NONE:
                token.setCaps(Token.CAPS_NONE);
                break;
            }

            switch (wta.getNumPosition())
            {
            case TokenizerAnnotator.TOKEN_NUM_POS_FIRST:
                token.setNumPosition(Token.NUM_FIRST);
                break;
            case TokenizerAnnotator.TOKEN_NUM_POS_MIDDLE:
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

    }
   
      } else if (clas.equals(WordToken.class)) {

    if (jcas!=null) {
        token = new WordToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
        String tokenText = s.substring(begin, end);
        setCapitalization((WordToken)token, tokenText);
        setNumPosition((WordToken)token, tokenText);
    }
    else  {
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.syntax.WordToken

    Iterator wtIter = FSUtil.getAnnotationsInSpanIterator(
        jcas, WordToken.type, begin, end);
    int cnt=0;
   
    while(wtIter.hasNext()) {
      WordToken wt = (WordToken) wtIter.next();
      if(ignoreWords.contains(wt.getCoveredText().toLowerCase())) continue;       
      cnt++;
    }
   
    return cnt;
  }
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.