5

I want to present German users English texts and they need to know the meaning of each individual word. I was thinking to use Google Translate API or Bing Translate API, and request a translation for each word in a text. But they respond with only one single translation, which is obviously wrong often.

How can this problem be solved?

  • Have you checked whether any of the many freely accessible online dictionaries can be of any help? I suppose many are not accessible via an API, but it's worth checking. Also, have you thought about Wiktionary? – robert Sep 10 '13 at 13:15
  • You would want to call the API with each word alone. Unfortunately then it would lose context. In linguistics we would call this a gloss but we would accept that even literal translations are very often not 1:1. – hippietrail Sep 10 '13 at 14:24
  • @robert Yes, I have checked around a dozen of free(ly scrapable) dictionaries and APIs: either they lack many words or they don't support multiple translations. – Philip Sep 10 '13 at 14:42
  • @hippietrail I guess it's a question of the error rate, 10% would be already too high. The use case is an E-Learning website... Google Translate's UI shows for single word translations the word type (so there would be some kind of gloss), unfortunately this is not available in their public API. – Philip Sep 10 '13 at 14:46
  • 3
    Word-by-word translation is never going to work - the meaning of an individual words must be disambiguated relative to linguistic and extra-linguistic context. The best you can hope to do, without essentially tackling the entire problem of translation in the first place, is to provide the user with one or (if there are homographs) more than one dictionary entry for each word. The user can then use their discretion to decide which entry is the appropriate one. – P Elliott Sep 10 '13 at 23:49
2

I won't lecture you on the inherent limitations of gloss translations, they are indeed useful some times.

As you know, translation UIs as well as Wiktionary and many other sites give more complete information, but the translation APIs do not. For Google Translate, some unofficial scrapers like GoSlate do offer dictionary data, though without much guidance on how to parse it: http://pythonhosted.org/goslate/#lookup-details-in-dictionary

That said, there are a few techniques that can lessen the problems of a gloss translation:

  1. Take the longest possible match
    Query a dictionary API with the bi- or tri-grams of each sentence first, to find multi-word phrases that are used together often enough to have a dictionary entry.

  2. Use a parts-of-speech tagger Use a POS tagger on the sentence, then take the matching part of speech returned by the dictionary API.

  3. Use a lemmatiser
    Use a lemmatiser to get the canonical ie base form, then do lookup.

[spacy.io is a good lightweight and high accuracy tool for doing [2] and [3] on English data.]

| improve this answer | |
0

There's a discussion here on stackoverflow regarding using Wiktionary which will give you several options. Here is an example: https://en.wiktionary.org/w/api.php?action=query&prop=iwlinks&titles=test&iwprefix=de&format=json&continue=

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.