Package opennlp.tools.parser

Examples of opennlp.tools.parser.ParserModel


    opennlp.model.EventStream attachEvents = new ParserEventStream(parseSamples, rules,
        ParserEventTypeEnum.ATTACH);
    AbstractModel attachModel = train(attachEvents, iterations, cut);
   
    // TODO: Remove cast for HeadRules
    return new ParserModel(languageCode, buildModel, checkModel,
        attachModel, posModel, chunkModel,
        (opennlp.tools.parser.lang.en.HeadRules) rules, ParserType.TREEINSERT);
  }
View Full Code Here


   
    BasicTrainingParameters parameters = new BasicTrainingParameters(args);
   
    // Load model to be updated
    File modelFile = new File(CmdLineUtil.getParameter("-model", args));
    ParserModel originalParserModel = new ParserModelLoader().load(modelFile);

    ObjectStream<Parse> parseSamples = ParserTrainerTool.openTrainingData(new File(CmdLineUtil.getParameter("-data", args)),
        parameters.getEncoding());
   
    ParserModel updatedParserModel;
    try {
      updatedParserModel = trainAndUpdate(originalParserModel,
          parseSamples, parameters);
    }
    catch (IOException e) {
View Full Code Here

    if (args.length < 1) {
      System.out.println(getHelp());
      throw new TerminateToolException(1);
    }
   
    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

    ObjectStream<Parse> sampleStream = openTrainingData(new File(CmdLineUtil.getParameter("-data", args)), parameters.getEncoding());
   
    File modelOutFile = new File(CmdLineUtil.getParameter("-model", args));
    CmdLineUtil.checkOutputFile("parser model", modelOutFile);
   
    ParserModel model;
    try {
     
      HeadRules rules = new opennlp.tools.parser.lang.en.HeadRules(
          new InputStreamReader(new FileInputStream(new File(CmdLineUtil.getParameter("-head-rules", args))),
          parameters.getEncoding()));
View Full Code Here

     * double advancePercentage =
     * opennlp.tools.parser.chunking.Parser.defaultAdvancePercentage;
     * opennlp.tools.parser.Parser parser = TreebankParser.getParser(
     * "models/parser", useTagDict, useCaseInsensitiveTagDict, beamSize,
     * advancePercentage);
     */Parser parser = ParserFactory.create(new ParserModel(
        new FileInputStream("models/en-parser-chunking.bin")),
        AbstractBottomUpParser.defaultBeamSize,
        AbstractBottomUpParser.defaultAdvancePercentage);

    // break a paragraph into sentences
View Full Code Here

TOP

Related Classes of opennlp.tools.parser.ParserModel

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.