Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Calculate a distance metric between two strings based on the occurrences of their top-k most frequent characters
ResourceFunction["MostFrequentKStringDistance"][str1, str2,k] gives the distance between strings str1 and str2 based on the top k frequent characters. | |
ResourceFunction["MostFrequentKStringDistance"][str1,str2,k,max] uses max as the base distance from which similarity is subtracted. |
Compute the distance between two protein-like sequences:
| In[1]:= | ![]() |
| Out[3]= |
Changing K affects the calculated distance:
| In[4]:= |
| Out[4]= |
| In[5]:= |
| Out[5]= |
Comparing identical strings with high frequency overlap results in a lower distance (or negative if max is exceeded):
| In[6]:= |
| Out[6]= |
Find the "closest" string in a list based on top-1 frequency:
| In[7]:= | ![]() |
| Out[8]= |
Wolfram Language 14.0 (January 2024) or above
This work is licensed under a Creative Commons Attribution 4.0 International License