fromgroupdocs.search.dictionariesimportCharacterType# Get character type by Unicode code pointtype1=alphabet.get_character_type(0x1D400)print(type1.name)# Get character type by string charactertype2=alphabet.get_character_type("\U0001D41A")print(type2.name)# Example with hyphenhyphen_type=alphabet.get_character_type("-")print(hyphen_type.name)ifhyphen_type!=CharacterType.BLENDED:alphabet.set_range(["-"],CharacterType.BLENDED)
get_character_type
Gets the type of a Unicode code point.
defget_character_type(self,code_point):...
Parameter
Type
Description
code_point
int
The Unicode code point to get a type.
Returns: The type of the Unicode code point.
Example
# Assume `alphabet` is an instance of Alphabetprint("The type of U+1D400:",alphabet.get_character_type(0x1D400).name)print("The type of U+1D41A:",alphabet.get_character_type("\U0001D41A").name)
get_character_type
Gets the type of a character.
This method can be used to obtain the type of a surrogate pair.
defget_character_type(self,character):...
Parameter
Type
Description
character
str
The character or surrogate pair to get a type.
Returns: The type of the character.
Example
# Assume `alphabet` is an instance of `Alphabet`print("The type of U+1D400:",alphabet.get_character_type(0x1D400).name)print("The type of U+1D41A:",alphabet.get_character_type("\U0001D41A").name)# Getting the type of a hyphen characterhyphen_type=alphabet.get_character_type("-")print("The type of hyphen:",hyphen_type.name)
Aliases
These names call get_character_type too, limited to the overloads listed.