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

Class UnihanGenerator

source code

Regular expression matching one entry in the Unihan database (e.g. U+8682 kMandarin MA3 MA1 MA4).

Instance Methods [hide private]
 
__init__(self, fileName, useKeys=None, quiet=False)
Constructs the UnihanGenerator.
source code
 
generator(self)
Iterates over the Unihan entries.
source code
file
getHandle(self)
Returns a handle of the Unihan database file.
source code
list
keys(self)
Returns all keys read for the Unihan table.
source code
Class Variables [hide private]
  keySet = None
Set of keys of the Unihan table.
Method Details [hide private]

__init__(self, fileName, useKeys=None, quiet=False)
(Constructor)

source code 

Constructs the UnihanGenerator.

Parameters:
  • fileName (str) - path to the Unihan database file
  • useKeys (list) - if given only these keys will be read from the table, otherwise all keys will be returned
  • quiet (bool) - if true no status information will be printed to stderr

generator(self)

source code 

Iterates over the Unihan entries.

The character definition is converted to the character's representation, all other data is given as is. These are merged into one entry for each character.

getHandle(self)

source code 

Returns a handle of the Unihan database file.

Returns: file
file handle of the Unihan file

keys(self)

source code 

Returns all keys read for the Unihan table.

If the whole table is read a seek through the file is needed first to find all keys, otherwise the predefined set is returned.

Returns: list
list of column names