entities.py
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from corneferencer.resolvers.vectors import get_mention_features
class Text:
def __init__(self, text_id):
self.__id = text_id
self.mentions = []
def get_mention_set(self, mnt_id):
for mnt in self.mentions:
if mnt.id == mnt_id:
return mnt.set
return None
class Mention:
def __init__(self, mnt_id, text, lemmatized_text, words, span,
head_orth, head_base, dominant, node, prec_context,
follow_context, sentence, position_in_mentions,
start_in_words, end_in_words):
self.id = mnt_id
self.set = ''
self.text = text
self.lemmatized_text = lemmatized_text
self.words = words
self.span = span
self.head_orth = head_orth
self.head_base = head_base
self.dominant = dominant
self.node = node
self.prec_context = prec_context
self.follow_context = follow_context
self.sentence = sentence
self.position_in_mentions = position_in_mentions
self.start_in_words = start_in_words
self.end_in_words = end_in_words
self.features = get_mention_features(self)