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

Class Kanjidic2Builder

source code


Builds the Kanjidic database from the Kanjidic2 XML file http://www.csse.monash.edu.au/~jwb/kanjidic2/.

Nested Classes [hide private]
  XMLHandler
Extracts a list of given tags.
  KanjidicGenerator
Generates the KANJIDIC table.
Instance Methods [hide private]
 
__init__(self, dataPath, dbConnectInst, quiet=False)
Constructs the TableBuilder.
source code
instance
getGenerator(self)
Returns the KanjidicGenerator.
source code

Inherited from EntryGeneratorBuilder: build, 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 = 'Kanjidic'
Contains the name of the table provided by this module.
  CHARACTER_COLUMN = 'ChineseCharacter'
Name of column for Chinese character key.
  COLUMN_TYPES = {'CharacterJapaneseKun': Text(length=None, conv...
Column types for created table
  KANJIDIC_TAG_MAPPING = {(('literal'), frozenset([])): ('Chines...
Dictionary of tag keys mapping to a table column including a function generating a string out of a list of entries given from the KANJIDIC entry.

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)

getGenerator(self)

source code 

Returns the KanjidicGenerator.

Returns: instance
instance of a KanjidicGenerator
Overrides: EntryGeneratorBuilder.getGenerator

Class Variable Details [hide private]

COLUMN_TYPES

Column types for created table

Value:
{'CharacterJapaneseKun': Text(length=None, convert_unicode=False, asse\
rt_unicode=None),
 'CharacterJapaneseOn': Text(length=None, convert_unicode=False, asser\
t_unicode=None),
 'ChineseCharacter': String(length=1, convert_unicode=False, assert_un\
icode=None),
 'NelsonRadical': Integer()}

KANJIDIC_TAG_MAPPING

Dictionary of tag keys mapping to a table column including a function generating a string out of a list of entries given from the KANJIDIC entry. The tag keys constist of a tuple giving the xml element hierarchy below the 'character' element and a set of attribute value pairs.

Value:
{(('literal'), frozenset([])): ('ChineseCharacter',
                                <function <lambda> at 0x9661454>),
 (('misc', 'rad_name'), frozenset([])): ('RadicalName',
                                         <function <lambda> at 0x96616\
f4>),
 (('radical', 'rad_value'), frozenset([('rad_type', 'nelson_n')])): ('\
NelsonNRadical',
                                                                     <\
...