1

I want to know if the API can do something like this:

  • I send a word in an predetermined language

  • API answer if the word exist in that language.

To add some context to the question, the idea is to develop a Scrabble like game, and I'm investigating a method to detect valid words, for all (or most common) languages that is.

I've already asked for a solution in one of their forums, but they are kind of dead.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Artemix
  • 8,497
  • 14
  • 48
  • 75
  • Every widely-used modern language will have a "dictionary" list compiled for it (these are often found with spell checker programs). It might be easiest just to compile a collection of such dictionaries manually/locally and avoid the API service. Note that there be other details; spellings, or even accepted words (including all those fake 2/3-letter scrabble words), in different regions of the same language can vary a good bit - eg. America vs British English. – user2864740 Jul 31 '14 at 21:22
  • I agree, that was my initial idea, however, I've been having a hard time finding those dictionaries... – Artemix Jul 31 '14 at 21:43
  • Is coloquial language accepted? – Daniel W. Jul 31 '14 at 21:45
  • Anything that is a valid word in that language and increase the word list pool, it's welcomed!. (For example, I've found a "complete" list of Spanish (my native language) words that... didn't have any past tense verbs..). – Artemix Jul 31 '14 at 21:49

1 Answers1

0

I tested the MS translator service.

   var result = MST.TranslateText("xyz", "en", "de"); // custom routine that calls MS service
   var result2 = MST.TranslateText("dog", "en", "de"); 
   var result2 = MST.TranslateText("sdfasfgd", "en", "de"); 

Result = XYZ // source xyz
Result2 = Hund // source dog
Result3 = sdfasfgd // sdfasfgd

Looks like when not found or a translation is not possible the string is returned untouched.

The only strange behavior i've noted is conversion to uppercase for Some 3 letter scenarios that arent obvious TLAs in either langauge.

  public string TranslateText(string sourceText, string fromLang, string toLang) {


        var httpRequestProperty = GetAuthorizationRequestHeader();

        var msTransClient = new TranslatorService.LanguageServiceClient();
        // Creates a block within which an OperationContext object is in scope.
        using (var scope = new OperationContextScope(msTransClient.InnerChannel))
        {
            OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
            //Keep appId parameter blank as we are sending access token in authorization header.
            var translationResult = msTransClient.Translate("", sourceText, fromLang, toLang, "text/plain", "");
            return translationResult;
        }
    }
phil soady
  • 11,043
  • 5
  • 50
  • 95
  • I think it's not that easy as it sounds. e.g. `hand` is the same word in english and german. And when using japanese or chinese (or any other language to make sure the same words doesn't exist) you can't be sure that the other language has any word for your input. There may be words existing in one, but no proper translation in the other language. – bratkartoffel Sep 16 '19 at 09:14