kyoto_reader.coreference module¶
-
class
kyoto_reader.coreference.
Entity
(eid: int, exophor: Optional[str] = None)[source]¶ Bases:
object
A class to represent an entity in coreference. This class manages entity IDs of mentions that refer to this entity.
Parameters: - eid (int) – An Entity ID.
- exophor (str, optional) – The kind of exophor if this entity corresponds to some exophor. Otherwise, None.
-
eid
¶ An Entity ID.
Type: int
-
exophor
¶ A string to represent exophor, such as “著者”, “読者”, and “不特定:人”.
Type: str, optional
-
taigen
¶ Whether this entity is 体言 or not.
Type: bool, optional
-
yougen
¶ Whether this entity is 用言 or not.
Type: bool, optional
-
__init__
(eid: int, exophor: Optional[str] = None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
add_mention
(mention: kyoto_reader.coreference.Mention, uncertain: bool) → None[source]¶ Add a mention that refers to this entity.
When a non-uncertain mention is added and the mention has already been registered as an uncertain mention, it will be overwritten as non-uncertain.
Parameters: - mention (Mention) – A mention
- uncertain (bool) – Whether the mention is uncertain (i.e., annotated with “≒”).
-
all_mentions
¶ All mentions that refer to this entity, including uncertain ones.
-
is_special
¶ Whether this entity corresponds to special entity, such as exophor.
-
class
kyoto_reader.coreference.
Mention
(bp: kyoto_reader.base_phrase.BasePhrase)[source]¶ Bases:
kyoto_reader.base_phrase.BasePhrase
A class to represent a mention in coreference.
Parameters: bp (BasePhrase) – A base phrase object that corresponds to this mention. -
eids
¶ Entity IDs.
Type: set
-
eids_unc
¶ Uncertain entity IDs. “Uncertain” means the mention is annotated with “≒”.
Type: set
-
__init__
(bp: kyoto_reader.base_phrase.BasePhrase)[source]¶ Args: tag (Tag): Tag object in pyknp. dmid_offset (int): Document-wide morpheme ID of the previous morpheme. dtid (int): Document-wide tag ID. sid (str): Sentence ID. doc_id (str): Document ID. parent (Optional[BasePhrase]): Dependency parent. children (List[BasePhrase]): Dependency children.
-
all_eids
¶ All entity IDs this mention refers to.
-