Codota Logo
opennlp.tools.sentdetect
Code IndexAdd Codota to your IDE (free)

How to use opennlp.tools.sentdetect

Best Java code snippets using opennlp.tools.sentdetect (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: Vedenin/useful-java-links

private Span[] testOpenNLPPosition(String text) throws Exception {
  try (InputStream modelIn = this.getClass().getResourceAsStream(RESOURCES_EN_SENT_BIN)) {
    SentenceModel model = new SentenceModel(modelIn);
    SentenceDetectorME sentenceDetector = new SentenceDetectorME(model);
    return sentenceDetector.sentPosDetect(text);
  }
}
origin: Vedenin/useful-java-links

private String[] testOpenNLP(String text) throws Exception {
  try (InputStream modelIn = this.getClass().getResourceAsStream(RESOURCES_EN_SENT_BIN)) {
    SentenceModel model = new SentenceModel(modelIn);
    SentenceDetectorME sentenceDetector = new SentenceDetectorME(model);
    return sentenceDetector.sentDetect(text);
  }
}
origin: apache/opennlp

 public char[] getEosCharacters() {
  if (getFactory() != null) {
   return getFactory().getEOSCharacters();
  }
  return null;
 }
}
origin: apache/opennlp

@Override
protected SentenceModel loadModel(InputStream modelIn) throws IOException,
  InvalidFormatException {
 return new SentenceModel(modelIn);
}
origin: apache/opennlp

@Override
protected SentenceSample processSample(SentenceSample sample) {
 Span[] predictions =
   trimSpans(sample.getDocument(), sentenceDetector.sentPosDetect(sample.getDocument()));
 Span[] references = trimSpans(sample.getDocument(), sample.getSentences());
 fmeasure.updateScores(references, predictions);
 return new SentenceSample(sample.getDocument(), predictions);
}
origin: apache/opennlp

/**
 * Initializes the current instance.
 *
 * @param model the {@link SentenceModel}
 */
public SentenceDetectorME(SentenceModel model) {
 SentenceDetectorFactory sdFactory = model.getFactory();
 this.model = model.getMaxentModel();
 cgen = sdFactory.getSDContextGenerator();
 scanner = sdFactory.getEndOfSentenceScanner();
 useTokenEnd = sdFactory.isUseTokenEnd();
}
origin: apache/opennlp

/**
 * @deprecated Use
 *             {@link #train(String, ObjectStream, SentenceDetectorFactory, TrainingParameters)}
 *             and pass in af {@link SentenceDetectorFactory}.
 */
public static SentenceModel train(String languageCode,
  ObjectStream<SentenceSample> samples, boolean useTokenEnd,
  Dictionary abbreviations, TrainingParameters mlParams) throws IOException {
 SentenceDetectorFactory sdFactory = new SentenceDetectorFactory(
   languageCode, useTokenEnd, abbreviations, null);
 return train(languageCode, samples, sdFactory, mlParams);
}
origin: apache/opennlp

/**
 * @deprecated Use
 *             {@link #SDCrossValidator(String, TrainingParameters,
 *             SentenceDetectorFactory, SentenceDetectorEvaluationMonitor...)}
 *             and pass in a {@link SentenceDetectorFactory}.
 */
public SDCrossValidator(String languageCode, TrainingParameters params) {
 this(languageCode, params, new SentenceDetectorFactory(languageCode, true,
   null, null));
}
origin: apache/opennlp

private static SentenceModel train(SentenceDetectorFactory factory)
  throws IOException {
 return SentenceDetectorME.train("eng", createSampleStream(), factory,
   TrainingParameters.defaultParams());
}
origin: apache/opennlp

public Dictionary getAbbreviations() {
 if (getFactory() != null) {
  return getFactory().getAbbreviationDictionary();
 }
 return null;
}
origin: apache/opennlp

public boolean useTokenEnd() {
 return getFactory() == null || getFactory().isUseTokenEnd();
}
origin: apache/opennlp

