ckipnlp.driver.classic module

This module provides drivers with CkipClassic backend.

class ckipnlp.driver.classic.CkipClassicWordSegmenter(*, lazy=False, do_pos=False, lexicons=None)[source]

Bases: ckipnlp.driver.base.BaseDriver

The CKIP word segmentation driver with CkipClassic backend.

Parameters
  • lazy (bool) – Lazy initialize the driver.

  • do_pos (bool) – Returns POS-tag or not

  • lexicons (Iterable[Tuple[str, str]]) – A list of the lexicon words and their POS-tags.

__call__(*, text)

Apply word segmentation.

Parameters

text (TextParagraph) — The sentences.

Returns
  • ws (TextParagraph) — The word-segmented sentences.

  • pos (TextParagraph) — The part-of-speech sentences. (returns if do_pos is set.)

class ckipnlp.driver.classic.CkipClassicConstituencyParser(*, lazy=False)[source]

Bases: ckipnlp.driver.base.BaseDriver

The CKIP sentence parsing driver with CkipClassic backend.

Parameters

lazy (bool) – Lazy initialize the driver.

__call__(*, ws, pos)

Apply sentence parsing.

Parameters
Returns

constituency (ParseSentence) — The constituency-parsing sentences.