Package opennlp.tools.sentdetect

Examples of opennlp.tools.sentdetect.SentenceSample


    for (AnnotationFS sentenceAnnotation : sentenceIndex) {
      sentSpans[i++] = new Span(sentenceAnnotation.getBegin(), sentenceAnnotation.getEnd());
    }

    // TODO: The line cleaning should be done more carefully
    sentenceSamples.add(new SentenceSample(cas.getDocumentText().replace('\n', ' '), sentSpans));
  }
View Full Code Here


      sentences.add(toSentence(posSample));
      chunks++;
    }

    if (sentences.size() > 0)
      return new SentenceSample(detokenizer,
          sentences.toArray(new String[sentences.size()][]));
    else if (posSample != null)
      return read(); // filter out empty line
    else {
      return null; // last sample was read
View Full Code Here

      AnnotationFS sentenceAnnotation = (AnnotationFS) sentenceIterator.next();

      sentSpans[i++] = new Span(sentenceAnnotation.getBegin(), sentenceAnnotation.getEnd());
    }

    sentenceSamples.add(new SentenceSample(cas.getDocumentText(), sentSpans));
  }
View Full Code Here

      sentences.add(toSentence(posSample));
      chunks++;
    }

    if (sentences.size() > 0)
      return new SentenceSample(detokenizer,
          sentences.toArray(new String[sentences.size()][]));
    else if (posSample != null)
      return read(); // filter out empty line
    else {
      return null; // last sample was read
View Full Code Here

      doc = document.substring(0, document.length() - 1);
    } else {
      doc = document.toString();
    }

    return new SentenceSample(doc,
        sentences.toArray(new Span[sentences.size()]));
  }
View Full Code Here

        .getResourceAsStream("/opennlp/tools/formats/ad.sample");

    ADSentenceSampleStream stream = new ADSentenceSampleStream(
        new PlainTextByLineStream(in, "UTF-8"), true);

    SentenceSample sample = stream.read();

    while (sample != null) {
      System.out.println(sample.getDocument());
      System.out.println("<fim>");
      samples.add(sample);
      sample = stream.read();
    }
  }
View Full Code Here

        "/opennlp/tools/formats/ad.sample");

    ADSentenceSampleStream stream = new ADSentenceSampleStream(
        new PlainTextByLineStream(in, "UTF-8"), true);

    SentenceSample sample = stream.read();

    while (sample != null) {
      System.out.println(sample.getDocument());
      System.out.println("<fim>");
      samples.add(sample);
      sample = stream.read();
    }
  }
View Full Code Here

      doc = document.substring(0, document.length() - 1);
    } else {
      doc = document.toString();
    }

    return new SentenceSample(doc,
        sentences.toArray(new Span[sentences.size()]));
  }
View Full Code Here

    for (AnnotationFS sentenceAnnotation : sentenceIndex) {
      sentSpans[i++] = new Span(sentenceAnnotation.getBegin(), sentenceAnnotation.getEnd());
    }

    // TODO: The line cleaning should be done more carefully
    sentenceSamples.add(new SentenceSample(cas.getDocumentText().replace('\n', ' '), sentSpans));
  }
View Full Code Here

TOP

Related Classes of opennlp.tools.sentdetect.SentenceSample

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.