Core - cihai.core

Cihai core functionality.

exception cihai.core.CihaiConfigError
exception[source]

Bases: CihaiException

Cihai Configuration error.

cihai.core.is_valid_config(config)
function[source]

Upcast cihai configuration.

NOTE: This does not validate configuration yet!

Parameters:

config (UntypedDict)

Return type:

TypeGuard[ConfigDict]

class cihai.core.Cihai

Bases: object

Central application object.

By default, this automatically adds the UNIHAN dataset.

Notes

Inspired by the early pypa/warehouse application object.

Configuration templates

The config dict parameter supports a basic template system for replacing XDG Base Directory directory variables, tildes and environmentas variables. This is done by passing the option dict through cihai.config.expand_config() during initialization.

Examples

To use cihai programmatically, invoke and install the UNIHAN dataset — see Examples for a runnable walkthrough based on examples/basic_usage.py.

is_bootstrapped can check if the system has the database installed.