-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuima.py
31 lines (22 loc) · 845 Bytes
/
uima.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
'''
Created on 05.02.2020
@author: rziai
'''
from cassis import load_dkpro_core_typesystem,load_typesystem,merge_typesystems
from cassis.typesystem import TypeSystem
ISAAC_TYPESYSTEM_FILE = "isaac-type-system.xml"
def load_isaac_ts() -> TypeSystem:
dkpro_ts = load_dkpro_core_typesystem()
# https://stackoverflow.com/a/20885799
try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 `importlib_resources`.
import importlib_resources as pkg_resources
from . import resources
with pkg_resources.open_binary(resources, ISAAC_TYPESYSTEM_FILE) as f:
typesystem = load_typesystem(f)
final_ts = merge_typesystems(dkpro_ts,typesystem)
return final_ts
def simple_type_name(tname: str) -> str:
return tname.split(".")[-1]