forked from cltl/KafNafParserPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
executable file
·51 lines (34 loc) · 1.04 KB
/
test.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
from __future__ import print_function
from KafNafParserMod import *
import sys
obj = KafNafParser('kaf_example.xml')
print('I) The object type is: ',obj.get_type())
obj.to_naf()
print('II) The object type is: ',obj.get_type())
obj.to_kaf()
print('III) The object type is: ',obj.get_type())
obj.dump('my_file.kaf')
print('object saved in my_file.kaf as ',obj.get_type())
sys.exit(0)
print('ERA:',obj.type, file=sys.stderr)
obj.to_naf()
print('ahora es',obj.type, file=sys.stderr)
obj.to_kaf()
print('finalmente es',obj.type, file=sys.stderr)
obj.dump()
sys.exit(0)
#for token in naf_obj.get_tokens():
# print token.get_id(), token.get_sent(), token.get_text()
for term in naf_obj.get_terms():
print(term.get_id(),term.get_lemma())
#print naf_obj.get_token('w17').get_id()
#print naf_obj.get_term('t17').get_id()
'''
ext_ref = CexternalReference()
ext_ref.set_resource('my_res')
ext_ref.set_reference('my_ref')
ext_ref.set_confidence('my_conf')
naf_obj.add_external_reference('t17',ext_ref)
naf_obj.dump()
'''