词匹配算法
我们正在设计一款移动应用程序,可以读取产品的条形码并从 8 个电子商务网站获取价格。我正在用 C# 设计 Web 服务器端,它具有所有逻辑并通过 Web 服务将数据发送到客户端。
如果我通过发送条形码询问产品的价格,一切都可以。 但大多数网站系统的数据库中没有条形码编号,因此我必须向他们发送产品名称,并且它必须以某种方式匹配才能获取产品详细信息。
为了获取产品名称,我进行 UPC 查找并从网站获取产品名称。
但问题就是从那一刻开始的。每个电子商务网站都可以有不同的结构和不同的产品名称。我将如何编写一个算法来解析电子商务数据库并为我带来结果。我真的必须为每个电子商务网站编写一个单独的数据解析器吗?有没有我可以写的算法。
任何帮助将不胜感激。
We are designing a mobile application which reads barcodes of the products and get prices from 8 e-commerce sites. I am designing the web server side by C# that has all the logic and sends data to client by web service.
If I ask the price of the product by sending the barcode, everything is ok.
But most of the web site systems do not have barcode numbers in their database so I have to send them a Product Name and it MUST match somehow to get back the product details.
To get product name, i do a UPC lookup and get the product name from a web site.
But the problem starts at that moment. Every e-commerce site could have a different structure and different product name. How am I going to write an algorith that will go and parse e-commerce databases and bring me results. Do I really have to write a seperate data parser for every e-commerce site. Is there an algorithm that I can write.
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
恐怕你必须编写那个解析器。我怀疑除了这个算法应该如何工作之外你还可以使用任何算法......(可能就像你的解析器)
I'm afraid you'll have to write that parser. I doubt there's any algorithm you could use, besides how this algorithm should work... (probably like your parser)
1-一种解决方案是将通用产品名称存储在数据库表中,以便您可以将它们作为静态列表存储在服务器内存中,并在 EOD 时通过作业更新列表。
2- 找到一些提供产品名称的外部 Web 服务,并在您的 Web 服务中使用该服务。
因为,您无法访问每个网站来解析数据。
1-One solution would be store common product name in a database table so that you can store them in server memory as a static list and update the list by a Job at EOD.
2- Find some external web service which provide the prodcutname and use that service in your web service.
because , you just can't go each and every web site to parse the data.
我发现,如果我将产品名称中的每个单词发送到字符串数组中,电子商务网站就可以在数据库中逐字搜索,直到获得一个产品结果并将其返回给我。
I found out that, if I send every word in a product name in a string array, ecommerce website can search in their database word by word until they got one product result and return it to me.