ckipnlp.ws package

class ckipnlp.ws.CkipWs(*, logger=False, inifile=None, **options)[source]

Bases: object

The CKIP word segmentation driver.

Parameters:
apply(text)[source]

Segment a sentence.

Parameters:text (str) – the input sentence.
Returns:str – the output sentence.

Notes

One may also call this method as __call__().

apply_list(ilist)[source]

Segment a list of sentences.

Parameters:ilist (list) – the list of input sentences (str).
Returns:olist (list) – the list of output sentences (str).
apply_file(ifile, ofile, uwfile='')[source]

Segment a file.

Parameters:
  • ifile (str) – the input file.
  • ofile (str) – the output file (will be overwritten).
  • uwfile (str) – the unknown word file (will be overwritten).