gabrielaltay
commited on
Commit
•
f81327f
1
Parent(s):
d7c39e4
upload bigbiohub.py to hub from bigbio repo
Browse files- bigbiohub.py +4 -3
bigbiohub.py
CHANGED
@@ -4,11 +4,12 @@ from enum import Enum
|
|
4 |
import logging
|
5 |
from pathlib import Path
|
6 |
from types import SimpleNamespace
|
7 |
-
from typing import Dict, Iterable, List, Tuple
|
8 |
|
9 |
-
import bioc
|
10 |
import datasets
|
11 |
|
|
|
|
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
@@ -162,7 +163,7 @@ kb_features = datasets.Features(
|
|
162 |
)
|
163 |
|
164 |
|
165 |
-
def get_texts_and_offsets_from_bioc_ann(ann: bioc.BioCAnnotation) -> Tuple:
|
166 |
|
167 |
offsets = [(loc.offset, loc.offset + loc.length) for loc in ann.locations]
|
168 |
|
|
|
4 |
import logging
|
5 |
from pathlib import Path
|
6 |
from types import SimpleNamespace
|
7 |
+
from typing import TYPE_CHECKING, Dict, Iterable, List, Tuple
|
8 |
|
|
|
9 |
import datasets
|
10 |
|
11 |
+
if TYPE_CHECKING:
|
12 |
+
import bioc
|
13 |
|
14 |
logger = logging.getLogger(__name__)
|
15 |
|
|
|
163 |
)
|
164 |
|
165 |
|
166 |
+
def get_texts_and_offsets_from_bioc_ann(ann: "bioc.BioCAnnotation") -> Tuple:
|
167 |
|
168 |
offsets = [(loc.offset, loc.offset + loc.length) for loc in ann.locations]
|
169 |
|