CJKCharacterStrategy#

class scikitplot.corpus.CJKCharacterStrategy(*, prefer_jieba=True)[source]#

Character-level segmentation for Han (Chinese logograph) script.

Each Han ideograph is its own token. Non-Han runs (Latin digits, punctuation) are kept as whitespace-split words.

Optional jieba / pkuseg word segmentation is attempted when config.unit == "word" and the library is available.

Parameters:
prefer_jiebabool, optional

Attempt jieba segmentation for word-level chunks. Default True.

Parameters:

prefer_jieba (bool)

segment(span, config)[source]#

Segment Han span at character or word level.

Parameters:
spanScriptSpan

Han script span.

configWritingSystemAdapterConfig

Adapter configuration.

Returns:
list[Chunk]

Character or jieba-word chunks.

Parameters:
Return type:

list[Chunk]