Package org.apache.uima.fit.examples.type

Examples of org.apache.uima.fit.examples.type.Token


  public static class Annotator1 extends JCasAnnotator_ImplBase {
    @Override
    public void process(JCas jCas) throws AnalysisEngineProcessException {
      String text = jCas.getDocumentText();
      for (int i = 0; i < text.length() - 3; i += 3) {
        new Token(jCas, i, i + 3).addToIndexes();
      }
    }
View Full Code Here


      List<Token> tokens = new ArrayList<Token>();
      for (String wordTagPair : wordTagPairs) {
        String word = wordTagPair.split("/")[0];
        String tag = wordTagPair.split("/")[1];
        text.append(word);
        Token token = new Token(goldView, offset, text.length());
        token.setPos(tag);
        tokens.add(token);
        text.append(" ");
        offset += word.length() + 1;
      }

      goldView.setDocumentText(text.toString().trim());
      new Sentence(goldView, 0, goldView.getDocumentText().length()).addToIndexes();

      for (Token token : tokens) {
        token.addToIndexes();
      }
    } catch (CASException ce) {
      throw new AnalysisEngineProcessException(ce);
    }
  }
View Full Code Here

    try {
      JCas view1 = jCas.getView(VIEW1);
      JCas view2 = jCas.getView(VIEW2);

      for (Token token1 : select(view1, Token.class)) {
        new Token(view2, token1.getBegin(), token1.getEnd()).addToIndexes();
      }

      for (Sentence sentence1 : select(view1, Sentence.class)) {
        new Sentence(view2, sentence1.getBegin(), sentence1.getEnd()).addToIndexes();
      }
View Full Code Here

TOP

Related Classes of org.apache.uima.fit.examples.type.Token

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.