char_types#

pylibcudf.strings.char_types.StringCharacterTypes#

See also string_character_types.

Enum members

  • DECIMAL

  • NUMERIC

  • DIGIT

  • ALPHA

  • SPACE

  • UPPER

  • LOWER

  • ALPHANUM

  • CASE_TYPES

  • ALL_TYPES

pylibcudf.strings.char_types.all_characters_of_type(
Column source_strings,
string_character_types types,
string_character_types verify_types,
stream: CudaStreamLike | None = None,
DeviceMemoryResource mr=None,
) → Column#

Identifies strings where all characters match the specified type.

Parameters:
source_stringsColumn

Strings instance for this operation

typesStringCharacterTypes

The character types to check in each string

verify_typesStringCharacterTypes

Only verify against these character types.

streamStream | None

CUDA stream on which to perform the operation.

Returns:
Column

New column of boolean results for each string

pylibcudf.strings.char_types.filter_characters_of_type(
Column source_strings,
string_character_types types_to_remove,
Scalar replacement,
string_character_types types_to_keep,
stream: CudaStreamLike | None = None,
DeviceMemoryResource mr=None,
) → Column#

Filter specific character types from a column of strings.

Parameters:
source_stringsColumn

Strings instance for this operation

types_to_removeStringCharacterTypes

The character types to check in each string.

replacementScalar

The replacement character to use when removing characters

types_to_keepStringCharacterTypes

Default ALL_TYPES means all characters of types_to_remove will be filtered.

streamStream | None

CUDA stream on which to perform the operation.

Returns:
Column

New column with the specified characters filtered out and replaced with the specified replacement string.

pylibcudf.strings.char_types.get_character_cases_table(stream: CudaStreamLike | None = None)#

Return a device pointer to the character-cases lookup table.

The table maps a code point (indexed 0..0xFFFF) to its upper/lower-case counterpart and backs case conversion. The table is lazily copied to the device on first use and remains valid for the process lifetime.

Parameters:
streamStream | None

CUDA stream on which to perform the (first-use) device copy.

Returns:
int

The device address of the uint16 cases table.

pylibcudf.strings.char_types.get_character_flags_table_ptr(stream: CudaStreamLike | None = None)#

Return a device pointer to the character-flags lookup table.

The table maps a code point (indexed 0..0xFFFF) to a bitmask of StringCharacterTypes flags, and backs the character-class checks used by all_characters_of_type(). The table is lazily copied to the device on first use and remains valid for the process lifetime.

Parameters:
streamStream | None

CUDA stream on which to perform the (first-use) device copy.

Returns:
int

The device address of the uint8 flags table.

pylibcudf.strings.char_types.get_special_case_mapping_table(stream: CudaStreamLike | None = None)#

Return a device pointer to the special-case mapping table.

The table handles characters whose case conversion does not fit the cases table (one code point mapping to several). The table is lazily copied to the device on first use and remains valid for the process lifetime.

Parameters:
streamStream | None

CUDA stream on which to perform the (first-use) device copy.

Returns:
int

The device address of the special-case mapping table.