String breaking functions for Unicode, implemented as bindings to the International Components for Unicode (ICU) libraries.
The text boundary positions are found according to the rules described in Unicode Standard Annex #29, Text Boundaries, and Unicode Standard Annex #14, Line Breaking Properties. These are available at http://www.unicode.org/reports/tr14/ and http://www.unicode.org/reports/tr29/.
- data BreakIterator a
- data Line
- data Word
- breakCharacter :: LocaleName -> Text -> IO (BreakIterator ())
- breakLine :: LocaleName -> Text -> IO (BreakIterator Line)
- breakSentence :: LocaleName -> Text -> IO (BreakIterator ())
- breakWord :: LocaleName -> Text -> IO (BreakIterator Word)
- clone :: BreakIterator a -> IO (BreakIterator a)
- setText :: BreakIterator a -> Text -> IO ()
- current :: BreakIterator a -> IO (Maybe I16)
- first :: BreakIterator a -> IO I16
- last :: BreakIterator a -> IO I16
- next :: BreakIterator a -> IO (Maybe I16)
- previous :: BreakIterator a -> IO (Maybe I16)
- preceding :: BreakIterator a -> Int -> IO (Maybe I16)
- following :: BreakIterator a -> Int -> IO (Maybe I16)
- isBoundary :: BreakIterator a -> Int -> IO Bool
- getStatus :: BreakIterator a -> IO a
- getStatuses :: BreakIterator a -> IO [a]
- available :: [LocaleName]
Line break status.
Word break status.
A "word" that does not fit into another category. Includes spaces and most punctuation.
A word that appears to be a number.
A word containing letters, excluding hiragana, katakana or ideographic characters.
A word containing kana characters.
A word containing ideographic characters.
Break a string on character boundaries.
Character boundary analysis identifies the boundaries of "Extended Grapheme Clusters", which are groupings of codepoints that should be treated as character-like units for many text operations. Please see Unicode Standard Annex #29, Unicode Text Segmentation, http://www.unicode.org/reports/tr29/ for additional information on grapheme clusters and guidelines on their use.
Break a string on line boundaries.
Line boundary analysis determines where a text string can be broken when line wrapping. The mechanism correctly handles punctuation and hyphenated words.
Break a string on sentence boundaries.
Sentence boundary analysis allows selection with correct interpretation of periods within numbers and abbreviations, and trailing punctuation marks such as quotation marks and parentheses.
Break a string on word boundaries.
Word boundary analysis is used by search and replace functions, as well as within text editing applications that allow the user to select words with a double click. Word selection provides correct interpretation of punctuation marks within and following words. Characters that are not part of a word, such as symbols or punctuation marks, have word breaks on both sides.
Thread safe cloning operation. This is substantially faster than
creating a new
BreakIterator from scratch.
Point an existing
BreakIterator at a new piece of text.
Important note: All of the indices accepted and returned by functions in this module are offsets into the raw UTF-16 text array, not a count of code points.
Reset the breaker to the beginning of the text to be scanned.
Advance the iterator and break at the text boundary that follows the current text boundary.
Advance the iterator and break at the text boundary that precedes the current text boundary.
Determine the text boundary preceding the specified offset.
Determine the text boundary following the specified offset.
Determine whether the specfied position is a boundary position. As a side effect, leaves the iterator pointing to the first boundary position at or after the given offset.
Return the status from the break rule that determined the most recently
returned break position. For rules that do not specify a status, a
default value of
() is returned.
Return statuses from all of the break rules that determined the most recently returned break position.