Examples of EventStream


Examples of opennlp.model.EventStream

    }
    String dataFileName = args[ai++];
    String modelFileName = args[ai];
    try {
      FileReader datafr = new FileReader(new File(dataFileName));
      EventStream es;
      if (!real) {
        es = new BasicEventStream(new PlainTextByLineDataStream(datafr), ",");
      } else {
        es = new RealBasicEventStream(new PlainTextByLineDataStream(datafr));
      }
View Full Code Here

Examples of opennlp.model.EventStream

   
    AbstractModel posModel;
   
    if (!TrainUtil.isSequenceTraining(trainParams.getSettings())) {
     
      EventStream es = new POSSampleEventStream(samples, contextGenerator);
     
      posModel = TrainUtil.train(es, trainParams.getSettings(), manifestInfoEntries);
    }
    else {
      POSSampleSequenceStream ss = new POSSampleSequenceStream(samples, contextGenerator);
View Full Code Here

Examples of opennlp.model.EventStream

  public static TokenizerModel train(ObjectStream<TokenSample> samples, TokenizerFactory factory,
      TrainingParameters mlParams) throws IOException {

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    EventStream eventStream = new TokSpanEventStream(samples,
        factory.isUseAlphaNumericOptmization(),
        factory.getAlphaNumericPattern(), factory.getContextGenerator());

    AbstractModel maxentModel = TrainUtil.train(eventStream,
        mlParams.getSettings(), manifestInfoEntries);
View Full Code Here

Examples of opennlp.model.EventStream

      throws IOException {
    Factory factory = new Factory();

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    EventStream eventStream = new TokSpanEventStream(samples,
        useAlphaNumericOptimization, factory.getAlphanumeric(languageCode),
        factory.createTokenContextGenerator(languageCode,
            getAbbreviations(abbreviations)));

    AbstractModel maxentModel = TrainUtil.train(eventStream,
View Full Code Here

Examples of opennlp.model.EventStream

       featureGenerator = createFeatureGenerator();

     AbstractModel nameFinderModel;

     if (!TrainUtil.isSequenceTraining(trainParams.getSettings())) {
       EventStream eventStream = new NameFinderEventStream(samples, type,
           new DefaultNameContextGenerator(featureGenerator));

       nameFinderModel = TrainUtil.train(eventStream, trainParams.getSettings(), manifestInfoEntries);
     }
     else {
View Full Code Here

Examples of opennlp.model.EventStream

  public static final void main(String[] args) throws java.io.IOException {
    if (args.length != 0) {
      System.err.println("Usage: NameFinderEventStream < training files");
      System.exit(1);
    }
    EventStream es = new NameFinderEventStream(new NameSampleDataStream(
        new PlainTextByLineStream(new java.io.InputStreamReader(System.in))));
    while (es.hasNext()) {
      System.out.println(es.next());
    }
  }
View Full Code Here

Examples of opennlp.model.EventStream

      TrainingParameters mlParams) throws IOException {

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    // TODO: Fix the EventStream to throw exceptions when training goes wrong
    EventStream eventStream = new SDEventStream(samples,
        sdFactory.getSDContextGenerator(), sdFactory.getEndOfSentenceScanner());

    AbstractModel sentModel = TrainUtil.train(eventStream,
        mlParams.getSettings(), manifestInfoEntries);
View Full Code Here

Examples of opennlp.model.EventStream

      ModelUtil.addCutoffAndIterations(manifestInfoEntries, cutoff, iterations);
     
      Factory factory = new Factory();

      // TODO: Fix the EventStream to throw exceptions when training goes wrong
      EventStream eventStream = new SDEventStream(samples,
          factory.createSentenceContextGenerator(languageCode),
          factory.createEndOfSentenceScanner(languageCode));
     
      HashSumEventStream hses = new HashSumEventStream(eventStream);
      GISModel sentModel = GIS.trainModel(hses, iterations, cutoff);
View Full Code Here

Examples of opennlp.tools.ml.model.EventStream

        e.printStackTrace();
        System.exit(0);
      }

      try {
        EventStream es = new BasicEventStream(new PlainTextByLineDataStream(
            new FileReader(new File(dataFileName))), ",");

        while (es.hasNext())
          predictor.eval(es.next(), real);

        return;
      } catch (Exception e) {
        System.out.println("Unable to read from specified file: "
            + modelFileName);
View Full Code Here

Examples of org.persvr.remote.EventStream

      }
      final CometSerializer serializer = getCometSerializer(request);
      eventStream.addCallback(new EventStream.EventCallback() {
 
        public synchronized void onEvent()  throws IOException{
          final EventStream eventStream = (Client) request.getSession().getAttribute(clientId);

         
         
          Notification notification= eventStream.eventAvailable() ? eventStream.take(0) : null;
          if (notification != null) { // we are resuming
            try {
             
              if (sendEvent(notification, eventStream, serializer)) {
                System.err.println("connection closed by server" + request);
                request.setAttribute("org.persvr.sent", true);
              }
            }
            catch (IOException e) {
              e.printStackTrace();
              eventStream.finished();
            }
          }
        }
       
      });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.