如何在 MySQL 中标记字符串?
我的项目正在从平面 Excel 文件导入超过 50 万行数据的大量数据,这些文件是由团队手动创建的。现在的问题是,这一切都需要标准化,以便客户搜索。例如,公司字段将有多个公司拼写并包括分支机构,例如“IBM”,然后是“IBM Inc.”。此外,我还有字母数字的产品名称,例如“A46-Rhizonme Pentahol”,单独使用 SOUNDEX 无法处理。
从长远来看,我可以通过使用 AJAX 自动建议通过 Web 表单输入所有数据来解决该问题。但在那之前,我仍然需要处理大量现有数据。根据我在这里读到的内容,这让我相信这是一个很好的过程:
http://msdn.microsoft.com/en-us/magazine/cc163731.aspx
创建自定义模糊逻辑查找和模糊逻辑分组列表
- 项
- 将字符串标记化 的步骤关键字
- 计算关键字 TF-IDF(总频率 - 逆文档频率)
- 计算关键字之间的编辑距离 计算
- 可用 alpha 字符串的 Soundex
- 确定关键字的上下文
- 根据上下文将关键字放入单独的数据库表中,例如“公司”、“产品” ,“成分”
我一直在谷歌搜索、搜索 StackOverflow、阅读 MySQL.com 上关于这个问题的讨论等,试图找到一个预先构建的解决方案。有什么想法吗?
My project is importing a sizable collection +500K rows of data from flat Excel files, which are manually created by a team of people. Now the problem is that it all needs to be normalized, for client searching. For example, the company field will have multiple company spellings and include branches, such as "IBM" and then "IBM Inc." and "IBM Japan" etc. Additionally, I have product names that alphanumeric, such as "A46-Rhizonme Pentahol", which SOUNDEX alone cannot handle.
I can solve the issue in the long term by having all the data input be through a web form, with an AJAX auto-suggest. Until then however, I still need to deal with the massive collection of existing data. This brings me to what I believe is a good process, based on what I've read here:
http://msdn.microsoft.com/en-us/magazine/cc163731.aspx
Steps to create a custom Fuzzy Logic Lookup, and Fuzzy Logic Grouping
- List item
- tokenize strings into keywords
- calculate keyword TF-IDF (total frequency - inverse document frequecy)
- calculate levenshtein distance between keywords
- calculate Soundex on available alpha strings
- determine context of keywords
- place keywords, based on context, into separate DB tables, such as "Companies", "Products", "Ingredients"
I've been Googling, searching StackOverflow, reading over MySQL.com discussions, etc. about this issue, to attempt to find a prebuilt solution. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以,我放弃了,只是为mysql做了一个字符串标记化函数。代码如下:
它的调用方式如下:
strtok("this.is.my.input.string",".,:;"," | ")
并将返回
“this | is | my | input | string”
我希望其他人发现这很有用。干杯!
So, I gave up and just made a string tokenizing function for mysql. Here's the code:
It's called like this:
strtok("this.is.my.input.string",".,:;"," | ")
and will return
"this | is | my | input | string"
I hope someone else finds this useful. Cheers!
您应该查看 Google Refine。
You should check out Google Refine.