Skip to content Skip to sidebar Skip to footer

String Clustering In Python

I have a list of strings and I want to classify it by using clustering in Python. list = ['String1', 'String2', 'String3',...] I want to use Levenshtein distance, so I used jellyf

Solution 1:

After using linkage for implementing hierarchical clustering on the distance you have, you should use cluster.hierarchy.cut_tree to cut the tree. If you want two clusters:

cluster.hierarchy.cut_tree(linkage_output,2).ravel() #.ravel makes it 1D array.

Post a Comment for "String Clustering In Python"