Spaces:
Sleeping
Sleeping
wzkariampuzha
commited on
Commit
•
762da8b
1
Parent(s):
26da213
Update extract_abs.py
Browse files- extract_abs.py +3 -3
extract_abs.py
CHANGED
@@ -198,7 +198,7 @@ def autosearch(searchterm:Union[str,int], GARD_dict:Dict[str,str], matching=2) -
|
|
198 |
#search in form of 'GARD:0000001'
|
199 |
if 'gard:' in searchterm and len(searchterm)==12:
|
200 |
searchterm = searchterm.replace('gard:','GARD:')
|
201 |
-
l = [k for k,v in GARD_dict.items() if v==searchterm]
|
202 |
if len(l)>0:
|
203 |
print("SEARCH TERM MATCHED TO GARD DICTIONARY. SEARCHING FOR: ",l)
|
204 |
return l
|
@@ -209,7 +209,7 @@ def autosearch(searchterm:Union[str,int], GARD_dict:Dict[str,str], matching=2) -
|
|
209 |
if len(searchterm)>7:
|
210 |
raise ValueError('GARD ID IS NOT VALID. RE-ENTER SEARCH TERM')
|
211 |
searchterm = 'GARD:'+'0'*(7-len(str(searchterm)))+str(searchterm)
|
212 |
-
l = [k for k,v in GARD_dict.items() if v==searchterm]
|
213 |
if len(l)>0:
|
214 |
print("SEARCH TERM MATCHED TO GARD DICTIONARY. SEARCHING FOR: ",l)
|
215 |
return l
|
@@ -217,7 +217,7 @@ def autosearch(searchterm:Union[str,int], GARD_dict:Dict[str,str], matching=2) -
|
|
217 |
#search in form of 'mackay shek carr syndrome' and returns all synonyms ('retinal degeneration with nanophthalmos, cystic macular degeneration, and angle closure glaucoma', 'retinal degeneration, nanophthalmos, glaucoma', 'mackay shek carr syndrome')
|
218 |
#considers the GARD ID as the lemma, and the search term as one form. maps the form to the lemma and then uses that lemma to find all related forms in the GARD dict.
|
219 |
elif searchterm in GARD_dict.keys():
|
220 |
-
l = [k for k,v in GARD_dict.items() if v==GARD_dict[searchterm]]
|
221 |
print("SEARCH TERM MATCHED TO GARD DICTIONARY. SEARCHING FOR: ",l)
|
222 |
return l
|
223 |
|
|
|
198 |
#search in form of 'GARD:0000001'
|
199 |
if 'gard:' in searchterm and len(searchterm)==12:
|
200 |
searchterm = searchterm.replace('gard:','GARD:')
|
201 |
+
l = [k for k,v in GARD_dict.items() if v==searchterm].sort(reverse=True, key=lambda x:len(x))
|
202 |
if len(l)>0:
|
203 |
print("SEARCH TERM MATCHED TO GARD DICTIONARY. SEARCHING FOR: ",l)
|
204 |
return l
|
|
|
209 |
if len(searchterm)>7:
|
210 |
raise ValueError('GARD ID IS NOT VALID. RE-ENTER SEARCH TERM')
|
211 |
searchterm = 'GARD:'+'0'*(7-len(str(searchterm)))+str(searchterm)
|
212 |
+
l = [k for k,v in GARD_dict.items() if v==searchterm].sort(reverse=True, key=lambda x:len(x))
|
213 |
if len(l)>0:
|
214 |
print("SEARCH TERM MATCHED TO GARD DICTIONARY. SEARCHING FOR: ",l)
|
215 |
return l
|
|
|
217 |
#search in form of 'mackay shek carr syndrome' and returns all synonyms ('retinal degeneration with nanophthalmos, cystic macular degeneration, and angle closure glaucoma', 'retinal degeneration, nanophthalmos, glaucoma', 'mackay shek carr syndrome')
|
218 |
#considers the GARD ID as the lemma, and the search term as one form. maps the form to the lemma and then uses that lemma to find all related forms in the GARD dict.
|
219 |
elif searchterm in GARD_dict.keys():
|
220 |
+
l = [k for k,v in GARD_dict.items() if v==GARD_dict[searchterm]].sort(reverse=True, key=lambda x:len(x))
|
221 |
print("SEARCH TERM MATCHED TO GARD DICTIONARY. SEARCHING FOR: ",l)
|
222 |
return l
|
223 |
|