将西班牙语 feed 翻译成英语,然后存储到 MYSQL 数据库中
我是 ruby on Rails 的新手,我刚刚开始观看 Rails 转换教程。
我已经了解如何使用 feedzirra 解析提要(如果提要是英语),但如果我有这样的提要(西班牙语),那么我该如何解析该提要?
链接为
http://estaticos.marca.com/rss/futbol_equipos_almeria.xml
在将其保存到数据库之前,如何先将其转换为英文?
感谢您的帮助&支持
I am new to ruby on rails and I have just started watching rails casts tutorials.
I have understood on how to parse feeds using feedzirra if the feed is in English but if I have a feed like this which is in spanish then how do i parse this feed?
The link is
http://estaticos.marca.com/rss/futbol_equipos_almeria.xml
how do i convert this into English first before I save it into the database?
Thanks for the help & support
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 KennyCason 建议的那样,您可以使用 Google Translate API。
Google 还提供了用于 Ruby on Rails 的实用程序库供您入门。
我没有使用过这个,但应该给你一个开始。我也非常怀疑谷歌提供的翻译的准确性。人们必须了解源语言和目标语言才能很好地分析翻译。但我认为西班牙语<-->英语应该相当不错。
As KennyCason suggests, you can use the Google Translate API.
Google also has utility libraries for Ruby on Rails for you to get started.
I have not used this but should give you a start. I also highly doubt the accuracy of translation that google provides. One has to know the from and to language really good to analyze the translation. But i suppose Spanish<-->English should be pretty good.
查看 Google 的 AJAX 语言 API
http://code.google.com/apis/ajaxlanguage/
如果您想要的是机器翻译,那么我推荐这个或类似的解决方案。
这是另一个更通用的链接:http:// /googlesystem.blogspot.com/2008/03/google-launched-another-ajax-api-this.html
正如 Amit 提到的关于翻译准确性,对于具有紧密语法映射的语言(英语 <=>西班牙语)或(日语 <=> 韩语)您将获得最佳翻译,这仍然达不到任何人工翻译,但至少应该是可以理解的。例如,尽管(英语 <=> 日语)在我看来提供了非常粗糙且有时无法理解的翻译。尽管在大多数情况下它应该足够了。
注意:如果您尝试创建一个多语言网站,您可能应该设置不同的基础设施。并考虑让人类为您翻译文本:这是我过去编写的一个快速而简单的示例,用于创建一个多语言网站,该网站使用关联数组来存储您的“语言包”(也可以使用定义)http://ken-soft.com/?p=6,另一个是 100% 数据库支持。 http://ken-soft.com/?p=496 (您也可以混合并将数据库支持的语言包导出到语言文件中,如我给出的第一个链接所示(我将在本周的某个时候对此进行大规模更新,所以请继续关注,如果您有任何问题,请询问我,也请注意。第一个链接可能对大多数人来说更有用)
Check out Google's AJAX Language API
http://code.google.com/apis/ajaxlanguage/
If what you are wanting is Machine Translation, then I recommend this or a similar solution.
And here's another more general link: http://googlesystem.blogspot.com/2008/03/google-launched-another-ajax-api-this.html
as Amit mentioned about Translation accuracy, for langauges that have a close grammatical mapping (English <=> Spanish) or (Japanese <=> Korean) you will obtain optimal translations, which will still fall short of any human translation, but should at least be understandable. Though (English <=> Japanese) for example, provides, in my opinion a very rough, and sometimes not understandable translations. Though It should suffice in most cases.
Note: If you are trying to make a multi-lingual website, you should probably set up a different infrastructure. And consider having humans Translate the text for you: Here is a quick and simple example I whipped up in the past for creating a multi-lingual website that uses associate arrays to store your "language pack" (could also use defines) http://ken-soft.com/?p=6, and another that is 100% Database backed. http://ken-soft.com/?p=496 (you could also mix them and have your database backed language packs exported into language files as in the first link I gave. (I will be doing a massive update to this sometime this week, so stay tuned, and ask me if you have any questions, also make note that the first link is probably more useful to most people)