entities.py
1.48 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
40
41
42
43
44
45
46
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, dominant, node, prec_context,
follow_context, sentence, position_in_mentions,
start_in_words, end_in_words, rarest, paragraph_id, sentence_id,
first_in_sentence, first_in_paragraph):
self.id = mnt_id
self.set = ''
self.old_set = ''
self.text = text
self.lemmatized_text = lemmatized_text
self.words = words
self.span = span
self.head_orth = head_orth
self.head = head
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.rarest = rarest
self.paragraph_id = paragraph_id
self.sentence_id = sentence_id
self.first_in_sentence = first_in_sentence
self.first_in_paragraph = first_in_paragraph
self.features = get_mention_features(self)