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:
    Segments, BreakIterator
    Status:
    Draft ICU 78.
    • Method Detail

      • segment

        Segments segment​(CharSequence s)
        Returns a Segments object that encapsulates the segmentation of the input CharSequence. The Segments object, in turn, provides the main APIs to support traversal over the resulting segments and boundaries via the Java Stream abstraction.
        Parameters:
        s - input CharSequence on which segmentation is performed. The input must not be modified while using the resulting Segments object.
        Returns:
        A Segments object with APIs to access the results of segmentation, including APIs that return Streams of the segments and boundaries.
        Status:
        Draft ICU 78.