Package opennlp.tools.sentdetect

Examples of opennlp.tools.sentdetect.SentenceModel


  }

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


  }

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

    SentenceModel model = new SentenceModelLoader().load(params.getModel());

    SentenceDetectorEvaluationMonitor errorListener = null;
    if (params.getMisclassified()) {
      errorListener = new SentenceEvaluationErrorListener();
    }
View Full Code Here

      String eosString = SentenceSampleStream.replaceNewLineEscapeTags(
          params.getEosChars());
      eos = eosString.toCharArray();
    }

    SentenceModel model;

    try {
      Dictionary dict = loadDict(params.getAbbDict());
      SentenceDetectorFactory sdFactory = SentenceDetectorFactory.create(
          params.getFactory(), params.getLang(), true, dict, eos);
View Full Code Here

    SentenceDetector sentDetector;

    if (params.getSentenceDetectorModel() != null) {
      try {
        sentDetector = new SentenceDetectorME(new SentenceModel(params.getSentenceDetectorModel()));
      } catch (IOException e) {
        throw new TerminateToolException(-1, "Failed to load sentence detector model!", e);
      }
    }
    else {
View Full Code Here

    return model;
  }

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

    if (sampleTraceFile != null) {
        samplesOut = new OutputStreamWriter(new FileOutputStream(sampleTraceFile), sampleTraceFileEncoding);
        samples = new SampleTraceStream<SentenceSample>(samples, samplesOut);
    }

    SentenceModel sentenceModel = SentenceDetectorME.train(language, samples,
         sdFactory, mlParams);

    // dereference to allow garbage collection
    sentenceSamples = null;
View Full Code Here

  public void initialize(UimaContext context)
      throws ResourceInitializationException {

    super.initialize(context);

    SentenceModel model;

    try {
      SentenceModelResource modelResource = (SentenceModelResource) context
          .getResourceObject(UimaUtil.MODEL_PARAMETER);
View Full Code Here

        sLogger.info("--> classifier model");
      }
    }

    InputStream modelIn = localFs.open(pathMapping.get(sentDetectorFile));
    SentenceModel model = new SentenceModel(modelIn);
    fModel = new SentenceDetectorME(model);
    sLogger.info("Sentence model created successfully from " + pathMapping.get(sentDetectorFile));

    eVocabSrc = (VocabularyWritable) HadoopAlign.loadVocab(pathMapping.get(eVocabSrcFile), localFs);
    eVocabTrg = (VocabularyWritable) HadoopAlign.loadVocab(pathMapping.get(eVocabTrgFile), localFs);
View Full Code Here

      }
    }

    FileSystem localFs = FileSystem.getLocal(conf);
    InputStream modelIn = localFs.open(pathMapping.get(sentDetectorFile));
    SentenceModel model = new SentenceModel(modelIn);
    eModel = new SentenceDetectorME(model);
    sLogger.info("Sentence model created successfully.");

    FileSystem fs = FileSystem.get(conf);  
    RetrievalEnvironment env = new RetrievalEnvironment(eDir, fs);
View Full Code Here

    sLogger.info("Loading models for " + fLang + " ...");
    //    FileSystem fs = FileSystem.get(conf);
    FileSystem localFs = FileSystem.getLocal(conf);

    InputStream modelIn = localFs.open(new Path(conf.get("eSentDetectorFile")));
    SentenceModel model = new SentenceModel(modelIn);
    fModel = new SentenceDetectorME(model);
    sLogger.info("Sentence model created successfully.");

    eVocabSrc = (VocabularyWritable) HadoopAlign.loadVocab(new Path(conf.get("eVocabSrcFile")), localFs);
    eVocabTrg = (VocabularyWritable) HadoopAlign.loadVocab(new Path(conf.get("eVocabTrgFile")), localFs);
View Full Code Here

TOP

Related Classes of opennlp.tools.sentdetect.SentenceModel

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.