Spaces:
Sleeping
Sleeping
Consoli Sergio
commited on
Commit
·
e35b8d3
1
Parent(s):
4e0f84b
corrected bug on synonim missing for bioportal
Browse files
nerBio.py
CHANGED
|
@@ -1534,14 +1534,22 @@ def getUrlBioAndAllOtherBioConcepts(word, args, key_virtuoso, cache_map_virtuoso
|
|
| 1534 |
# np.nan if x is None or (isinstance(x, float) and pd.isna(x)) else x))
|
| 1535 |
# ]
|
| 1536 |
|
| 1537 |
-
|
| 1538 |
-
|
| 1539 |
-
|
| 1540 |
-
|
| 1541 |
-
|
| 1542 |
-
|
| 1543 |
-
|
| 1544 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1545 |
|
| 1546 |
if df_expanded.empty:
|
| 1547 |
# nothing found from Bioportal
|
|
|
|
| 1534 |
# np.nan if x is None or (isinstance(x, float) and pd.isna(x)) else x))
|
| 1535 |
# ]
|
| 1536 |
|
| 1537 |
+
if 'prefLabel' in df_expanded.columns:
|
| 1538 |
+
if 'synonym' in df_expanded.columns:
|
| 1539 |
+
df_expanded = df_expanded[
|
| 1540 |
+
df_expanded['prefLabel'].apply(
|
| 1541 |
+
lambda x: isinstance(x, str) and x.lower() == word.lower()
|
| 1542 |
+
) |
|
| 1543 |
+
df_expanded['synonym'].apply(
|
| 1544 |
+
lambda x: isinstance(x, list) and any(item.lower() == word.lower() for item in x)
|
| 1545 |
+
)
|
| 1546 |
+
]
|
| 1547 |
+
else:
|
| 1548 |
+
df_expanded = df_expanded[
|
| 1549 |
+
df_expanded['prefLabel'].apply(
|
| 1550 |
+
lambda x: isinstance(x, str) and x.lower() == word.lower()
|
| 1551 |
+
)
|
| 1552 |
+
]
|
| 1553 |
|
| 1554 |
if df_expanded.empty:
|
| 1555 |
# nothing found from Bioportal
|