Examples of ParserModel


Examples of opennlp.tools.parser.ParserModel

    Map<String, String> checkReportMap = new HashMap<String, String>();
    MaxentModel checkModel = TrainUtil.train(kes, mlParams.getSettings("check"), checkReportMap);
    mergeReportIntoManifest(manifestInfoEntries, checkReportMap, "check");

    // TODO: Remove cast for HeadRules
    return new ParserModel(languageCode, buildModel, checkModel,
        posModel, chunkModel, (opennlp.tools.parser.HeadRules) rules,
        ParserType.CHUNKING, manifestInfoEntries);
  }
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

  @Override
  public void run(String format, String[] args) {

    super.run(format, args);

    ParserModel model = new ParserModelLoader().load(params.getModel());

    Parser parser = ParserFactory.create(model);

    ParserEvaluator evaluator = new ParserEvaluator(parser);
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

  }

  @Override
  protected ParserModel loadModel(InputStream modelIn) throws IOException,
      InvalidFormatException {
    return new ParserModel(modelIn);
  }
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

    ModelUpdaterParams params = validateAndParseParams(
        ArgumentParser.filter(args, ModelUpdaterParams.class), ModelUpdaterParams.class);

    // Load model to be updated
    File modelFile = params.getModel();
    ParserModel originalParserModel = new ParserModelLoader().load(modelFile);

    ObjectStreamFactory<Parse> factory = getStreamFactory(format);
    String[] fargs = ArgumentParser.filter(args, factory.getParameters());
    validateFactoryArgs(factory, fargs);
    ObjectStream<Parse> sampleStream = factory.create(fargs);

    ParserModel updatedParserModel;
    try {
      updatedParserModel = trainAndUpdate(originalParserModel, sampleStream, params);
    }
    catch (IOException e) {
      throw new TerminateToolException(-1, "IO error while reading training data or indexing data: "
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

    if (args.length != 2) {
      System.out.println(getHelp());
    } else {

      File parserModelInFile = new File(args[0]);
      ParserModel parserModel = new ParserModelLoader().load(parserModelInFile);

      File taggerModelInFile = new File(args[1]);
      POSModel taggerModel = new POSModelLoader().load(taggerModelInFile);

      ParserModel updatedParserModel = parserModel.updateTaggerModel(taggerModel);

      CmdLineUtil.writeModel("parser", parserModelInFile, updatedParserModel);
    }
  }
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

    if (args.length < 1) {
      System.out.println(getHelp());
    } else {

      ParserModel model = new ParserModelLoader().load(new File(args[args.length - 1]));

      Integer beamSize = CmdLineUtil.getIntParameter("-bs", args);
      if (beamSize == null) {
        beamSize = AbstractBottomUpParser.defaultBeamSize;
      }
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

    }

    File modelOutFile = params.getModel();
    CmdLineUtil.checkOutputFile("parser model", modelOutFile);

    ParserModel model;
    try {
      HeadRules rules = creaeHeadRules(params);

      ParserType type = parseParserType(params.getParserType());
      if(params.getFun()){
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

    if (mLogger.isLoggable(Level.INFO)) {
      mLogger.log(Level.INFO, "Initializing the OpenNLP Parser.");
    }

    ParserModel model;

    try {
      ParserModelResource modelResource = (ParserModelResource) context
          .getResourceObject(UimaUtil.MODEL_PARAMETER);
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

      Chunker chunker = null;
      HeadRules headRules = null;

      if (!d.isDirectory()) {
        FileInputStream fis = new FileInputStream(d);
        ParserModel model = new ParserModel(fis);
        parser = new Parser(model, AbstractBottomUpParser.defaultBeamSize, AbstractBottomUpParser.defaultAdvancePercentage);
      } else {
        // This branch is for handling models built with OpenNLp 1.4
        // Once the models are rebuilt using OpenNLP 1.5 this code should be removed
        // @see TreebankParser.java in OpenNLP 1.4
View Full Code Here

Examples of opennlp.tools.parser.ParserModel

  @Override
  public void initialize(org.apache.uima.UimaContext aContext) throws org.apache.uima.resource.ResourceInitializationException {
    String modelFileOrDirname = (String) aContext.getConfigParameterValue("modelDir");
    try {
      FileInputStream fis = new FileInputStream(new File(modelFileOrDirname));
      ParserModel model = new ParserModel(fis);
      parser = ParserFactory.create(model, AbstractBottomUpParser.defaultBeamSize, AbstractBottomUpParser.defaultAdvancePercentage); //TreebankParser.getParser(modelFileOrDirname, useTagDictionary, useCaseSensitiveTagDictionary, AbstractBottomUpParser.defaultBeamSize, AbstractBottomUpParser.defaultAdvancePercentage);
    } catch (IOException e) {
      e.printStackTrace();
   
  }
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.