Command line interface (CLI) to the library’s functionality.
Check what this script offers on the command line with cjknife -h.
The script’s output depends on the following:
dictionary setting in the cjklib’s config file
character locale and the default input and output readings
See also
Gets a fixed width string representation of the given decomposition.
Parameter: | decomposition (list) – character decomposition tree |
---|---|
Return type: | list of str |
Returns: | string representation of decomposition |
Gets a fixed width string representation of the given decompositions.
Parameter: | decompositionList (list) – a list of character decompositions |
---|---|
Return type: | list of str |
Returns: | string representation of decomposition |
Gets a printable representation for the given list.
Parameters: |
|
---|---|
Return type: | str |
Returns: | printable representation for the given list |
Provides lookup method services.
Initialises the CharacterInfo object.
Parameters: |
|
---|
Converts a string in the source reading to the given target reading.
Parameters: |
|
---|---|
Return type: | str |
Returns: | the input string converted to the toReading |
Raises DecompositionError: | |
if the string can not be decomposed into basic entities with regards to the source reading or the given information is insufficient. |
|
Raises CompositionError: | |
if the target reading’s entities can not be composed. |
|
Raises ConversionError: | |
on operations specific to the conversion between the two readings (e.g. error on converting entities). |
|
Raises UnsupportedError: | |
if source or target reading is not supported for conversion. |
Todo
Gets a list of available dictionaries supported.
Return type: | list of str |
---|---|
Returns: | names of available dictionaries |
Get the basic information for the given character.
Parameter: | char (str) – Chinese character |
---|---|
Return type: | dict |
Returns: | character information as keyword value pairs |
Gets all characters that contain the given components.
If option includeEquivalentRadicalForms is set, all equivalent forms will be searched for when a Kangxi radical is given.
Parameters: |
|
---|---|
Return type: | list of tuple |
Returns: | list of pairs of matching characters and their glyphs |
Raises ValueError: | |
if an invalid character locale is specified |
Todo
Gets all characters for the given Kangxi radical index grouped by their residual stroke count.
Parameter: | radicalIndex (int) – Kangxi radical index |
---|---|
Return type: | list of str |
Returns: | list of matching Chinese characters |
Gets all know characters for the given reading.
Parameters: |
|
---|---|
Return type: | list of str |
Returns: | list of characters for the given reading |
Raises UnsupportedError: | |
if no mapping between characters and target reading exists. |
|
Raises ConversionError: | |
if conversion from the internal source reading to the given target reading fails. |
Gets a list structure of equivalent chars for the given list of characters.
If option includeEquivalentRadicalForms is set, all equivalent forms will be searched for when a Kangxi radical is given.
Parameters: |
|
---|---|
Return type: | list of list of str |
Returns: | list structure of equivalent characters |
Todo
Gets a list of readings for a given character string.
Parameter: | charList (list) – list of Chinese characters |
---|---|
Return type: | list of list of str |
Returns: | a list of readings per character |
Raises exception.UnsupportedError: | |
raised when a translation from character to reading is not supported by the given target reading | |
Raises exception.ConversionError: | |
if conversion for the string is not supported |
Guesses the reading options using the given string to support reading dialects.
Parameters: |
|
---|---|
Return type: | dict |
Returns: | reading options |
Gets the Chinese simplified character representation for the given character string.
Parameter: | charList (list) – list of Chinese characters |
---|---|
Return type: | list of list of str |
Returns: | list of simplified Chinese characters |
Gets the traditional character representation for the given character string.
Parameter: | charList (list) – list of Chinese characters |
---|---|
Return type: | list of list of str |
Returns: | list of simplified Chinese characters |
Todo
Guesses the best suited character locale using the user’s locale settings.
Return type: | str |
---|---|
Returns: | locale |
Guesses the best suited reading using the user’s locale settings.
Return type: | str |
---|---|
Returns: | reading name |
Checks if the character is a semantic variant form of the given characters.
Parameters: |
|
---|---|
Return type: | bool |
Returns: | True if the character is a semantic variant form of the given characters, False otherwise. |
Searches the dictionary for matches of the given string.
Parameters: |
|
---|