Package opennlp.tools.util

Examples of opennlp.tools.util.PlainTextByLineStream


    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

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

    String encoding = "ISO-8859-1";

    NameSampleDataStream ds = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in, encoding)));

    NameSample ns = ds.read();

    String[] expectedNames = { "Alan McKennedy", "Julie", "Marie Clara",
        "Stefanie Schmidt", "Mike", "Stefanie Schmidt", "George", "Luise",
View Full Code Here

  public void testWithNameTypes() throws Exception {
    InputStream in = getClass().getClassLoader().getResourceAsStream(
        "opennlp/tools/namefind/voa1.train");

    NameSampleDataStream ds = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in)));

    Map<String, List<String>> names = new HashMap<String, List<String>>();
    Map<String, List<Span>> spans = new HashMap<String, List<Span>>();
   
    NameSample ns;
View Full Code Here

    trainingData.append("c\n");
    trainingData.append("\n");
    trainingData.append("d\n");
   
    ObjectStream<String> untokenizedLineStream =
      new PlainTextByLineStream(new StringReader(trainingData.toString()));
   
    ObjectStream<NameSample> trainingStream = new NameSampleDataStream(untokenizedLineStream);
   
    assertFalse(trainingStream.read().isClearAdaptiveDataSet());
    assertFalse(trainingStream.read().isClearAdaptiveDataSet());
View Full Code Here

  public void testHtmlNameSampleParsing() throws IOException {
    InputStream in = getClass().getClassLoader().getResourceAsStream(
        "opennlp/tools/namefind/html1.train");
   
    NameSampleDataStream ds = new NameSampleDataStream(
        new PlainTextByLineStream(new InputStreamReader(in, "UTF-8")));

    NameSample ns = ds.read();
   
    assertEquals(1, ns.getSentence().length);
    assertEquals("<html>", ns.getSentence()[0]);
View Full Code Here

    sample.append("word22 tag22 pred22");
    sample.append('\n');
    sample.append("word23 tag23 pred23");
    sample.append('\n');
   
    ObjectStream<String> stringStream = new PlainTextByLineStream(new StringReader(sample.toString()));
   
    ObjectStream<ChunkSample> chunkStream = new ChunkSampleStream(stringStream);
   
    // read first sample
    ChunkSample firstSample = chunkStream.read();
View Full Code Here

    String encoding = "UTF-8";

    try {
      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);

      ChunkerDetailedFMeasureListener listener = new ChunkerDetailedFMeasureListener();
      ChunkerEvaluator evaluator = new ChunkerEvaluator(dummyChunker, listener);
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.