Fuzzy string matching#
import bionty as bt
cell_type_bionty = bt.CellType()
cell_type_bionty.fuzzy_match("T cells", cell_type_bionty.name)
By default, fuzzy_match also matches against synonyms:
cell_type_bionty.fuzzy_match("P cell", cell_type_bionty.name)
You can turn off synonym matching with synonyms_field=None
:
cell_type_bionty.fuzzy_match("P cell", cell_type_bionty.name, synonyms_field=None)
Return all results ranked by matching ratios:
cell_type_bionty.fuzzy_match(
"P cell", cell_type_bionty.name, return_ranked_results=True
).head()
Tied results will all be returns:
cell_type_bionty.fuzzy_match("A cell", cell_type_bionty.name, synonyms_field=None)