Package opennlp.tools.chunker

Examples of opennlp.tools.chunker.ChunkerModel


 
  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


        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

    return model;
  }

  @Override
  protected ChunkerModel loadModel(InputStream in) throws IOException {
    return new ChunkerModel(in);
  }
View Full Code Here

   */
  public void collectionProcessComplete(ProcessTrace trace)
      throws ResourceProcessException, IOException {
    GIS.PRINT_MESSAGES = false;
   
    ChunkerModel chunkerModel = ChunkerME.train(language, ObjectStreamUtils.createObjectStream(mChunkSamples), 100, 5);
   
    // dereference to allow garbage collection
    mChunkSamples  = null;
   
    File modelFile = new File(getUimaContextAdmin().getResourceManager()
View Full Code Here

    CmdLineUtil.checkOutputFile("sentence detector model", modelOutFile);
    ObjectStream<ChunkSample> sampleStream =
      openSampleData("Training", trainingDataInFile, params.getEncoding());
   
    ChunkerModel model;
    try {
      if (mlParams == null) {
        model = ChunkerME.train(params.getLang(), sampleStream,
            params.getCutoff(), params.getIterations());
      }
View Full Code Here

    CmdLineUtil.checkInputFile("Test data", testData);

    Charset encoding = params.getEncoding();

    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

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

    if (args.length != 1) {
      System.out.println(getHelp());
      throw new TerminateToolException(1);
    }
   
    ChunkerModel model = new ChunkerModelLoader().load(new File(args[0]));
   
    ChunkerME chunker = new ChunkerME(model, ChunkerME.DEFAULT_BEAM_SIZE,
        new DefaultChunkerSequenceValidator());
   
    ObjectStream<String> lineStream =
View Full Code Here

   
    if (mLogger.isLoggable(Level.INFO)) {
      mLogger.log(Level.INFO, "Initializing the OpenNLP Chunker annotator.");
    }   
   
    ChunkerModel model;
   
    try {
      ChunkerModelResource modelResource =
            (ChunkerModelResource) context.getResourceObject(UimaUtil.MODEL_PARAMETER);
       
View Full Code Here

  public void initialize(UimaContext uimaContext) throws ResourceInitializationException {
    super.initialize(uimaContext);

    logger.info("Chunker model file: " + chunkerModelPath);
    try (InputStream fis = FileLocator.getAsStream(chunkerModelPath)) {
      ChunkerModel model = new ChunkerModel(fis);
      chunker = new opennlp.tools.chunker.ChunkerME(model);

    } catch (IOException e) {
      logger.info("Chunker model: " + chunkerModelPath);
      throw new ResourceInitializationException(e);
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.