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.BaseDriverThe 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.CkipClassicConParser(*, lazy=False)[source]¶ Bases:
ckipnlp.driver.classic._CkipClassicConParserThe CKIP constituency parsing driver with CkipClassic backend.
- Parameters
lazy (bool) – Lazy initialize the driver.
-
__call__(*, ws, pos)¶ Apply constituency parsing.
- Parameters
ws (
TextParagraph) — The word-segmented sentences.pos (
TextParagraph) — The part-of-speech sentences.
- Returns
conparse (
ParseSentence) — The constituency-parsing sentences.
-
class
ckipnlp.driver.classic.CkipClassicConParserClient(*, lazy=False)[source]¶ Bases:
ckipnlp.driver.classic._CkipClassicConParserThe CKIP constituency parsing driver with CkipClassic client backend.
- Parameters
lazy (bool) – Lazy initialize the driver.
Notes
Please register an account at http://parser.iis.sinica.edu.tw/v1/reg.exe and set the environment variables
$CKIPPARSER_USERNAMEand$CKIPPARSER_PASSWORD.-
__call__(*, ws, pos)¶ Apply constituency parsing.
- Parameters
ws (
TextParagraph) — The word-segmented sentences.pos (
TextParagraph) — The part-of-speech sentences.
- Returns
conparse (
ParseSentence) — The constituency-parsing sentences.