Package: unicategories
unicategoriesUnicode category database, generated and cached on setup.This module exposes a category dictionary containingRangeGroupinstances,
containing all unicode category character ranges detected on your system.Examplefromunicategoriesimportcategoriesupperchars=categories['Lu'].characters()# iteratorprint('Unicode uppercase caracters are "%s"'%''.join(upperchars))# Unicode uppercase caracters are "ABCDEF..."RangeGroupImmutable iterable (based on tuple, with some useful methods) of (start, end)
tuples being, like python'srange, open at the end.This method have been chosen for memory efficiency, storing individually all
characters on memory would take a lot of memory.RangeGroup class provides the following methods:range_group.characters()type: () -> typing.Iterator[str]Get iterator with all characters on this range group.:returns:iterator of characters (str of size 1)range_group.codes()type: () -> typing.Iterator[int]Get iterator for all unicode code points contained in this range group.:returns:iterator of character indexes (int)range_group.has(character)type: (typing.Union[str, int]) -> boolGet if character (or character code point) is part of this range group.:param character:character or unicode code point to look for:returns:True if character is contained by any range, False otherwiseUnicode categoriesTaken fromwikipedia.ValueCategory Major, minorBasic typeCharacter assignedFixedRemarksLuLetter, uppercaseGraphicCharacterLlLetter, lowercaseGraphicCharacterLtLetter, titlecaseGraphicCharacterLigatures containing uppercase followed by lowercase letters (e.g.,ǅ,ǈ,ǋ, andǲ)LmLetter, modifierGraphicCharacterLoLetter, otherGraphicCharacterMnMark, nonspacingGraphicCharacterMcMark, spacing combiningGraphicCharacterMeMark, enclosingGraphicCharacterNdNumber, decimal digitGraphicCharacterAll these, and only these, have Numeric Type = DeNlNumber, letterGraphicCharacterNumerals composed of letters or letterlike symbols (e.g., Roman numerals )NoNumber, otherGraphicCharacterE.g., vulgar fractions , superscript and subscript digitsPcPunctuation, connectorGraphicCharacterIncludes "_" underscorePdPunctuation, dashGraphicCharacterIncludes several hyphen charactersPsPunctuation, openGraphicCharacterOpening bracket charactersPePunctuation, closeGraphicCharacterClosing bracket charactersPiPunctuation, initial quoteGraphicCharacterOpening quotation mark . Does not include the ASCII "neutral" quotation mark. May behave like Ps or Pe depending on usagePfPunctuation, final quoteGraphicCharacterClosing quotation mark. May behave like Ps or Pe depending on usagePoPunctuation, otherGraphicCharacterSmSymbol, mathGraphicCharacterScSymbol, currencyGraphicCharacterSkSymbol, modifierGraphicCharacterSoSymbol, otherGraphicCharacterZsSeparator, spaceGraphicCharacterIncludes the space, but not TAB , CR , or LF , which are CcZlSeparator, lineFormatCharacterOnly U+2028 LINE SEPARATOR (LSEP)ZpSeparator, paragraphFormatCharacterOnly U+2029 PARAGRAPH SEPARATOR (PSEP)CcOther, controlControlCharacterFixed 65No name     ,<control>CfOther, formatFormatCharacterIncludes the soft hyphen , control characters to support bi-directional text , and language tag charactersCsOther, surrogateSurrogateNot (but abstract)Fixed 2,048No name     ,<surrogate>CoOther, private usePrivate-useNot (but abstract)Fixed 137,468 total: 6,400 in BMP , 131,068 in Planes 15–16No name     ,<private-use>CnOther, not assignedNoncharacterNotFixed 66No name     ,<noncharacter>CnOther, not assignedReservedNotNot fixedNo name     ,<reserved>In addition to that, unicategories provide general categoriesL,M,N,P,S,ZandC.