Interface Segmenter
- All Known Implementing Classes:
LocalizedSegmenter, RuleBasedSegmenter
public interface Segmenter
An interface that defines APIs for segmentation in terms of segments and boundaries, and
enforces immutable stateless iteration over the segmentation result yielded from an input
CharSequence.
Segmenter is designed to be a followup to the BreakIterator in providing
segmentation functionality. Segmenter provides immutable iteration, higher level
constructs like Segments and CharSequences as return types, and Java programmer
conveniences like Streams in its APIs.
Iteration over the input sequences is made immutable by separating the design into two parts,
each represented by an interface. The Segmenter interface represents the construction of
the object that encapsulates the segmentation logic. The Segments interface represents
the result of segmentation being performed for a specific given input CharSequence.
Segments APIs also provide Streams to support iteration over the segmentation
results in a stateless manner.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns aSegmentsobject that encapsulates the segmentation of the inputCharSequence.
-
Method Details
-
segment
Returns aSegmentsobject that encapsulates the segmentation of the inputCharSequence. TheSegmentsobject, in turn, provides the main APIs to support traversal over the resulting segments and boundaries via the JavaStreamabstraction.- Parameters:
s- inputCharSequenceon which segmentation is performed. The input must not be modified while using the resultingSegmentsobject.- Returns:
- A
Segmentsobject with APIs to access the results of segmentation, including APIs that returnStreams of the segments and boundaries.
-