Package opennlp.tools.namefind

Examples of opennlp.tools.namefind.NameSampleDataStream


   
    //<start id="ne-namesample-type"/>
    String taggedSent =
      "<START:person> Britney Spears <END> was reunited " +
      "with her sons <START:date> Saturday <END> ";
    ObjectStream<NameSample> nss = new NameSampleDataStream(
        new PlainTextByLineStream(new StringReader(taggedSent)));
    TokenNameFinderModel model = NameFinderME.train(
        "en",
        "default" ,
        nss,
View Full Code Here


  public void trainNameFinder() throws IOException {
    File baseDir = new File("src/test/resources");
    File destDir = new File("target");
    //<start id="ne-train"/>
    File inFile = new File(baseDir,"person.train");
    NameSampleDataStream nss = new NameSampleDataStream( //<co id="co.opennlp.name.initnamestream"/>
      new PlainTextByLineStream(
        new java.io.FileReader(inFile)));

    int iterations = 100;
    int cutoff = 5;
View Full Code Here

    </calloutlist>*/
    //<end id="ne-features"/>

    //<start id="ne-features-train"/>
    File inFile = new File(baseDir,"person.train");
    NameSampleDataStream nss = new NameSampleDataStream( //<co id="co.opennlp.name.initfeat"/>
      new PlainTextByLineStream(
        new java.io.FileReader(inFile)));

    int iterations = 100;
    int cutoff = 5;
View Full Code Here

          logger.log(Level.INFO, "Using additional training data file: " + additionalTrainingDataFile);
        }
       
        additionalTrainingDataIn = new FileInputStream(additionalTrainingDataFile);
       
        ObjectStream<NameSample> additionalSamples = new NameSampleDataStream(
            new PlainTextByLineStream(new InputStreamReader(additionalTrainingDataIn, additionalTrainingDataEncoding)));
       
        samples = ObjectStreamUtils.createObjectStream(samples, additionalSamples);
      }
View Full Code Here

    ObjectStream<String> lineStream;
    try {
      lineStream = new PlainTextByLineStream(new InputStreamReader(
          CmdLineUtil.openInFile(new File(params.getData())), params.getEncoding()));
     
      return new NameSampleDataStream(lineStream);
    } catch (UnsupportedEncodingException e) {
      System.err.println("Encoding not supported: " + params.getEncoding());
      throw new TerminateToolException(-1);
    }
  }
View Full Code Here

    FileInputStream sampleDataIn = CmdLineUtil.openInFile(sampleDataFile);

    ObjectStream<String> lineStream = new PlainTextByLineStream(sampleDataIn
        .getChannel(), encoding);

    return new NameSampleDataStream(lineStream);
  }
View Full Code Here

        }
       
        additionalTrainingDataIn = new FileInputStream(additionalTrainingDataFile);
       
        // TODO: Make encoding configurable, otherwise use UTF-8 as default!
        ObjectStream<NameSample> additionalSamples = new NameSampleDataStream(
            new PlainTextByLineStream(new InputStreamReader(additionalTrainingDataIn, additionalTrainingDataEncoding)));
       
        samples = ObjectStreamUtils.createObjectStream(samples, additionalSamples);
      }
     
View Full Code Here

    FileInputStream sampleDataIn = CmdLineUtil.openInFile(params.getData());

    ObjectStream<String> lineStream = new PlainTextByLineStream(sampleDataIn.getChannel(),
        params.getEncoding());

    return new NameSampleDataStream(lineStream);
  }
View Full Code Here

      lineStream = new PlainTextByLineStream((sampleDataIn), params.getEncoding());
    } catch (IOException ex) {
      CmdLineUtil.handleCreateObjectStreamError(ex);
    }

    return new NameSampleDataStream(lineStream);
  }
View Full Code Here

          logger.log(Level.INFO, "Using additional training data file: " + additionalTrainingDataFile);
        }

        additionalTrainingDataIn = new FileInputStream(additionalTrainingDataFile);

        ObjectStream<NameSample> additionalSamples = new NameSampleDataStream(
            new PlainTextByLineStream(new InputStreamReader(additionalTrainingDataIn, additionalTrainingDataEncoding)));

        samples = ObjectStreamUtils.createObjectStream(samples, additionalSamples);
      }
View Full Code Here

TOP

Related Classes of opennlp.tools.namefind.NameSampleDataStream

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.