Python unicodedata library is_normalized unidata_version and ucd_3_2_0














































Python unicodedata library is_normalized unidata_version and ucd_3_2_0



Python Unicode data:
The 'unicodedata' library in python is helpful in defining the properties for all the unicode characters available in the Unicode database. This library accesses the Unicode Character Database (UCD) for defining the characters.
UCD file link: https://www.unicode.org/Public/9.0.0/ucd/UnicodeData.txt

The next function defined here is:
1. unicodedata.is_normalized(form, unistr)

unicodedata Library provides some attributes and objects also:
1. unicodedata.unidata_version
2. unicodedata.ucd_3_2_0

Let us discuss about these in detail.

unicodedata.is_normalized(form, unistr):
As explained in the previous article, Unicode Normalization helps to solve the compatibility and canonical equivalences.
As stated before, in both, decompositions and compositions, they have 2 types of conversions each:
Decomposition:
1. NFD- Canonical Decomposition
2. NFKD- Compatibility Decomposition
Composition:
1. NFC- Canonical Decomposition followed by Canonical Composition
2. NFKC-Compatibility Decomposition followed by Canonical Composition
While unicodedata.normalize(form unistr) function helps to normalize the string 'unistr' to the stated form 'form' given as the argument to it, unicodedata.is_normalized(from, unistr) tells us whether the string 'unistr' is in the stated normal form or not.
The first parameter 'form' can take the values: 'NFD', 'NFC', 'NFKD', 'NFKC'.
The second parameter takes the string which needs to be checked if it is in the normal from or not.
The function returns 'True' or 'False' depending upon the answer.

EXAMPLE-1:



EXAMPLE-2:


Module Attributes and Objects:

1. unicodedata.unidata_version

This is an attribute in unicodedata library that has the version of the Unicode Database used in the module.



2. unicodedata.ucd_3_2_0

This is an object in unicodedata library that has the same functions and methods as the entire view, but uses the Unicode database version 3.2 instead, for applications that require this specific version of Unicode Database(such as IDNA)
This provides ucd3.2 object mode access in order to be compatible with the old IDNA Applications






More Articles of Arkaja Sharan:

Name Views Likes
Python codecs Library Error Handling schemes module functions 96 0
Python codecs Library Error Handler register_error and lookup_error functions 92 0
Python codecs Library Error Handlers 96 0
Python codecs Library open and EncodedFile functions 83 0
Python codecs Library iterencode and iterdecode functions 108 0
Python codecs Library register and unregister functions 80 0
Python codecs Library getreader and getwriter functions 92 0
Python codecs Library getincrementalencoder and getincrementaldecoder 75 0
Python codecs Library getencoder and getdecoder functions 86 0
Python Introduction to codecs Library 111 0
Python fcntl Library flock and lockf functions 95 0
Python fcntl Library fcntl and ioctl functions 113 0
Python Resource Library resource usage functions 103 0
Python Resource Library resource usage symbolic constants 84 0
Python Resource Library Resource Limit Functions 99 0
Python resource library resource limit symbolic constants 97 0
Python Introduction to Resource Library 82 0
Python stringprep Library in_table_d1 and in_table_d2 functions 88 0
Python stringprep Library in_table_c8 and in_table_c9 functions 92 0
Python stringprep Library in_table_c5 in_table_c6 and in_table_c7 functions 81 0
Python stringprep Library in_table_c3 and in_table_c4 functions 88 0
Python stringprep library in_table_c21 in_table_c22 and in_table_c21_c22 90 0
Python stringprep library functions in_table_c11 in_table_c12 and in_table_c11_c12 89 0
Python Introduction to stringprep Library 94 0
Python unicodedata library is_normalized unidata_version and ucd_3_2_0 86 0
Python Unicodedata Library functions normalize and decomposition 149 0
Python Unicodedata Library functions east_asian_width and mirrored 94 1
Python Unicodedata Library category bidirectional and combining functions 133 0
Introduction to Unicodedata library lookup and name functions 88 0
Unicode Library decimal digit and numeric functions 91 0
Introduction to Unicode Data library 0 0

Comments