开发者

How can i implement dictionary with translations

开发者 https://www.devze.com 2023-04-11 02:26 出处:网络
I want to create a Eng<->Rus dictionary application. As far as I know, I need to use SQL开发者_JS百科ite. But how can I implement the translation function? How can I find corresponding translation

I want to create a Eng<->Rus dictionary application. As far as I know, I need to use SQL开发者_JS百科ite. 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.


http://en.wikipedia.org/wiki/FreeDict has a good collection of bilingual dictionaries, including eng-rus. It's under 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.

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.

You may want to have a look here too How do I initialize a store with default data in a CoreData application?

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.


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.

In CoreData, you could specify a "Word" entity, with attributes of "English" and "Russian".

0

精彩评论

暂无评论...
验证码 换一张
取 消