ckipnlp.driver.tagger module¶
This module provides drivers with CkipTagger backend.
- class ckipnlp.driver.tagger.CkipTaggerWordSegmenter(*, lazy=False, disable_cuda=True, recommend_lexicons={}, coerce_lexicons={}, **opts)[source]¶
Bases:
BaseDriver
The CKIP word segmentation driver with CkipTagger backend.
- Parameters
lazy (bool) – Lazy initialize the driver.
disable_cuda (bool) – Disable GPU usage.
recommend_lexicons (Mapping[str, float]) – A mapping of lexicon words to their relative weights.
coerce_lexicons (Mapping[str, float]) – A mapping of lexicon words to their relative weights.
**opts – Extra options for
ckiptagger.WS.__call__()
. (Please refer https://github.com/ckiplab/ckiptagger#4-run-the-ws-pos-ner-pipeline for details.)
- __call__(*, text)¶
Apply word segmentation.
- Parameters
text (
TextParagraph
) — The sentences.- Returns
ws (
TextParagraph
) — The word-segmented sentences.
- class ckipnlp.driver.tagger.CkipTaggerPosTagger(*, lazy=False, disable_cuda=True, **opts)[source]¶
Bases:
BaseDriver
The CKIP part-of-speech tagging driver with CkipTagger backend.
- Parameters
lazy (bool) – Lazy initialize the driver.
disable_cuda (bool) – Disable GPU usage.
**opts – Extra options for
ckiptagger.POS.__call__()
. (Please refer https://github.com/ckiplab/ckiptagger#4-run-the-ws-pos-ner-pipeline for details.)
- __call__(*, text)¶
Apply part-of-speech tagging.
- Parameters
ws (
TextParagraph
) — The word-segmented sentences.- Returns
pos (
TextParagraph
) — The part-of-speech sentences.
- class ckipnlp.driver.tagger.CkipTaggerNerChunker(*, lazy=False, disable_cuda=True, **opts)[source]¶
Bases:
BaseDriver
The CKIP named-entity recognition driver with CkipTagger backend.
- Parameters
lazy (bool) – Lazy initialize the driver.
disable_cuda (bool) – Disable GPU usage.
**opts – Extra options for
ckiptagger.NER.__call__()
. (Please refer https://github.com/ckiplab/ckiptagger#4-run-the-ws-pos-ner-pipeline for details.)
- __call__(*, text)¶
Apply named-entity recognition.
- Parameters
ws (
TextParagraph
) — The word-segmented sentences.pos (
TextParagraph
) — The part-of-speech sentences.
- Returns
ner (
NerParagraph
) — The named-entity recognition results.