Package opennlp.tools.util

Examples of opennlp.tools.util.PlainTextByLineStream


    String encoding = "ISO-8859-1";

    ObjectStream<NameSample> sampleStream =
          new NameSampleDataStream(
          new PlainTextByLineStream(new InputStreamReader(in, encoding)));
   
    TokenNameFinderModel nameFinderModel = NameFinderME.train("en", TYPE, sampleStream,
        Collections.<String, Object>emptyMap(), 70, 1);

    TokenNameFinder nameFinder = new NameFinderME(nameFinderModel);
View Full Code Here


        "opennlp/tools/namefind/AnnotatedSentencesWithTypes.txt");

    String encoding = "ISO-8859-1";

    ObjectStream<NameSample> sampleStream = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in, encoding)));

    TokenNameFinderModel nameFinderModel = NameFinderME.train("en", TYPE, sampleStream,
        Collections.<String, Object>emptyMap(), 70, 1);

    NameFinderME nameFinder = new NameFinderME(nameFinderModel);
View Full Code Here

    InputStream in = getClass().getClassLoader().getResourceAsStream(
        "opennlp/tools/namefind/OnlyWithNames.train");

    ObjectStream<NameSample> sampleStream = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in)));

    TokenNameFinderModel nameFinderModel = NameFinderME.train("en", TYPE,
        sampleStream, Collections.<String, Object>emptyMap(), 70, 1);

    NameFinderME nameFinder = new NameFinderME(nameFinderModel);
View Full Code Here

    InputStream in = getClass().getClassLoader().getResourceAsStream(
        "opennlp/tools/namefind/OnlyWithNamesWithTypes.train");

    ObjectStream<NameSample> sampleStream = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in)));

    TokenNameFinderModel nameFinderModel = NameFinderME.train("en", TYPE,
        sampleStream, Collections.<String, Object>emptyMap(), 70, 1);

    NameFinderME nameFinder = new NameFinderME(nameFinderModel);
View Full Code Here

    InputStream in = getClass().getClassLoader().getResourceAsStream(
        "opennlp/tools/namefind/OnlyWithEntitiesWithTypes.train");

    ObjectStream<NameSample> sampleStream = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in)));

    TokenNameFinderModel nameFinderModel = NameFinderME.train("en", TYPE,
        sampleStream, Collections.<String, Object>emptyMap(), 70, 1);

    NameFinderME nameFinder = new NameFinderME(nameFinderModel);
View Full Code Here

    InputStream in = getClass().getClassLoader().getResourceAsStream(
        "opennlp/tools/namefind/voa1.train");

    ObjectStream<NameSample> sampleStream = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in)));

    TokenNameFinderModel nameFinderModel = NameFinderME.train("en", TYPE,
        sampleStream, Collections.<String, Object>emptyMap(), 70, 1);

    NameFinderME nameFinder = new NameFinderME(nameFinderModel);
View Full Code Here

      .getResourceAsStream("opennlp/tools/chunker/output.txt");

  String encoding = "UTF-8";

  DummyChunkSampleStream predictedSample = new DummyChunkSampleStream(
      new PlainTextByLineStream(new InputStreamReader(in,
          encoding)), false);

  ChunkSample cs1 = predictedSample.read();
  String[] g1 = Span.spansToStrings(cs1.getPhrasesAsSpanList(), cs1.getSentence());
  assertEquals(15, g1.length);
View Full Code Here

    "opennlp/tools/chunker/output.txt");

    String encoding = "UTF-8";

    DummyChunkSampleStream predictedSample = new DummyChunkSampleStream(
        new PlainTextByLineStream(new InputStreamReader(inPredicted, encoding)), true);
   
    DummyChunkSampleStream expectedSample = new DummyChunkSampleStream(
        new PlainTextByLineStream(new InputStreamReader(inExpected)), false);
   
    Chunker dummyChunker = new DummyChunker(predictedSample);
   
    OutputStream stream = new ByteArrayOutputStream();
    ChunkerEvaluationMonitor listener = new ChunkEvaluationErrorListener(stream);
View Full Code Here

        "opennlp/tools/chunker/output.txt");

    String encoding = "UTF-8";

    DummyChunkSampleStream predictedSample = new DummyChunkSampleStream(
        new PlainTextByLineStream(new InputStreamReader(inPredicted, encoding)),
        true);

    DummyChunkSampleStream expectedSample = new DummyChunkSampleStream(
        new PlainTextByLineStream(new InputStreamReader(inExpected, encoding)),
        true);

    Chunker dummyChunker = new DummyChunker(predictedSample);

    OutputStream stream = new ByteArrayOutputStream();
View Full Code Here

     
      System.out.println("Performing evaluation ...");
      TokenNameFinderEvaluator evaluator = new TokenNameFinderEvaluator(nameFinder);
     
      final NameSampleDataStream sampleStream = new NameSampleDataStream(
          new PlainTextByLineStream(new InputStreamReader(new FileInputStream(args[2]), args[1])));
     
      final PerformanceMonitor monitor = new PerformanceMonitor("sent");
     
      monitor.startAndPrintThroughput();
     
View Full Code Here

TOP

Related Classes of opennlp.tools.util.PlainTextByLineStream

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.