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

Class UnihanBuilder

source code


Builds the Unihan database from the Unihan file provided by Unicode.

Nested Classes [hide private]
  EntryGenerator
Generates the entries of the Unihan table.
Instance Methods [hide private]
 
__init__(self, dataPath, dbConnectInst, quiet=False)
Constructs the TableBuilder.
source code
instance
getUnihanGenerator(self)
Returns the UnihanGenerator.
source code
 
getGenerator(self)
Returns the entry generator.
source code
 
build(self)
Build the table provided by the TableBuilder.
source code

Inherited from EntryGeneratorBuilder: getEntryDict, remove

Inherited from TableBuilder: buildIndexObjects, buildTableObject, findFile

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  PROVIDES = 'Unihan'
Contains the name of the table provided by this module.
  CHARACTER_COLUMN = 'ChineseCharacter'
Name of column for Chinese character key.
  COLUMN_TYPES = {'ChineseCharacter': String(length=1, convert_u...
Column types for created table
  unihanGenerator = None

Inherited from EntryGeneratorBuilder: COLUMNS, INDEX_KEYS, PRIMARY_KEYS

Inherited from TableBuilder: DEPENDS

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

Constructs the TableBuilder.

Parameters:
  • dataPath - optional list of paths to the data file(s)
  • dbConnectInst - instance of a DatabaseConnector. If not given all sql code will be printed to stdout.
  • quiet - if true no status information will be printed to stderr
Overrides: object.__init__
(inherited documentation)

getUnihanGenerator(self)

source code 

Returns the UnihanGenerator. Constructs it if needed.

Returns: instance
instance of a UnihanGenerator

getGenerator(self)

source code 

Returns the entry generator. Needs to be implemented by child classes.

Overrides: EntryGeneratorBuilder.getGenerator
(inherited documentation)

build(self)

source code 

Build the table provided by the TableBuilder.

Methods should raise an IOError if reading a data source fails. The DatabaseBuilder knows how to handle this case and is able to proceed.

Overrides: TableBuilder.build
(inherited documentation)

Class Variable Details [hide private]

COLUMN_TYPES

Column types for created table

Value:
{'ChineseCharacter': String(length=1, convert_unicode=False, assert_un\
icode=None),
 'kCantonese': Text(length=None, convert_unicode=False, assert_unicode\
=None),
 'kFrequency': Integer(),
 'kHangul': Text(length=None, convert_unicode=False, assert_unicode=No\
ne),
 'kHanyuPinlu': Text(length=None, convert_unicode=False, assert_unicod\
...