stri_count_boundaries {stringi} | R Documentation |
This function determines the number of specific text boundaries (like character, word, line, or sentence boundaries) in a string.
stri_count_boundaries(str, ..., opts_brkiter = NULL) stri_count_words(str, locale = NULL)
str |
character vector or an object coercible to |
... |
additional settings for |
opts_brkiter |
a named list with ICU BreakIterator's settings
as generated with |
locale |
|
Vectorized over str
.
For more information on the text boundary analysis
performed by ICU's BreakIterator
, see
stringi-search-boundaries.
In case of stri_count_words
,
just like in stri_extract_all_words
and
stri_locate_all_words
,
ICU's word BreakIterator
iterator is used
to locate word boundaries, and all non-word characters
(UBRK_WORD_NONE
rule status) are ignored.
This is function is equivalent to a call to
stri_count_boundaries(str, type="word", skip_word_none=TRUE, locale=locale)
Note that a BreakIterator
of type character
may be used to count the number of Unicode characters in a string.
This may lead to different results than that returned by the
stri_length
function, which is designed to return
the number of Unicode code points.
On the other hand, a BreakIterator
of type sentence
may be used to count the number of sentences in a piece of text.
Both functions return an integer vector.
Other locale_sensitive: %s!==%
,
%s!=%
, %s<=%
,
%s<%
, %s===%
,
%s==%
, %s>=%
,
%s>%
, %stri!==%
,
%stri!=%
, %stri<=%
,
%stri<%
, %stri===%
,
%stri==%
, %stri>=%
,
%stri>%
; stri_cmp
,
stri_cmp_eq
, stri_cmp_equiv
,
stri_cmp_ge
, stri_cmp_gt
,
stri_cmp_le
, stri_cmp_lt
,
stri_cmp_neq
,
stri_cmp_nequiv
,
stri_compare
;
stri_duplicated
,
stri_duplicated_any
;
stri_enc_detect2
;
stri_extract_all_boundaries
,
stri_extract_all_words
,
stri_extract_first_boundaries
,
stri_extract_first_words
,
stri_extract_last_boundaries
,
stri_extract_last_words
;
stri_locate_all_boundaries
,
stri_locate_all_words
,
stri_locate_first_boundaries
,
stri_locate_first_words
,
stri_locate_last_boundaries
,
stri_locate_last_words
;
stri_opts_collator
;
stri_order
, stri_sort
;
stri_split_boundaries
;
stri_trans_tolower
,
stri_trans_totitle
,
stri_trans_toupper
;
stri_unique
; stri_wrap
;
stringi-locale
;
stringi-search-boundaries
;
stringi-search-coll
Other search_count: stri_count
,
stri_count_charclass
,
stri_count_coll
,
stri_count_fixed
,
stri_count_regex
;
stringi-search
Other text_boundaries: stri_extract_all_boundaries
,
stri_extract_all_words
,
stri_extract_first_boundaries
,
stri_extract_first_words
,
stri_extract_last_boundaries
,
stri_extract_last_words
;
stri_locate_all_boundaries
,
stri_locate_all_words
,
stri_locate_first_boundaries
,
stri_locate_first_words
,
stri_locate_last_boundaries
,
stri_locate_last_words
;
stri_opts_brkiter
;
stri_split_boundaries
;
stri_split_lines
,
stri_split_lines1
,
stri_split_lines1
;
stri_trans_tolower
,
stri_trans_totitle
,
stri_trans_toupper
;
stri_wrap
;
stringi-search-boundaries
;
stringi-search
test <- "The\u00a0above-mentioned features are very useful. Warm thanks to their developers." stri_count_boundaries(test, type="word") stri_count_boundaries(test, type="sentence") stri_count_boundaries(test, type="character") stri_count_words(test) test2 <- stri_trans_nfkd("\u03c0\u0153\u0119\u00a9\u00df\u2190\u2193\u2192") stri_count_boundaries(test2, type="character") stri_length(test2) stri_numbytes(test2)