Package opennlp.tools.chunker

Examples of opennlp.tools.chunker.ChunkerModel


        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


        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

    }

    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 = null;
      PerformanceMonitor perfMon = null;
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

    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), ModelUtil.createDefaultTrainingParameters(), ChunkerFactory.create(null));

    // dereference to allow garbage collection
    mChunkSamples  = null;

    File modelFile = new File(getUimaContextAdmin().getResourceManager()
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.