Package opennlp.maxent

Examples of opennlp.maxent.EventStream


      }
      File inFile = new File(args[ai++]);
      File outFile = new File(args[ai++]);
      GISModel mod;

      EventStream es = new NameFinderEventStream(new PlainTextByLineDataStream(new InputStreamReader(new FileInputStream(inFile),encoding)));
      if (args.length > ai)
        mod = train(es, Integer.parseInt(args[ai++]), Integer.parseInt(args[ai++]));
      else
        mod = train(es, 100, 5);
View Full Code Here


        }
        return (null != head);
    }
   
    public static void main(String[] args) {
      EventStream es =  new SDEventStream(new PlainTextByLineDataStream(new InputStreamReader(System.in)));
      while(es.hasNext()) {
        System.out.println(es.nextEvent());
      }
    }
View Full Code Here

    if (args.length == 0) {
      System.err.println("Usage: NameFinderEventStream trainfiles");
      System.exit(1);
    }
    for (int ai=0,al=args.length;ai<al;ai++) {
      EventStream es = new NameFinderEventStream(new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(args[ai])));
      while(es.hasNext()) {
        System.out.println(es.nextEvent());
      }
    }
  }
View Full Code Here

   * sentence scanner which provides a different set of ending chars
   * other than the default ones.  They are "\\.|!|\\?|\\\"|\\)".
   *
   */
  public static GISModel train(File inFile, int iterations, int cut, EndOfSentenceScanner scanner) throws IOException {
    EventStream es;
    DataStream ds;
    Reader reader;

    reader = new BufferedReader(new FileReader(inFile));
    ds = new PlainTextByLineDataStream(reader);
View Full Code Here

    File inFile = new File(args[ai++]);
    File outFile = new File(args[ai++]);
    GISModel mod;
   
    try {
      EventStream es = new SDEventStream(new PlainTextByLineDataStream(new InputStreamReader(new FileInputStream(inFile),encoding)));

      if (args.length > ai)
        mod = train(es, Integer.parseInt(args[ai++]), Integer.parseInt(args[ai++]));
      else
        mod = train(es, 100, 5);
View Full Code Here

    events = ec.getEvents();
    //System.err.println("POSEventStream.addNewEvents: got "+events.length+" events");
  }

  public static void main(String[] args) throws java.io.IOException {
    EventStream es = new POSEventStream(new opennlp.maxent.PlainTextByLineDataStream(new java.io.InputStreamReader(System.in)),new Dictionary(args[0]));
    while (es.hasNext()) {
      System.out.println(es.nextEvent());
    }
  }
View Full Code Here

          mdict.add(words,1,true);
        }
        System.out.println("Saving the dictionary");
        mdict.persist(new File(dict));
      }
      EventStream es;
      if (encoding == null) {
        if (dict == null) {
          es = new POSEventStream(new PlainTextByLineDataStream(new InputStreamReader(new FileInputStream(inFile))));
        }
        else {
View Full Code Here

  }

  public static void train(String[] args) throws IOException {
      FileReader datafr = new FileReader(new File(args[0]));
      File output = new File(args[1]);
      EventStream evc =
        new EventCollectorAsStream(new TokEventCollector(datafr));
      train(evc, output);
  }
View Full Code Here

TOP

Related Classes of opennlp.maxent.EventStream

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.