Remove false-positive entity normalization artifacts from nlm_gene
#3
by
davidkartchner
- opened
- nlm_gene.py +18 -8
nlm_gene.py
CHANGED
@@ -176,14 +176,24 @@ class NLMGeneDataset(datasets.GeneratorBasedBuilder):
|
|
176 |
"""Parse BioC entity annotation."""
|
177 |
offsets, texts = get_texts_and_offsets_from_bioc_ann(span)
|
178 |
db_ids = span.infons.get(db_id_key, "-1")
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
return {
|
189 |
"id": span.id,
|
|
|
176 |
"""Parse BioC entity annotation."""
|
177 |
offsets, texts = get_texts_and_offsets_from_bioc_ann(span)
|
178 |
db_ids = span.infons.get(db_id_key, "-1")
|
179 |
+
|
180 |
+
# Correct an annotation error in PMID 24886643
|
181 |
+
if db_ids.startswith('-222'):
|
182 |
+
db_ids = db_ids.lstrip('-222,')
|
183 |
+
|
184 |
+
# No listed entity for a mention
|
185 |
+
if db_ids in ['-1','-000','-111']:
|
186 |
+
normalized = []
|
187 |
+
|
188 |
+
else:
|
189 |
+
# Find connector between db_ids for the normalization, if not found, use default
|
190 |
+
connector = "|"
|
191 |
+
for splitter in list(splitters):
|
192 |
+
if splitter in db_ids:
|
193 |
+
connector = splitter
|
194 |
+
normalized = [
|
195 |
+
{"db_name": "NCBIGene", "db_id": db_id} for db_id in db_ids.split(connector)
|
196 |
+
]
|
197 |
|
198 |
return {
|
199 |
"id": span.id,
|