ckipnlp.util.ini module¶
-
ckipnlp.util.ini.
create_ws_lex
(*lex_list)[source]¶ Generate CKIP word segmentation lexicon file.
- Parameters
*lex_list (Tuple[str, str]) – the lexicon word and its POS-tag.
- Returns
lex_file (str) – the name of the lexicon file.
f_lex (TextIO) – the file object.
Attention
Remember to close f_lex manually.
-
ckipnlp.util.ini.
create_ws_ini
(*, data2_dir=None, lex_file=None, new_style_format=False, show_category=True, sentence_max_word_num=80, **options)[source]¶ Generate CKIP word segmentation config.
- Parameters
data2_dir (str) – the path to the folder “Data2/”.
lex_file (str) – the path to the user-defined lexicon file.
new_style_format (bool) – split sentences by newline characters (“\n”) rather than punctuations.
show_category (bool) – show part-of-speech tags.
sentence_max_word_num (int) – maximum number of words per sentence.
- Returns
ini_file (str) – the name of the config file.
f_ini (TextIO) – the file object.
Attention
Remember to close f_ini manually.
-
ckipnlp.util.ini.
create_parser_ini
(*, ws_ini_file, rule_dir=None, rdb_dir=None, do_ws=True, do_parse=True, do_role=True, sentence_delim=',, ;。!?', **options)[source]¶ Generate CKIP parser config.
- Parameters
rule_dir (str) – the path to “Rule/”.
rdb_dir (str) – the path to “RDB/”.
do_ws (bool) – do word-segmentation.
do_parse (bool) – do parsing.
do_role (bool) – do role.
sentence_delim (str) – the sentence delimiters.
- Returns
ini_file (str) – the name of the config file.
f_ini (TextIO) – the file object.
Attention
Remember to close f_ini manually.