Package opennlp.tools.chunker

Examples of opennlp.tools.chunker.ChunkerModel


     * @param language
     */
    private ChunkerME initChunker(String language) {
        ChunkerME chunker;
        try {
            ChunkerModel chunkerModel = openNLP.getChunkerModel(language);
            if(chunkerModel != null){
                chunker = new ChunkerME(chunkerModel);
            } else {
                log.debug("No Chunker Model for language {}",language);
                chunker = null;
View Full Code Here


        if(!config.enableChunker || config.forcePosTypeChunker){
            return null;
        }
        if(chunker == null && !chunkerNotAvailable) {
            try {
                ChunkerModel chunkerModel = openNLP.getChunkerModel(language);
                if(chunkerModel != null){
                    chunker = new ChunkerME(chunkerModel);
                } else {
                    log.debug("No Chunker Model for language {}",language);
                    chunkerNotAvailable = true;
View Full Code Here

    AbstractModel checkModel = readModel(args[2]);

    opennlp.tools.parser.lang.en.HeadRules headRules =
        new opennlp.tools.parser.lang.en.HeadRules(args[3]);

    ChunkerModel chunkerModel = new ChunkerModel(new FileInputStream(args[4]));

    POSModel posModel = new POSModel(new FileInputStream(args[5]));

    ParserModel packageModel = new ParserModel("en", buildModel, checkModel, posModel,
        chunkerModel, headRules, ParserType.CHUNKING, null);
View Full Code Here

        parseSamples), ModelType.MAXENT, null, null, cut, iterations);

    parseSamples.reset();

    // chunk
    ChunkerModel chunkModel = ChunkerME.train(languageCode, new ChunkSampleStream(
        parseSamples), cut, iterations, new ChunkContextGenerator());

    parseSamples.reset();

    // build
View Full Code Here

 
  private static class ChunkerModelSerializer implements ArtifactSerializer<ChunkerModel> {

    public ChunkerModel create(InputStream in) throws IOException,
        InvalidFormatException {
      return new ChunkerModel(new UncloseableInputStream(in));
    }
View Full Code Here

    CmdLineUtil.checkOutputFile("sentence detector model", modelOutFile);
    ObjectStream<ChunkSample> sampleStream =
      openSampleData("Training", trainingDataInFile, parameters.getEncoding());
   
    ChunkerModel model;
    try {
      model = ChunkerME.train(parameters.getLanguage(), sampleStream,
          parameters.getCutoff(), parameters.getNumberOfIterations());
    } catch (IOException e) {
      CmdLineUtil.printTrainingIoError(e);
View Full Code Here

    if (encoding == null) {
      System.out.println(getHelp());
      throw new TerminateToolException(1);
    }

    ChunkerModel model = new ChunkerModelLoader().load(new File(params.getModel()));

    ChunkerEvaluator evaluator = new ChunkerEvaluator(new ChunkerME(model));
   
    final ObjectStream<ChunkSample> sampleStream = ChunkerTrainerTool.openSampleData("Test",
        testData, encoding);
View Full Code Here

TOP

Related Classes of opennlp.tools.chunker.ChunkerModel

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.