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

model SentenceModel

the SentenceModel

SentenceDetectorME(SentenceModel, Factory)

public SentenceDetectorME(SentenceModel model, Factory factory)

Parameters

model SentenceModel
factory Factory

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

string

SPLIT

Constant indicates a sentence split.

public const string SPLIT = "s"

Field Value

string

useTokenEnd

protected readonly bool useTokenEnd

Field Value

bool

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

s string

the string in which the break occurred.

fromIndex int

the start of the segment currently being evaluated

candidateIndex int

the 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

s string

The 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

s string

The 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

languageCode string
samples IObjectStream<SentenceSample>
sdFactory SentenceDetectorFactory
mlParams TrainingParameters

Returns

SentenceModel

Train(string, IObjectStream<SentenceSample?>, bool, Dictionary)

public static SentenceModel Train(string languageCode, IObjectStream<SentenceSample?> samples, bool useTokenEnd, Dictionary abbreviations)

Parameters

languageCode string
samples IObjectStream<SentenceSample>
useTokenEnd bool
abbreviations Dictionary

Returns

SentenceModel

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

languageCode string
samples IObjectStream<SentenceSample>
useTokenEnd bool
abbreviations Dictionary
mlParams TrainingParameters

Returns

SentenceModel

Remarks

Deprecated: Use Train(string, IObjectStream, SentenceDetectorFactory, TrainingParameters) and pass in a SentenceDetectorFactory.