ckipnlp.container.seg module

This module provides containers for word-segmented sentences.

class ckipnlp.container.seg.SegSentence(initlist=None)[source]

Bases: ckipnlp.container.base.BaseSentence0

A word-segmented sentence.

Data Structure Examples

Text format

Used for from_text() and to_text().

'中文字 喔' # Words segmented by \u3000 (full-width space)
Dict/List format

Used for from_dict(), to_dict(), from_list(), and to_list().

[ '中文字', '喔', ]

Note

This class is also used for part-of-speech tagging.

item_class

alias of builtins.str

class ckipnlp.container.seg.SegParagraph(initlist=None)[source]

Bases: ckipnlp.container.base.BaseList

A list of word-segmented sentences.

Data Structure Examples

Text format

Used for from_text() and to_text().

[
    '中文字 喔',     # Sentence 1
    '啊 哈 哈 哈', # Sentence 2
]
Dict/List format

Used for from_dict(), to_dict(), from_list(), and to_list().

[
    [ '中文字', '喔', ],         # Sentence 1
    [ '啊', '哈', '哈', '哈', ], # Sentence 2
]

Note

This class is also used for part-of-speech tagging.

item_class

alias of SegSentence