public class SentenceDetectorME extends Object implements SentenceDetector
A maximum entropy model is used to evaluate end-of-sentence characters in a string to determine if they signify the end of a sentence.
Modifier and Type | Field and Description |
---|---|
static String |
NO_SPLIT
Constant indicates no sentence split.
|
static String |
SPLIT
Constant indicates a sentence split.
|
Constructor and Description |
---|
SentenceDetectorME(SentenceModel model)
Initializes the current instance.
|
SentenceDetectorME(SentenceModel model,
Factory factory)
Deprecated.
Use a
SentenceDetectorFactory to extend
SentenceDetector functionality. |
Modifier and Type | Method and Description |
---|---|
double[] |
getSentenceProbabilities()
Returns the probabilities associated with the most recent
calls to sentDetect().
|
String[] |
sentDetect(String s)
Detect sentences in a String.
|
Span[] |
sentPosDetect(String s)
Detect the position of the first words of sentences in a String.
|
static SentenceModel |
train(String languageCode,
ObjectStream<SentenceSample> samples,
boolean useTokenEnd,
Dictionary abbreviations)
Deprecated.
|
static SentenceModel |
train(String languageCode,
ObjectStream<SentenceSample> samples,
boolean useTokenEnd,
Dictionary abbreviations,
TrainingParameters mlParams)
Deprecated.
|
static SentenceModel |
train(String languageCode,
ObjectStream<SentenceSample> samples,
SentenceDetectorFactory sdFactory,
TrainingParameters mlParams) |
public static final String SPLIT
public static final String NO_SPLIT
public SentenceDetectorME(SentenceModel model)
model
- the SentenceModel
public SentenceDetectorME(SentenceModel model, Factory factory)
SentenceDetectorFactory
to extend
SentenceDetector functionality.public String[] sentDetect(String s)
sentDetect
in interface SentenceDetector
s
- The string to be processed.public Span[] sentPosDetect(String s)
sentPosDetect
in interface SentenceDetector
s
- The string to be processed.public double[] getSentenceProbabilities()
public static SentenceModel train(String languageCode, ObjectStream<SentenceSample> samples, boolean useTokenEnd, Dictionary abbreviations, TrainingParameters mlParams) throws IOException
train(String, ObjectStream, SentenceDetectorFactory, TrainingParameters)
and pass in af SentenceDetectorFactory
.IOException
public static SentenceModel train(String languageCode, ObjectStream<SentenceSample> samples, SentenceDetectorFactory sdFactory, TrainingParameters mlParams) throws IOException
IOException
@Deprecated public static SentenceModel train(String languageCode, ObjectStream<SentenceSample> samples, boolean useTokenEnd, Dictionary abbreviations) throws IOException
train(String, ObjectStream, SentenceDetectorFactory, TrainingParameters)
and pass in af SentenceDetectorFactory
.IOException
Copyright © 2018 The Apache Software Foundation. All rights reserved.