Package opennlp.tools.sentdetect
Class SentenceDetectorME
- java.lang.Object
- 
- opennlp.tools.sentdetect.SentenceDetectorME
 
- 
- All Implemented Interfaces:
- SentenceDetector
 
 public class SentenceDetectorME extends Object implements SentenceDetector A sentence detector for splitting up raw text into sentences.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. 
- 
- 
Constructor SummaryConstructors Constructor Description SentenceDetectorME(String language)Initializes the sentence detector by downloading a default model.SentenceDetectorME(SentenceModel model)Initializes the current instance.SentenceDetectorME(SentenceModel model, Factory factory)Deprecated.Use aSentenceDetectorFactoryto extend SentenceDetector functionality.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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 SentenceModeltrain(String languageCode, ObjectStream<SentenceSample> samples, boolean useTokenEnd, Dictionary abbreviations)Deprecated.static SentenceModeltrain(String languageCode, ObjectStream<SentenceSample> samples, boolean useTokenEnd, Dictionary abbreviations, TrainingParameters mlParams)Deprecated.static SentenceModeltrain(String languageCode, ObjectStream<SentenceSample> samples, SentenceDetectorFactory sdFactory, TrainingParameters mlParams)
 
- 
- 
- 
Field Detail- 
SPLITpublic static final String SPLIT Constant indicates a sentence split.- See Also:
- Constant Field Values
 
 - 
NO_SPLITpublic static final String NO_SPLIT Constant indicates no sentence split.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SentenceDetectorMEpublic SentenceDetectorME(String language) throws IOException Initializes the sentence detector by downloading a default model.- Parameters:
- language- The language of the sentence detector.
- Throws:
- IOException- Thrown if the model cannot be downloaded or saved.
 
 - 
SentenceDetectorMEpublic SentenceDetectorME(SentenceModel model) Initializes the current instance.- Parameters:
- model- the- SentenceModel
 
 - 
SentenceDetectorMEpublic SentenceDetectorME(SentenceModel model, Factory factory) Deprecated.Use aSentenceDetectorFactoryto extend SentenceDetector functionality.
 
- 
 - 
Method Detail- 
sentDetectpublic String[] sentDetect(String s) Detect sentences in a String.- Specified by:
- sentDetectin interface- SentenceDetector
- Parameters:
- s- The string to be processed.
- Returns:
- A string array containing individual sentences as elements.
 
 - 
sentPosDetectpublic Span[] sentPosDetect(String s) Detect the position of the first words of sentences in a String.- Specified by:
- sentPosDetectin interface- SentenceDetector
- Parameters:
- s- The string to be processed.
- Returns:
- A integer array containing the positions of the end index of every sentence
 
 - 
getSentenceProbabilitiespublic double[] getSentenceProbabilities() Returns the probabilities associated with the most recent calls to sentDetect().- Returns:
- probability for each sentence returned for the most recent call to sentDetect. If not applicable an empty array is returned.
 
 - 
trainpublic static SentenceModel train(String languageCode, ObjectStream<SentenceSample> samples, boolean useTokenEnd, Dictionary abbreviations, TrainingParameters mlParams) throws IOException Deprecated.- Throws:
- IOException
 
 - 
trainpublic static SentenceModel train(String languageCode, ObjectStream<SentenceSample> samples, SentenceDetectorFactory sdFactory, TrainingParameters mlParams) throws IOException - Throws:
- IOException
 
 - 
train@Deprecated public static SentenceModel train(String languageCode, ObjectStream<SentenceSample> samples, boolean useTokenEnd, Dictionary abbreviations) throws IOException Deprecated.- Throws:
- IOException
 
 
- 
 
-