Examples of AbstractModel


Examples of opennlp.model.AbstractModel

        .getArtifact(TAG_DICTIONARY_ENTRY_NAME);

    if (tagdictEntry != null) {
      if (tagdictEntry instanceof POSDictionary) {
        if(!this.artifactProvider.isLoadedFromSerialized()) {
          AbstractModel posModel = this.artifactProvider
              .getArtifact(POSModel.POS_MODEL_ENTRY_NAME);
          POSDictionary posDict = (POSDictionary) tagdictEntry;
          validatePOSDictionary(posDict, posModel);
        }
      } else {
View Full Code Here

Examples of opennlp.model.AbstractModel

   
    POSContextGenerator contextGenerator = posFactory.getPOSContextGenerator();
   
    Map<String, String> manifestInfoEntries = new HashMap<String, String>();
   
    AbstractModel posModel;
   
    if (!TrainUtil.isSequenceTraining(trainParams.getSettings())) {
     
      EventStream es = new POSSampleEventStream(samples, contextGenerator);
     
View Full Code Here

Examples of opennlp.model.AbstractModel

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

    AbstractModel maxentModel = TrainUtil.train(eventStream,
        mlParams.getSettings(), manifestInfoEntries);

    return new TokenizerModel(maxentModel, manifestInfoEntries,
        factory);
  }
View Full Code Here

Examples of opennlp.tools.ml.model.AbstractModel

    }
    ParserEventTypeEnum etype = null;
    boolean fun = false;
    int ai = 0;
    Dictionary dict = null;
    AbstractModel model = null;

    while (ai < args.length && args[ai].startsWith("-")) {
      if (args[ai].equals("-build")) {
        etype = ParserEventTypeEnum.BUILD;
      }
      else if (args[ai].equals("-attach")) {
        etype = ParserEventTypeEnum.ATTACH;
      }
      else if (args[ai].equals("-chunk")) {
        etype = ParserEventTypeEnum.CHUNK;
      }
      else if (args[ai].equals("-check")) {
        etype = ParserEventTypeEnum.CHECK;
      }
      else if (args[ai].equals("-tag")) {
        etype = ParserEventTypeEnum.TAG;
      }
      else if (args[ai].equals("-fun")) {
        fun = true;
      }
      else if (args[ai].equals("-dict")) {
        ai++;
        dict = new Dictionary(new FileInputStream(args[ai]));
      }
      else if (args[ai].equals("-model")) {
        ai++;
        model = (new SuffixSensitiveGISModelReader(new File(args[ai]))).getModel();
      }
      else {
        System.err.println("Invalid option " + args[ai]);
        System.exit(1);
      }
      ai++;
    }
    HeadRules rules = new opennlp.tools.parser.lang.en.HeadRules(args[ai++]);
    if (fun) {
      Parse.useFunctionTags(true);
    }
    ObjectStream<Event> es = new ParserEventStream(new ParseSampleStream(new PlainTextByLineStream(new java.io.InputStreamReader(System.in))), rules, etype, dict);
    Event e;
    while ((e = es.read()) != null) {
      if (model != null) {
        System.out.print(model.eval(e.getContext())[model.getIndex(e.getOutcome())]+" ");
      }
      System.out.println(e);
    }
  }
View Full Code Here

Examples of org.openrdf.model.impl.AbstractModel

        return result;
    }

    private static long benchmarkSemarglSesame(File path) throws SAXException, ParseException {
        System.out.println("Semargl-Sesame benchmark");
        AbstractModel model = new LinkedHashModel();
        StreamProcessor streamProcessor = new StreamProcessor(JsonLdParser.connect(SesameSink.connect(new StatementCollector(model))));

        List<File> files = listFiles(path);
        long time = System.nanoTime();
        for (File file : files) {
            streamProcessor.process(file, HTTP_EXAMPLE_COM);
        }
        System.out.println("Model size = " + model.size());
        return System.nanoTime() - time;
    }
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.