I want to create a Eng<->Rus dictionary application. As far as I know, I need to use SQLite. But how can I implement the translation function? How can I find corresponding translation of the word requested by the user? Any help, guidance, tutorials will be appreciated.
我想创建一个Eng<->Rus字典应用程序。据我所知,我需要使用SQLite。但是如何实现翻译函数呢?如何找到用户请求的词的对应翻译?任何帮助、指导、教程都将受到欢迎。
2 个解决方案
#1
2
http://en.wikipedia.org/wiki/FreeDict has a good collection of bilingual dictionaries, including eng-rus. It's under GPL.
http://en.wikipedia.org/wiki/FreeDict有一个很好的双语字典集合,包括英语-rus。这是在GPL下。
If you need only eng->rus translation, this is basically a hashtable, where the english word is the key, and the list of corresponding russian words are the value.
如果你只需要eng->的rus翻译,这基本上是一个哈希表,其中英语单词是键,对应的俄语单词列表是值。
If you need bidirectional translation, I would store each word as follows:
如果你需要进行双向翻译,我会将每个单词存储如下:
[word], [language], [set of corresponding translations]
[单词],[语言],[对应翻译的集合]
The translation is easy then: you lookup the word W in language L, and return the set of possible translations.
这样翻译就很容易了:你用L语言查找单词W,然后返回一组可能的翻译。
You may want to have a look here too How do I initialize a store with default data in a CoreData application?
您可能也想在这里看一下,如何在CoreData应用程序中初始化具有默认数据的存储?
Also, it's probably a good thing to add some non-aggressive stemming and/or normalization, so that if I search for a plural (ie. eggs) it's resolved to the singular, or if I search a specific verbal form (ie. walking) it's resolved to the verb's infinitive.
此外,添加一些非侵略性词干和/或规格化可能是一件好事,这样如果我搜索复数(即。它被解析为单数,或者如果我搜索一种特定的语言形式。(步行)它被解析为动词的不定式。
#2
1
Well, there are a lot of ways you could achieve this, but at the simplest level, consider using paired-arrays....two separate arrays. One contains English words, the second array containing the translated equivalents. You can then request a given term at a specified index, and access both terms for it.
嗯,有很多方法可以做到这一点,但在最简单的层面,考虑使用paired-arrays ....两个独立的数组。一个包含英语单词,第二个数组包含翻译后的对等词。然后,您可以在指定的索引上请求给定的术语,并为其访问这两个术语。
In CoreData, you could specify a "Word" entity, with attributes of "English" and "Russian".
在CoreData中,可以指定一个“单词”实体,具有“英语”和“俄语”的属性。
#1
2
http://en.wikipedia.org/wiki/FreeDict has a good collection of bilingual dictionaries, including eng-rus. It's under GPL.
http://en.wikipedia.org/wiki/FreeDict有一个很好的双语字典集合,包括英语-rus。这是在GPL下。
If you need only eng->rus translation, this is basically a hashtable, where the english word is the key, and the list of corresponding russian words are the value.
如果你只需要eng->的rus翻译,这基本上是一个哈希表,其中英语单词是键,对应的俄语单词列表是值。
If you need bidirectional translation, I would store each word as follows:
如果你需要进行双向翻译,我会将每个单词存储如下:
[word], [language], [set of corresponding translations]
[单词],[语言],[对应翻译的集合]
The translation is easy then: you lookup the word W in language L, and return the set of possible translations.
这样翻译就很容易了:你用L语言查找单词W,然后返回一组可能的翻译。
You may want to have a look here too How do I initialize a store with default data in a CoreData application?
您可能也想在这里看一下,如何在CoreData应用程序中初始化具有默认数据的存储?
Also, it's probably a good thing to add some non-aggressive stemming and/or normalization, so that if I search for a plural (ie. eggs) it's resolved to the singular, or if I search a specific verbal form (ie. walking) it's resolved to the verb's infinitive.
此外,添加一些非侵略性词干和/或规格化可能是一件好事,这样如果我搜索复数(即。它被解析为单数,或者如果我搜索一种特定的语言形式。(步行)它被解析为动词的不定式。
#2
1
Well, there are a lot of ways you could achieve this, but at the simplest level, consider using paired-arrays....two separate arrays. One contains English words, the second array containing the translated equivalents. You can then request a given term at a specified index, and access both terms for it.
嗯,有很多方法可以做到这一点,但在最简单的层面,考虑使用paired-arrays ....两个独立的数组。一个包含英语单词,第二个数组包含翻译后的对等词。然后,您可以在指定的索引上请求给定的术语,并为其访问这两个术语。
In CoreData, you could specify a "Word" entity, with attributes of "English" and "Russian".
在CoreData中,可以指定一个“单词”实体,具有“英语”和“俄语”的属性。