C API: BreakIterator. More...
Go to the source code of this file.
enum UBreakIteratorType {C API: BreakIterator.
BreakIterator C APIThe BreakIterator C API defines methods for finding the location of boundaries in text. Pointer to a UBreakIterator maintain a current position and scan over text returning the index of characters where boundaries occur.
Line boundary analysis determines where a text string can be broken when line-wrapping. The mechanism correctly handles punctuation and hyphenated words.
Note: The locale keyword "lb" can be used to modify line break behavior according to the CSS level 3 line-break options, see http://dev.w3.org/csswg/css-text/#line-breaking. For example: "ja@lb=strict", "zh@lb=loose".
Sentence boundary analysis allows selection with correct interpretation of periods within numbers and abbreviations, and trailing punctuation marks such as quotation marks and parentheses.
Note: The locale keyword "ss" can be used to enable use of segmentation suppression data (preventing breaks in English after abbreviations such as "Mr." or "Est.", for example), as follows: "en@ss=standard".
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.
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.
Title boundary analysis locates all positions, typically starts of words, that should be set to Title Case when title casing the text.
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/.
In addition to the plain C API defined in this header file, an object oriented C++ API with equivalent functionality is defined in the file brkiter.h.
Code snippets illustrating the use of the Break Iterator APIs are available in the ICU User Guide, https://unicode-org.github.io/icu/userguide/boundaryanalysis/ and in the sample program icu/source/samples/break/break.cpp
Definition in file ubrk.h.
◆ U_BRK_SAFECLONE_BUFFERSIZE #define U_BRK_SAFECLONE_BUFFERSIZE 1A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone().
Definition at line 346 of file ubrk.h.
◆ UBRK_DONE #define UBRK_DONE ((int32_t) -1)Value indicating all text boundaries have been returned.
Definition at line 133 of file ubrk.h.
◆ UBRK_TYPEDEF_UBREAK_ITERATOR #define UBRK_TYPEDEF_UBREAK_ITERATORA text-break iterator.
For usage in C programs.
Definition at line 26 of file ubrk.h.
◆ UBreakIteratorOpaque type representing an ICU Break iterator object.
Definition at line 1 of file ubrk.h.
◆ UBreakIteratorTypeThe possible types of text boundaries.
Enum constants for the line break tags returned by getRuleStatus().
A range of values is defined for each category of word, to allow for further subdivisions of a category in future releases. Applications should check for tag values falling within the range, rather than for single individual values.
The numeric values of all of these constants are stable (will not change).
Enum constants for the sentence break tags returned by getRuleStatus().
A range of values is defined for each category of sentence, to allow for further subdivisions of a category in future releases. Applications should check for tag values falling within the range, rather than for single individual values.
The numeric values of all of these constants are stable (will not change).
Enum constants for the word break tags returned by getRuleStatus().
A range of values is defined for each category of word, to allow for further subdivisions of a category in future releases. Applications should check for tag values falling within the range, rather than for single individual values.
The numeric values of all of these constants are stable (will not change).
The possible types of text boundaries.
Character breaks.
Word breaks.
Line breaks.
Sentence breaks.
Title Case breaks The iterator created using this type locates title boundaries as described for Unicode 3.2 only.
For Unicode 4.0 and above title boundary iteration, please use Word Boundary iterator.
One more than the highest normal UBreakIteratorType value.
Definition at line 102 of file ubrk.h.
◆ ULineBreakTagEnum constants for the line break tags returned by getRuleStatus().
A range of values is defined for each category of word, to allow for further subdivisions of a category in future releases. Applications should check for tag values falling within the range, rather than for single individual values.
The numeric values of all of these constants are stable (will not change).
Tag value for soft line breaks, positions at which a line break is acceptable but not required
Upper bound for soft line breaks.
UBRK_LINE_HARDTag value for a hard, or mandatory line break
Upper bound for hard line breaks.
Definition at line 183 of file ubrk.h.
◆ USentenceBreakTagEnum constants for the sentence break tags returned by getRuleStatus().
A range of values is defined for each category of sentence, to allow for further subdivisions of a category in future releases. Applications should check for tag values falling within the range, rather than for single individual values.
The numeric values of all of these constants are stable (will not change).
Tag value for for sentences ending with a sentence terminator ('.
', '?', '!', etc.) character, possibly followed by a hard separator (CR, LF, PS, etc.)
UBRK_SENTENCE_TERM_LIMITUpper bound for tags for sentences ended by sentence terminators.
UBRK_SENTENCE_SEPTag value for for sentences that do not contain an ending sentence terminator ('.
', '?', '!', etc.) character, but are ended only by a hard separator (CR, LF, PS, etc.) or end of input.
UBRK_SENTENCE_SEP_LIMITUpper bound for tags for sentences ended by a separator.
Definition at line 208 of file ubrk.h.
◆ UWordBreakEnum constants for the word break tags returned by getRuleStatus().
A range of values is defined for each category of word, to allow for further subdivisions of a category in future releases. Applications should check for tag values falling within the range, rather than for single individual values.
The numeric values of all of these constants are stable (will not change).
Tag value for "words" that do not fit into any of other categories.
Includes spaces and most punctuation.
UBRK_WORD_NONE_LIMITUpper bound for tags for uncategorized words.
UBRK_WORD_NUMBERTag value for words that appear to be numbers, lower limit.
UBRK_WORD_NUMBER_LIMITTag value for words that appear to be numbers, upper limit.
UBRK_WORD_LETTERTag value for words that contain letters, excluding hiragana, katakana or ideographic characters, lower limit.
UBRK_WORD_LETTER_LIMITTag value for words containing letters, upper limit
Tag value for words containing kana characters, lower limit.
UBRK_WORD_KANA_LIMITTag value for words containing kana characters, upper limit.
UBRK_WORD_IDEOTag value for words containing ideographic characters, lower limit.
UBRK_WORD_IDEO_LIMITTag value for words containing ideographic characters, upper limit.
Definition at line 147 of file ubrk.h.
◆ ubrk_clone()Thread safe cloning operation.
Close a UBreakIterator.
Once closed, a UBreakIterator may no longer be used.
Determine how many locales have text breaking information available.
This function is most useful as determining the loop ending condition for calls to ubrk_getAvailable.
Set the iterator position to zero, the start of the text being scanned.
Advance the iterator to the first boundary following the specified offset.
The value returned is always greater than offset, or UBRK_DONE.
Get a locale for which text breaking information is available.
A UBreakIterator in a locale returned by this function will perform the correct text breaking for the locale.
Get a compiled binary version of the rules specifying the behavior of a UBreakIterator.
The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator more quickly than using ubrk_openRules. The compiled rules are not compatible across different major versions of ICU, nor across platforms of different endianness or different base character set family (ASCII vs EBCDIC). Supports preflighting (with binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to the binaryRules buffer. However, whether preflighting or not, if the actual length is greater than INT32_MAX, then the function returns 0 and sets *status to U_INDEX_OUTOFBOUNDS_ERROR.
Return the locale of the break iterator.
You can choose between the valid and the actual locale.
Return the status from the break rule that determined the most recently returned break position.
The values appear in the rule source within brackets, {123}, for example. For rules that do not specify a status, a default value of 0 is returned.
For word break iterators, the possible values are defined in enum UWordBreak.
Get the statuses from the break rules that determined the most recently returned break position.
The values appear in the rule source within brackets, {123}, for example. The default status value for rules that do not explicitly provide one is zero.
For word break iterators, the possible values are defined in enum UWordBreak.
Returns true if the specified position is a boundary position.
As a side effect, leaves the iterator pointing to the first boundary position at or after "offset".
Set the iterator position to the index immediately beyond the last character in the text being scanned.
This is not the same as the last character.
Advance the iterator to the boundary following the current boundary.
Open a new UBreakIterator for locating text boundaries for a specified locale.
A UBreakIterator may be used for detecting character, line, word, and sentence breaks in text.
Open a new UBreakIterator for locating text boundaries using precompiled binary rules.
Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not compatible across different major versions of ICU, nor across platforms of different endianness or different base character set family (ASCII vs EBCDIC).
Open a new UBreakIterator for locating text boundaries using specified breaking rules.
The rule syntax is ... (TBD)
Set the iterator position to the first boundary preceding the specified offset.
The new position is always smaller than offset, or UBRK_DONE.
Set the iterator position to the boundary preceding the current boundary.
Set the subject text string upon which the break iterator is operating without changing any other aspect of the state.
The new and previous text strings must have the same content.
This function is intended for use in environments where ICU is operating on strings that may move around in memory. It provides a mechanism for notifying ICU that the string has been relocated, and providing a new UText to access the string in its new position.
Note that the break iterator never copies the underlying text of a string being processed, but always operates directly on the original text provided by the user. Refreshing simply drops the references to the old text and replaces them with references to the new.
Caution: this function is normally used only by very specialized system-level code. One example use case is with garbage collection that moves the text in memory.
Thread safe cloning operation.
Sets an existing iterator to point to a new piece of text.
The break iterator retains a pointer to the supplied text. The caller must not modify or delete the text while the BreakIterator retains the reference.
Sets an existing iterator to point to a new piece of text.
All index positions returned by break iterator functions are native indices from the UText. For example, when breaking UTF-8 encoded text, the break positions returned by ubrk_next, ubrk_previous, etc. will be UTF-8 string indices, not UTF-16 positions.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4