ckipnlp.pipeline.coref module¶
This module provides coreference resolution pipeline.
-
class
ckipnlp.pipeline.coref.
CkipCorefDocument
(*, ws=None, pos=None, parsed=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.parsed (
ParsedParagraph
) – The parsed sentences.coref (
CorefParagraph
) – The coreference resolution results.
-
class
ckipnlp.pipeline.coref.
CkipCorefPipeline
(*, coref_chunker=<DriverFamily.BUILTIN: 1>, lazy=True, opts={}, **kwargs)[source]¶ Bases:
ckipnlp.pipeline.core.CkipPipeline
The coreference resolution pipeline.
- Parameters
sentence_segmenter (
DriverFamily
) – The type of sentence segmenter.word_segmenter (
DriverFamily
) – The type of word segmenter.pos_tagger (
DriverFamily
) – The type of part-of-speech tagger.ner_chunker (
DriverFamily
) – The type of named-entity recognition chunker.sentence_parser (
DriverFamily
) – The type of sentence parser.coref_chunker (
DriverFamily
) – 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.