我正在使用python和mysql。这里是我的代码使用Difflib从字符串列表中删除几乎重复的字符串
cur.execute("SELECT distinct product_type FROM cloth_table")
Product_type_list = cur.fetchall()
现在Product_type_list描述的是这样
product_type_list =['T_shirts', 'T_shirt', 'T-shirt', 'Jeans', 'Jean', 'Formal Shirt' 'Shirt']
在这里,在product_type_list的产品类型的字符串列表有对T恤和每个牛仔裤和衬衫3重复条目2 。
现在我想我的Product_type_list是这样
Product_type_list=['T_shirt' , 'Jeans', 'Shirt']
我觉得可以用Difflib.Sequencematcher的速动比率。但如何做到这一点
感谢您的回答,但我对Fts匹配逻辑没有任何认识。你能给我提供一些链接,我可以得到知识 –
雅,正如已经说过的,我在SQL Server中的工作就像一个任务。找到这个链接它可能会给出一些FTS等级和soundex逻辑。 http://msdn.microsoft.com/en-us/library/cc879245.aspx,http://msdn.microsoft.com/en-us/library/ms187384.aspx –