Package opennlp.tools.chunker

Examples of opennlp.tools.chunker.ChunkerModel


        mlParams.getParameters("tagger"), null, null);
   
    parseSamples.reset();
   
    // chunk
    ChunkerModel chunkModel = ChunkerME.train(languageCode,
        new ChunkSampleStream(parseSamples),
        new ChunkContextGenerator(), mlParams.getParameters("chunker"));
   
    parseSamples.reset();
   
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

        parseSamples), mlParams.getParameters("tagger"), null, null);
   
    parseSamples.reset();
   
    // chunk
    ChunkerModel chunkModel = ChunkerME.train(languageCode, new ChunkSampleStream(
        parseSamples), new ChunkContextGenerator(), mlParams.getParameters("chunker"));
   
    parseSamples.reset();
   
    // build
View Full Code Here

    }

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

    ChunkerModel model;
    try {
      ChunkerFactory chunkerFactory = ChunkerFactory
          .create(params.getFactory());
      model = ChunkerME.train(params.getLang(), sampleStream, mlParams,
          chunkerFactory);
View Full Code Here

  }

  public void run(String format, String[] args) {
    super.run(format, args);

    ChunkerModel model = new ChunkerModelLoader().load(params.getModel());
   
    List<EvaluationMonitor<ChunkSample>> listeners = new LinkedList<EvaluationMonitor<ChunkSample>>();
    ChunkerDetailedFMeasureListener detailedFMeasureListener = null;
    if(params.getMisclassified()) {
      listeners.add(new ChunkEvaluationErrorListener());
View Full Code Here

    super("Chunker");
  }
 
  @Override
  protected ChunkerModel loadModel(InputStream modelIn) throws IOException {
    return new ChunkerModel(modelIn);
  }
View Full Code Here

  public void run(String[] args) {
    if (args.length != 1) {
      System.out.println(getHelp());
    } else {
      ChunkerModel model = new ChunkerModelLoader().load(new File(args[0]));

      ChunkerME chunker = new ChunkerME(model, ChunkerME.DEFAULT_BEAM_SIZE);

      ObjectStream<String> lineStream =
        new PlainTextByLineStream(new InputStreamReader(System.in));
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

        POSTagger posTagger = openNLP.getPartOfSpeechTagger("ru");
        Assert.assertNull(posTagger);
    }
    @Test
    public void testLoadEnChunker() throws IOException{
        ChunkerModel model = openNLP.getChunkerModel("en");
        Assert.assertNotNull(model);
        Chunker chunker = openNLP.getChunker("en");
        Assert.assertNotNull(chunker);
    }
View Full Code Here

        Chunker chunker = openNLP.getChunker("en");
        Assert.assertNotNull(chunker);
    }
    @Test
    public void testLoadMissingChunker() throws IOException{
        ChunkerModel model = openNLP.getChunkerModel("ru");
        Assert.assertNull(model);
        Chunker chunker = openNLP.getChunker("ru");
        Assert.assertNull(chunker);
    }   
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.