@Override
public SDContextGenerator getSDContextGenerator() {
 return new DummySDContextGenerator(getAbbreviationDictionary()
   .asStringSet(), getEOSCharacters());
}
origin: apache/opennlp

@Override
protected void init(String languageCode, boolean useTokenEnd,
  Dictionary abbreviationDictionary, char[] eosCharacters) {
 super.init(languageCode, useTokenEnd, abbreviationDictionary, eosCharacters);
 this.dict = new DummyDictionary(abbreviationDictionary);
}
origin: apache/opennlp

/**
 * Creates a {@link SentenceDetectorFactory}. Use this constructor to
 * programmatically create a factory.
 *
 * @param languageCode
 * @param abbreviationDictionary
 * @param eosCharacters
 */
public SentenceDetectorFactory(String languageCode, boolean useTokenEnd,
  Dictionary abbreviationDictionary, char[] eosCharacters) {
 this.init(languageCode, useTokenEnd, abbreviationDictionary, eosCharacters);
}
origin: apache/opennlp

@Override
public EndOfSentenceScanner getEndOfSentenceScanner() {
 return new DummyEOSScanner(getEOSCharacters());
}
origin: apache/opennlp

@Override
@SuppressWarnings("rawtypes")
public Map<String, ArtifactSerializer> createArtifactSerializersMap() {
 Map<String, ArtifactSerializer> serializers = super.createArtifactSerializersMap();
 serializers.put(DUMMY_DICT, new DummyDictionarySerializer());
 return serializers;
}
origin: apache/opennlp

 public void serialize(DummyDictionary artifact, OutputStream out)
   throws IOException {
  artifact.serialize(out);
 }
}
origin: apache/opennlp

 @Override
 protected SentenceModel loadModel(InputStream in) throws IOException {
  return new SentenceModel(in);
 }
}
origin: apache/opennlp

/**
 * @deprecated use
 *             {@link #SDCrossValidator(String, TrainingParameters, SentenceDetectorFactory,
 *             SentenceDetectorEvaluationMonitor...)}
 *             instead and pass in a TrainingParameters object.
 */
public SDCrossValidator(String languageCode, TrainingParameters params,
  SentenceDetectorEvaluationMonitor... listeners) {
 this(languageCode, params, new SentenceDetectorFactory(languageCode, true,
   null, null), listeners);
}
origin: apache/opennlp

/**
 * TODO: was added in 1.5.3 -&gt; remove
 * @deprecated Use
 *             {@link #SentenceModel(String, MaxentModel, Map, SentenceDetectorFactory)}
 *             instead and pass in a {@link SentenceDetectorFactory}
 */
public SentenceModel(String languageCode, MaxentModel sentModel, boolean useTokenEnd,
  Dictionary abbreviations, char[] eosCharacters, Map<String, String> manifestInfoEntries) {
 this(languageCode, sentModel, manifestInfoEntries,
   new SentenceDetectorFactory(languageCode, useTokenEnd, abbreviations,
     eosCharacters));
}
opennlp.tools.sentdetect

Most used classes

  • SentenceDetectorME
    A sentence detector for splitting up raw text into sentences. A maximum entropy model is used to eva
  • SentenceModel
    The SentenceModel is the model used by a learnable SentenceDetector.
  • SentenceDetector
    The interface for sentence detectors, which find the sentence boundaries in a text.
  • SentenceDetectorFactory
    The factory that provides SentenceDetecor default implementations and resources
  • SentenceSample
    A SentenceSample contains a document with begin indexes of the individual sentences.
  • DefaultSDContextGenerator,
  • EndOfSentenceScanner,
  • SDContextGenerator,
  • DefaultEndOfSentenceScanner,
  • SDEventStream,
  • Factory,
  • NewlineSentenceDetector,
  • SDCrossValidator,
  • SentenceDetectorEvaluator,
  • EmptyLinePreprocessorStream,
  • SentenceContextGenerator,
  • AbstractEndOfSentenceScanner,
  • DummySentenceDetectorFactory$DummyDictionary,
  • DummySentenceDetectorFactory$DummyDictionarySerializer
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now