Package org.apache.uima.examples.opennlp

Examples of org.apache.uima.examples.opennlp.Sentence


    AnnotationIndex tokenIndex = aJCas.getAnnotationIndex(Token.type);

    // iterate over Sentences
    FSIterator sentenceIterator = sentenceIndex.iterator();
    while (sentenceIterator.hasNext()) {
      Sentence sentence = (Sentence) sentenceIterator.next();

      wordList.clear();
      sentenceBuffer.setLength(0);

      int mapIdx = 0;
View Full Code Here


    AnnotationIndex sentenceIndex = aJCas.getAnnotationIndex(Sentence.type);

    // iterate over Sentences
    FSIterator sentenceIterator = sentenceIndex.iterator();
    while (sentenceIterator.hasNext()) {
      Sentence sentence = (Sentence) sentenceIterator.next();

      String text = sentence.getCoveredText();
      Span[] tokenSpans = tokenizer.tokenizePos(text);
      for (int i = 0; i < tokenSpans.length; i++) {
        Span span = tokenSpans[i];
        Token token = new Token(aJCas);
        token.setBegin(sentence.getBegin() + span.getStart());
        token.setEnd(sentence.getBegin() + span.getEnd());
        token.setComponentId(COMPONENT_ID);
        token.addToIndexes();
      }
    }
View Full Code Here

    AnnotationIndex tokenIndex = aJCas.getAnnotationIndex(Token.type);

    // iterate over Sentences
    FSIterator sentenceIterator = sentenceIndex.iterator();
    while (sentenceIterator.hasNext()) {
      Sentence sentence = (Sentence) sentenceIterator.next();

      tokenList.clear();
      wordList.clear();

      // iterate over Tokens
View Full Code Here

    AnnotationIndex tokenIndex = aJCas.getAnnotationIndex(Token.type);

    // iterate over Sentences
    FSIterator sentenceIterator = sentenceIndex.iterator();
    while (sentenceIterator.hasNext()) {
      Sentence sentence = (Sentence) sentenceIterator.next();

      tokenList.clear();
      wordList.clear();

      // iterate over Tokens
View Full Code Here

  public void process(JCas aJCas) throws AnalysisEngineProcessException {
    String docText = aJCas.getDocumentText();
    int sentenceOffsets[] = sentenceDetector.sentPosDetect(docText);
    int begin = 0;
    for (int i = 0; i < sentenceOffsets.length; i++) {
      Sentence sentence = new Sentence(aJCas, begin, sentenceOffsets[i]);
      sentence.setComponentId(COMPONENT_ID);
      sentence.addToIndexes();
      begin = sentenceOffsets[i];
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.examples.opennlp.Sentence

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.