Skip to content

Commit 072cda0

Browse files
authored
Merge pull request #153 from steppi/load_grounding_map_fix
Load grounding map fix
2 parents 1befd93 + 4d55241 commit 072cda0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

famplex/load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _construct_grounding_map(rows):
5151
for row in rows:
5252
text = row[0]
5353
db_refs = {'TEXT': text}
54-
db_refs.update({ns: id_ for ns, id_ in zip(row[1::2], row[2::2])})
54+
db_refs.update({ns: id_ for ns, id_ in zip(row[1::2], row[2::2]) if ns})
5555
gmap[text] = db_refs if len(db_refs) > 1 else None
5656
return gmap
5757

famplex/tests/test_load.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from famplex.load import load_grounding_map
2+
3+
4+
def test_load_grounding_map():
5+
gm = load_grounding_map()
6+
for text, db_refs in gm.items():
7+
assert db_refs['TEXT'] == text
8+
assert '' not in db_refs

0 commit comments

Comments
 (0)