Package opennlp.tools.formats

Examples of opennlp.tools.formats.ResourceAsStreamFactory


    assertEquals(ADParagraphStreamTest.NUM_SENTENCES, count);
  }

  private static ADSentenceStream openData() throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample");

    return new ADSentenceStream(new PlainTextByLineStream(in, "UTF-8"));
  }
View Full Code Here


  }

  @Before
  public void setup() throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(
        ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample");

    ADChunkSampleStream stream = new ADChunkSampleStream(
      new PlainTextByLineStream(in, "UTF-8"));
View Full Code Here

public class DoccatFactoryTest {

  private static ObjectStream<DocumentSample> createSampleStream()
      throws IOException {

    InputStreamFactory isf = new ResourceAsStreamFactory(
        DoccatFactoryTest.class, "/opennlp/tools/doccat/DoccatSample.txt");

    return new DocumentSampleStream(new PlainTextByLineStream(isf, "UTF-8"));
  }
View Full Code Here

    assertEquals(new Span(5, 6, "person"), samples.get(7).getNames()[2]);
  }

  @Before
  public void setup() throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(ADParagraphStreamTest.class,
        "/opennlp/tools/formats/ad.sample");

    ADNameSampleStream stream = new ADNameSampleStream(
        new PlainTextByLineStream(in, "UTF-8"), true);
View Full Code Here

  @Test
  public void testSimple() throws IOException {
    // add one sentence with expandME = includeFeats = false
    ADPOSSampleStream stream = new ADPOSSampleStream(
        new PlainTextByLineStream(new ResourceAsStreamFactory(
            ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample"),
            "UTF-8"), false, false);

    POSSample sample = stream.read();
View Full Code Here

  @Test
  public void testExpandME() throws IOException {
    // add one sentence with expandME = true
    ADPOSSampleStream stream = new ADPOSSampleStream(
        new PlainTextByLineStream(new ResourceAsStreamFactory(
            ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample"),
            "UTF-8"), true, false);

    POSSample sample = stream.read();
View Full Code Here

  @Test
  public void testIncludeFeats() throws IOException {
    // add one sentence with includeFeats = true
    ADPOSSampleStream stream = new ADPOSSampleStream(
        new PlainTextByLineStream(new ResourceAsStreamFactory(
            ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample"),
            "UTF-8"), false, true);

    POSSample sample = stream.read();
View Full Code Here

    assertEquals(new Span(120, 180), samples.get(0).getSentences()[1]);
  }

  @Before
  public void setup() throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(ADSentenceSampleStreamTest.class,
        "/opennlp/tools/formats/ad.sample");

    ADSentenceSampleStream stream = new ADSentenceSampleStream(
        new PlainTextByLineStream(in, "UTF-8"), true);
View Full Code Here

TOP

Related Classes of opennlp.tools.formats.ResourceAsStreamFactory

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.