Expand description
Word collection and prefix matching for autocomplete.
Functions§
- char_
to_ byte - Converts the character index
char_indexinto a byte offset intotext, returning the text length when the index is past the end. - collect_
words - Collects the unique words of
text(length ≥ 3) with their occurrence count, sorted by count descending and then alphabetically. - current_
prefix - Returns the run of word characters ending immediately before
cursor, wherecursoris a character index intotext. - current_
word - Returns the character-index range of the word containing
cursor, scanning both backward and forward from it withis_word_char. - is_
word_ char - Returns whether
charactercounts as part of a word (alphanumeric or_). - matches
- Returns the words starting with
prefixand their occurrence count.