-
Notifications
You must be signed in to change notification settings - Fork 4
/
NIF21.py
36 lines (31 loc) · 1.27 KB
/
NIF21.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
31
32
33
34
35
36
import NIFBean
import NIFContext
import NIFPrefixes
class NIF21():
def __init__(self):
self._obj_beans = []
self._obj_prefixes = NIFPrefixes.NIFPrefixes()
def context(self, baseURI, beginIndex, endIndex, mention):
self._obj_context = NIFContext.NIFContext()
self._obj_context.baseURI = baseURI
self._obj_context.beginIndex = beginIndex
self._obj_context.endIndex = endIndex
self._obj_context.mention = mention
def bean(self, mention, beginIndex, endIndex, taClassRef, score, annotator, taIdentRef, taMsClassRef):
bean = NIFBean.NIFBean()
bean.referenceContext = self._obj_context.referenceContext
bean.context = self._obj_context.baseURI
bean.mention = mention
bean.beginIndex = beginIndex
bean.endIndex = endIndex
bean.taClassRef = taClassRef
bean.score = score
bean.annotator = annotator
bean.taIdentRef = taIdentRef
bean.taMsClassRef = taMsClassRef
self._obj_beans.append(bean)
def turtle(self):
result = ''.join([self._obj_prefixes.turtle, '\n', self._obj_context.turtle, '\n\n'])
for currentBean in enumerate(self._obj_beans):
result += currentBean[1].turtle + '\n\n'
return result