Class SentenceDetectorME
- Namespace
- NOpenNLP.Tools.Sentdetect
- Assembly
- NOpenNLP.Tools.dll
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.
public class SentenceDetectorME : ISentenceDetector
- Inheritance
-
SentenceDetectorME
- Implements
- Inherited Members
Constructors
SentenceDetectorME(SentenceModel)
Initializes the current instance.
public SentenceDetectorME(SentenceModel model)
Parameters
modelSentenceModelthe SentenceModel
SentenceDetectorME(SentenceModel, Factory)
public SentenceDetectorME(SentenceModel model, Factory factory)
Parameters
modelSentenceModelfactoryFactory
Remarks
Deprecated: Use a SentenceDetectorFactory to extend ISentenceDetector functionality.
Fields
NO_SPLIT
Constant indicates no sentence split.
public const string NO_SPLIT = "n"
Field Value
SPLIT
Constant indicates a sentence split.
public const string SPLIT = "s"
Field Value
useTokenEnd
protected readonly bool useTokenEnd
Field Value
Properties
SentenceProbabilities
Returns the probabilities associated with the most recent calls to sentDetect().
public virtual double[] SentenceProbabilities { get; }
Property Value
- double[]
probability for each sentence returned for the most recent call to sentDetect. If not applicable an empty array is returned.
Methods
IsAcceptableBreak(string, int, int)
Allows subclasses to check an overzealous (read: poorly trained) model from flagging obvious non-breaks as breaks based on some boolean determination of a break's acceptability.
The implementation here always returns true, which means that the IMaxentModel's outcome is taken as is.
protected virtual bool IsAcceptableBreak(string s, int fromIndex, int candidateIndex)
Parameters
sstringthe string in which the break occurred.
fromIndexintthe start of the segment currently being evaluated
candidateIndexintthe index of the candidate sentence ending
Returns
- bool
true if the break is acceptable
SentDetect(string)
Detect sentences in a String.
public virtual string[] SentDetect(string s)
Parameters
sstringThe string to be processed.
Returns
- string[]
A string array containing individual sentences as elements.
SentPosDetect(string)
Detect the position of the first words of sentences in a String.
public virtual Span[] SentPosDetect(string s)
Parameters
sstringThe string to be processed.
Returns
- Span[]
A integer array containing the positions of the end index of every sentence
Train(string, IObjectStream<SentenceSample?>, SentenceDetectorFactory, TrainingParameters)
public static SentenceModel Train(string languageCode, IObjectStream<SentenceSample?> samples, SentenceDetectorFactory sdFactory, TrainingParameters mlParams)
Parameters
languageCodestringsamplesIObjectStream<SentenceSample>sdFactorySentenceDetectorFactorymlParamsTrainingParameters
Returns
Train(string, IObjectStream<SentenceSample?>, bool, Dictionary)
public static SentenceModel Train(string languageCode, IObjectStream<SentenceSample?> samples, bool useTokenEnd, Dictionary abbreviations)
Parameters
languageCodestringsamplesIObjectStream<SentenceSample>useTokenEndboolabbreviationsDictionary
Returns
Remarks
Deprecated: Use Train(string, IObjectStream, SentenceDetectorFactory, TrainingParameters)
and pass in a SentenceDetectorFactory.
Train(string, IObjectStream<SentenceSample?>, bool, Dictionary, TrainingParameters)
public static SentenceModel Train(string languageCode, IObjectStream<SentenceSample?> samples, bool useTokenEnd, Dictionary abbreviations, TrainingParameters mlParams)
Parameters
languageCodestringsamplesIObjectStream<SentenceSample>useTokenEndboolabbreviationsDictionarymlParamsTrainingParameters
Returns
Remarks
Deprecated: Use Train(string, IObjectStream, SentenceDetectorFactory, TrainingParameters)
and pass in a SentenceDetectorFactory.