UNIHAN - cihai.data.unihan¶
Bootstrapping¶
Fetch + extract + transform + load UNIHAN dataset to Cihai.
-
cihai.data.unihan.bootstrap.bootstrap_unihan(engine, metadata, options=None)¶
UNIHAN bootstrap script (download from web, import to database).
-
cihai.data.unihan.bootstrap.is_bootstrapped(metadata)¶
Return True if cihai is correctly bootstrapped.
-
cihai.data.unihan.bootstrap.create_unihan_table(columns, metadata)¶
Create table and return
sqlalchemy.sql.schema.Table.- Parameters:
columns (list) – columns for table, e.g.
['kDefinition', 'kCantonese']metadata (
sqlalchemy.schema.MetaData) – Instance of sqlalchemy metadata
- Returns:
Newly created table with columns and index.
- Return type:
-
class cihai.data.unihan.dataset.Unihan¶
Bases:
Dataset,SQLAlchemyMixinUNIHAN Dataset for cihai.
Constants for UNIHAN cihai dataset.
-
cihai.data.unihan.constants.UNIHAN_FIELDS: list[str] = ['kAccountingNumeric', 'kCangjie', 'kCantonese', 'kCheungBauer', 'kCihaiT', 'kCompatibilityVariant', 'kDefinition', 'kFenn', 'kFourCornerCode', 'kGradeLevel', 'kHDZRadBreak', 'kHKGlyph', 'kHangul', 'kHanyuPinlu', 'kHanyuPinyin', 'kJapaneseKun', 'kJapaneseOn', 'kKorean', 'kMandarin', 'kOtherNumeric', 'kPhonetic', 'kPrimaryNumeric', 'kRSAdobe_Japan1_6', 'kRSUnicode', 'kSemanticVariant', 'kSimplifiedVariant', 'kSpecializedSemanticVariant', 'kTang', 'kTotalStrokes', 'kTraditionalVariant', 'kVietnamese', 'kXHC1983', 'kZVariant']¶
Mapping of field names from unihan-etl (UNIHAN database)
-
cihai.data.unihan.constants.UNIHAN_ETL_DEFAULT_OPTIONS = {'expand': False, 'fields': ['kAccountingNumeric', 'kCangjie', 'kCantonese', 'kCheungBauer', 'kCihaiT', 'kCompatibilityVariant', 'kDefinition', 'kFenn', 'kFourCornerCode', 'kGradeLevel', 'kHDZRadBreak', 'kHKGlyph', 'kHangul', 'kHanyuPinlu', 'kHanyuPinyin', 'kJapaneseKun', 'kJapaneseOn', 'kKorean', 'kMandarin', 'kOtherNumeric', 'kPhonetic', 'kPrimaryNumeric', 'kRSAdobe_Japan1_6', 'kRSUnicode', 'kSemanticVariant', 'kSimplifiedVariant', 'kSpecializedSemanticVariant', 'kTang', 'kTotalStrokes', 'kTraditionalVariant', 'kVietnamese', 'kXHC1983', 'kZVariant'], 'format': 'python', 'input_files': ['Unihan_DictionaryLikeData.txt', 'Unihan_IRGSources.txt', 'Unihan_NumericValues.txt', 'Unihan_RadicalStrokeCounts.txt', 'Unihan_Readings.txt', 'Unihan_Variants.txt']}¶
Default settings passed to unihan-etl
Variants plugin¶
-
class cihai.data.unihan.dataset.UnihanVariants¶
Bases:
DatasetPlugin,SQLAlchemyMixinSupport for CJK Variant lookups through UNIHAN dataset.