Package opennlp.tools.util

Examples of opennlp.tools.util.PlainTextByLineStream


      File sampleDataFile, Charset encoding) {
    CmdLineUtil.checkInputFile(sampleDataName + " Data", sampleDataFile);

    FileInputStream sampleDataIn = CmdLineUtil.openInFile(sampleDataFile);

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

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


    SentenceModel model = new SentenceModelLoader().load(new File(args[0]));
   
    SentenceDetectorME sdetector = new SentenceDetectorME(model);

    ObjectStream<String> paraStream =
      new ParagraphStream(new PlainTextByLineStream(new InputStreamReader(System.in)));
   
    PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "sent");
    perfMon.start();
   
    try {
View Full Code Here

    POSModel model = new POSModelLoader().load(new File(args[0]));
   
    POSTaggerME tagger = new POSTaggerME(model);
   
    ObjectStream<String> lineStream =
      new PlainTextByLineStream(new InputStreamReader(System.in));
   
    PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "sent");
    perfMon.start();
   
    try {
      String line;
      while ((line = lineStream.read()) != null) {
       
        String whitespaceTokenizerLine[] = WhitespaceTokenizer.INSTANCE.tokenize(line);
        String[] tags = tagger.tag(whitespaceTokenizerLine);
       
        POSSample sample = new POSSample(whitespaceTokenizerLine, tags);
View Full Code Here

     
    opennlp.tools.parser.Parser parser =
        ParserFactory.create(model, beamSize, advancePercentage);

    ObjectStream<String> lineStream =
      new PlainTextByLineStream(new InputStreamReader(System.in));
   
    PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "sent");
    perfMon.start();
   
    try {
      String line;
      while ((line = lineStream.read()) != null) {
        if (line.length() == 0) {
          System.out.println();
        }
        else {
          Parse[] parses = parseLine(line, parser, numParses);
View Full Code Here

      File sampleDataFile, Charset encoding) {
    CmdLineUtil.checkInputFile(sampleDataName + " Data", sampleDataFile);

    FileInputStream sampleDataIn = CmdLineUtil.openInFile(sampleDataFile);

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

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

    }
   
    System.err.println("done");
   
    return new ParseSampleStream(
        new PlainTextByLineStream(trainingDataIn.getChannel(),
        encoding));
  }
View Full Code Here

   *          the charset of the Arvores Deitadas Corpus
   */
  public ADNameSampleStream(InputStream in, String charsetName) {

    try {
      this.adSentenceStream = new ADSentenceStream(new PlainTextByLineStream(
          in, charsetName));
    } catch (UnsupportedEncodingException e) {
      // UTF-8 is available on all JVMs, will never happen
      throw new IllegalStateException(e);
    }
View Full Code Here

      dict = new Dictionary(new FileInputStream(args[ai++]),true);
    }
    if (fun) {
      Parse.useFunctionTags(true);
    }
    opennlp.model.EventStream es = new ParserEventStream(new ParseSampleStream(new PlainTextByLineStream(new java.io.InputStreamReader(System.in))), rules, etype, dict);
    while (es.hasNext()) {
      System.out.println(es.next());
    }
  }
View Full Code Here

    }
    HeadRules rules = new opennlp.tools.parser.lang.en.HeadRules(args[ai++]);
    if (fun) {
      Parse.useFunctionTags(true);
    }
    opennlp.model.EventStream es = new ParserEventStream(new ParseSampleStream(new PlainTextByLineStream(new java.io.InputStreamReader(System.in))), rules, etype, dict);
    while (es.hasNext()) {
      Event e = es.next();
      if (model != null) {
        System.out.print(model.eval(e.getContext())[model.getIndex(e.getOutcome())]+" ");
      }
View Full Code Here

   * Initializes the current instance.
   *
   * @param sentences
   */
  public WordTagSampleStream(Reader sentences) throws IOException {
    super(new PlainTextByLineStream(sentences));
  }
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.