Return Similarity Matrix From Two Variable-length Arrays of Strings (scipy option?)
问题 Say I have two arrays: import numpy as np arr1 = np.array(['faucet', 'faucets', 'bath', 'parts', 'bathroom']) arr2 = np.array(['faucett', 'faucetd', 'bth', 'kichen']) and I want to compute the similarity of the strings in arr2 to the strings in arr1 . arr1 is an array of correctly spelled words. arr2 is an array of words not recognized in a dictionary of words. I want to return a matrix which will then be turned into a pandas DataFrame. My current solution (credit): from scipy.spatial