Class OpenNLPSentenceBreakIterator
A ICU4N.Text.BreakIterator that splits sentences using an OpenNLP sentence chunking model.
Inherited Members
Namespace: Lucene.Net.Analysis.OpenNlp
Assembly: Lucene.Net.Analysis.OpenNLP.dll
Syntax
public sealed class OpenNLPSentenceBreakIterator : BreakIterator
Constructors
OpenNLPSentenceBreakIterator(NLPSentenceDetectorOp)
A ICU4N.Text.BreakIterator that splits sentences using an OpenNLP sentence chunking model.
Declaration
public OpenNLPSentenceBreakIterator(NLPSentenceDetectorOp sentenceOp)
Parameters
Type | Name | Description |
---|---|---|
NLPSentenceDetectorOp | sentenceOp |
Properties
Current
Gets the iterator's current position.
Declaration
public override int Current { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Text
Gets a ICU4N.Support.Text.CharacterIterator over the text being analyzed.
For at least some subclasses of ICU4N.Text.BreakIterator, this is a reference
to the actual iterator being used by the ICU4N.Text.BreakIterator,
and therefore, this function's return value should be treated as
const
. No guarantees are made about the current position
of this iterator when it is returned. If you need to move that
position to examine the text, clone this function's return value first.
Declaration
public override CharacterIterator Text { get; }
Property Value
Type | Description |
---|---|
CharacterIterator | A ICU4N.Support.Text.CharacterIterator over the text being analyzed. |
Overrides
Methods
First()
Set the iterator to the first boundary position. This is always the beginning index of the text this iterator iterates over. For example, if the iterator iterates over a whole string, this function will always return 0.
Declaration
public override int First()
Returns
Type | Description |
---|---|
int | The character offset of the beginning of the stretch of text being broken. |
Overrides
Following(int)
Sets the iterator's current iteration position to be the first boundary position following the specified position. (Whether the specified position is itself a boundary position or not doesn't matter-- this function always moves the iteration position to the first boundary after the specified position.) If the specified position is the past-the-end position, returns ICU4N.Text.BreakIterator.Done.
Declaration
public override int Following(int pos)
Parameters
Type | Name | Description |
---|---|---|
int | pos |
Returns
Type | Description |
---|---|
int | The position of the first boundary position following
" |
Overrides
Last()
Set the iterator to the last boundary position. This is always the "past-the-end" index of the text this iterator iterates over. For example, if the iterator iterates over a whole string (call it "text"), this function will always return text.Length.
Declaration
public override int Last()
Returns
Type | Description |
---|---|
int | The character offset of the end of the stretch of text being broken. |
Overrides
Next()
Advances the iterator forward one boundary. The current iteration position is updated to point to the next boundary position after the current position, and this is also the value that is returned. If the current position is equal to the value returned by ICU4N.Text.BreakIterator.Last(), or to ICU4N.Text.BreakIterator.Done, this function returns ICU4N.Text.BreakIterator.Done and sets the current position to ICU4N.Text.BreakIterator.Done.
Declaration
public override int Next()
Returns
Type | Description |
---|---|
int | The position of the first boundary position following the iteration position. |
Overrides
Next(int)
Move the iterator by the specified number of steps in the text.
A positive number moves the iterator forward; a negative number
moves the iterator backwards. If this causes the iterator
to move off either end of the text, this function returns ICU4N.Text.BreakIterator.Done;
otherwise, this function returns the position of the appropriate
boundary. Calling this function is equivalent to calling ICU4N.Text.BreakIterator.Next() or
ICU4N.Text.BreakIterator.Previous()n
times.
Declaration
public override int Next(int n)
Parameters
Type | Name | Description |
---|---|---|
int | n | The number of boundaries to advance over (if positive, moves forward; if negative, moves backwards). |
Returns
Type | Description |
---|---|
int | The position of the boundary |
Overrides
Preceding(int)
Sets the iterator's current iteration position to be the last boundary position preceding the specified position. (Whether the specified position is itself a boundary position or not doesn't matter-- this function always moves the iteration position to the last boundary before the specified position.) If the specified position is the starting position, returns ICU4N.Text.BreakIterator.Done.
Declaration
public override int Preceding(int pos)
Parameters
Type | Name | Description |
---|---|---|
int | pos |
Returns
Type | Description |
---|---|
int | The position of the last boundary position preceding
" |
Overrides
Previous()
Move the iterator backward one boundary. The current iteration position is updated to point to the last boundary position before the current position, and this is also the value that is returned. If the current position is equal to the value returned by ICU4N.Text.BreakIterator.First(), or to ICU4N.Text.BreakIterator.Done, this function returns ICU4N.Text.BreakIterator.Done and sets the current position to ICU4N.Text.BreakIterator.Done.
Declaration
public override int Previous()
Returns
Type | Description |
---|---|
int | position of the last boundary position preceding the iteration position. |
Overrides
SetText(CharacterIterator)
Sets the iterator to analyze a new piece of text. The ICU4N.Text.BreakIterator is passed a ICU4N.Support.Text.CharacterIterator through which it will access the text itself. The current iteration position is reset to the ICU4N.Support.Text.CharacterIterator's start index. (The old iterator is dropped.)
Declaration
public override void SetText(CharacterIterator newText)
Parameters
Type | Name | Description |
---|---|---|
CharacterIterator | newText | A ICU4N.Support.Text.CharacterIterator referring to the text to analyze with this BreakIterator (the iterator's current position is ignored, but its other state is significant). |