ckipnlp.pipeline.coref module¶
This module provides coreference resolution pipeline.
-
class
ckipnlp.pipeline.coref.
CkipCorefDocument
(*, ws=None, pos=None, conparse=None, coref=None)[source]¶ Bases:
collections.abc.Mapping
The coreference document.
- Variables
ws (
SegParagraph
) – The word-segmented sentences.pos (
SegParagraph
) – The part-of-speech sentences.conparse (
ParseParagraph
) – The constituency sentences.coref (
CorefParagraph
) – The coreference resolution results.
-
class
ckipnlp.pipeline.coref.
CkipCorefPipeline
(*, coref_chunker='default', lazy=True, opts={}, **kwargs)[source]¶ Bases:
ckipnlp.pipeline.kernel.CkipPipeline
The coreference resolution pipeline.
- Parameters
sentence_segmenter (str) – The type of sentence segmenter.
word_segmenter (str) – The type of word segmenter.
pos_tagger (str) – The type of part-of-speech tagger.
ner_chunker (str) – The type of named-entity recognition chunker.
con_parser (str) – The type of constituency parser.
coref_chunker (str) – The type of coreference resolution chunker.
- Other Parameters
lazy (bool) – Lazy initialize the drivers.
opts (Dict[str, Dict]) – The driver options. Key: driver name (e.g. ‘sentence_segmenter’); Value: a dictionary of options.
-
__call__
(doc)[source]¶ Apply coreference delectation.
- Parameters
doc (
CkipDocument
) – The input document.- Returns
corefdoc (
CkipCorefDocument
) – The coreference document.
Note
doc is also modified if necessary dependencies (ws, pos, ner) is not computed yet.
-
get_coref
(doc, corefdoc)[source]¶ Apply coreference delectation.
- Parameters
doc (
CkipDocument
) – The input document.corefdoc (
CkipCorefDocument
) – The input document for coreference.
- Returns
corefdoc.coref (
CorefParagraph
) – The coreference results.
Note
This routine modify corefdoc inplace.
doc is also modified if necessary dependencies (ws, pos, ner) is not computed yet.