cogent3.core.alphabet.make_text_to_array_converter#
- make_text_to_array_converter(alphabet: CharAlphabet[Any], delete: bytes = b'\n\r\t 0123456789') bytes_to_array#
make a converter from text bytes to alphabet indices.
- Parameters:
- alphabet
the target character alphabet; must have at most 256 elements
- delete
bytes stripped from the input before mapping
Notes
The returned converter performs case folding, deletion, and char-to-index mapping in a single
bytes.translatecall. Indices are packed as single bytes in the translation table, which is whylen(alphabet)cannot exceed 256.