Compile-time helpers for building Snowball grouping bit-tables.
A grouping in canonical Snowball is a set of codepoints. Generated
code emits these as compact bit-tables for O(1) membership testing.
This module produces the {min_codepoint, bits, max_codepoint}
tuple consumed by Snowball.Runtime.in_grouping/2 and friends.
Generated stemmer modules call from_string/1 or from_codepoints/1
inside a module attribute so the table is computed at compile time.
Summary
Functions
Build a grouping table from a list of codepoints.
Build a grouping table from a UTF-8 string whose codepoints are the members of the group.
Functions
Build a grouping table from a list of codepoints.
Arguments
codepointsis a list of integers.
Returns
- A
{min_cp, bits, max_cp}tuple.
Examples
iex> {97, _bits, 99} = Snowball.Grouping.from_codepoints([?a, ?b, ?c])
Build a grouping table from a UTF-8 string whose codepoints are the members of the group.
Arguments
stringis a UTF-8 binary listing each member codepoint.
Returns
- A
{min_cp, bits, max_cp}tuple suitable for the runtime grouping primitives.
Examples
iex> {97, _bits, 117} = Snowball.Grouping.from_string("aeiou")