forked from hslh/pie-disambiguation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpie.py
30 lines (23 loc) · 1.05 KB
/
pie.py
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
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
'''Defines the PIE class'''
class PIE:
'Class for PIE instances'
PIE_counter = 0
def __init__(self, corpus, pie_type, sense_label, binary_label, context, context_untokenized, offsets):
self.id = PIE.PIE_counter
PIE.PIE_counter += 1
self.corpus = corpus
self.split = ''
self.pie_type = pie_type
self.sense_label = sense_label # Original label
self.binary_label = binary_label # Label, normalised to literal 'l', idiomatic 'i', or other ''
self.predicted_label = ''
self.classification = '' # False/true positive/negative
self.context = context # List of tokenized sentences, where middle sentence contains the PIE
self.context_untokenized = context_untokenized # Same, but untokenized
self.offsets = offsets # Character offsets of content words of the PIE in middle sentence of tokenized context
def __str__(self):
print(str(self.__dict__))
def __repr__(self):
return str(self.__dict__)