Package cjklib :: Module build :: Class CharacterRadicalStrokeCountBuilder :: Class CharacterRadicalStrokeCountGenerator
[hide private]
[frames] | no frames]

Class CharacterRadicalStrokeCountGenerator

source code

Generates the character to radical/residual stroke count mapping.

Instance Methods [hide private]
 
__init__(self, dbConnectInst, characterSet, quiet=False)
Initialises the CharacterRadicalStrokeCountGenerator.
source code
int
getFormRadicalIndex(self, form)
Returns the Kangxi radical index for the given component.
source code
set of dict
filterForms(self, formSet)
Filters the set of given radical form entries to return only one single occurrence of a radical.
source code
list
getEntries(self, char, zVariant, strokeCountDict, decompositionDict, entriesDict)
Gets all radical/residual stroke count combinations from the given decomposition.
source code
 
generator(self)
Provides the radical/stroke count entries.
source code
Method Details [hide private]

__init__(self, dbConnectInst, characterSet, quiet=False)
(Constructor)

source code 

Initialises the CharacterRadicalStrokeCountGenerator.

Parameters:
  • dbConnectInst (instance) - instance of a DatabaseConnector
  • characterSet (set) - set of characters to generate the table for
  • quiet (bool) - if true no status information will be printed to stderr

getFormRadicalIndex(self, form)

source code 

Returns the Kangxi radical index for the given component.

Parameters:
  • form (str) - component
Returns: int
radical index of the given radical form.

filterForms(self, formSet)

source code 

Filters the set of given radical form entries to return only one single occurrence of a radical.

Parameters:
  • formSet (set of dict) - radical/residual stroke count entries as generated by getEntries().
Returns: set of dict
subset of input

To Do (Lang): On multiple occurrences of same radical (may be in different forms): Which one to choose? Implement to turn down unwanted forms.

getEntries(self, char, zVariant, strokeCountDict, decompositionDict, entriesDict)

source code 

Gets all radical/residual stroke count combinations from the given decomposition.

Returns: list
all radical/residual stroke count combinations for the character
Raises:
  • ValueError - if IDS is malformed or ambiguous residual stroke count is calculated

To Do (Fix): Remove validity check, only needed as long decomposition entries aren't checked against stroke order entries.