cosmel.corpus.mention module¶
-
class
cosmel.corpus.mention.Mention(article, sid, mid, *args, gid='', nid='', rid='', rule='', **kwargs)[source]¶ Bases:
objectThe mention class.
Parameters: - article (
Article) – the article containing this mention. - sid (int) – the sentence index in the aritcle.
- mid (int) – the mention index in the sentence.
- gid (str) – the golden product ID.
- nid (str) – the network-predicted product ID.
- rid (str) – the rule-labeled product ID.
- rule (str) – the rule.
- idxs (slice) – the indix slice of this mention.
-
sentence_pre_(with_mention=True)[source]¶ WsWords: the words before this mention in the sentence (with/without mention itself).
-
sentence_post_(with_mention=True)[source]¶ WsWords: the words after this mention in the sentence (with/without mention itself).
-
bundle¶ the mention bundle containing this mention.
Type: MentionBundle
-
ids¶
-
attrs¶ The xml attributes.
-
json¶ Convert to json.
- article (
-
class
cosmel.corpus.mention.MentionSet(mention_bundles)[source]¶ Bases:
collections.abc.CollectionThe set of mentions.
- Item: mention (
Mention)
Parameters: mention_bundles ( MentionBundleSet) – the set of mention bundles.- Item: mention (
-
class
cosmel.corpus.mention.MentionBundle(file_path, article)[source]¶ Bases:
collections.abc.SequenceThe bundle of mentions in an article.
- Item: mention (
Mention)
Parameters: - Item: mention (
-
class
cosmel.corpus.mention.MentionBundleSet(mention_root, article_set)[source]¶ Bases:
collections.abc.CollectionThe set of mention bundles.
- Item: mention bundle (
MentionBundle)
Parameters: - article_root (str) – the path to the folder containing word segmented article files.
- mention_root (str) – the path to the folder containing mention files.
- article_set (
ArticleSet) – the set of articles.
- Item: mention bundle (
-
class
cosmel.corpus.mention.Id2Mention(mention_set)[source]¶ Bases:
collections.abc.MappingThe dictionary maps article ID, sentence ID, and mention ID to mention object.
- Key: the article ID, sentence ID, and mention ID (tuple).
- Item: the mention object (
Mention).
Parameters: mention_set ( MentionSet) – the mention set.
-
class
cosmel.corpus.mention.Id2MentionBundle(id_to_article)[source]¶ Bases:
collections.abc.MappingThe dictionary maps article ID to mention bundle.
- Key: the article ID (str).
- Item: the mention bundle (
MentionBundle).
Parameters: id_to_article ( Id2Article) – the dictionary maps article ID to article object.
-
class
cosmel.corpus.mention.Head2MentionList(mention_set)[source]¶ Bases:
collections.abc.MappingThe dictionary maps head word to mention object list.
- Key: mention head word (str).
- Item:
ReadOnlyListof mention object (Mention).
Parameters: mention_set ( MentionSet) – the mention set.