Question

I found the proper query for getting additional translations from Google Translate (non API), however it is in a very strange format that I have never seen before.

http://translate.google.com/translate_a/t?client=t&sl=auto&tl=en&hl=en&sc=2&ie=UTF-8&oe=UTF-8&uptl=en&alttl=ru&pc=1&oc=1&otf=1&ssel=0&tsel=0&q=%D0%B2%D0%BC%D0%B5%D1%81%D1%82%D0%B5

[[["together","вместе","","vmeste"]],[["adverb",["together","along","in conjunction","along with","teamwise"],[["together",["вместе","друг с другом","одновременно","воедино","сообща","заодно"],,0.472366542],["along",["вдоль","вместе","вперед","с собой","по длине","дальше"],,0.0944792554],["in conjunction",["вместе","сообща"],,0.0089263292],["along with",["вместе"],,0.000561794208],["teamwise",["сообща","вместе"],,3.34055039e-06]],"вместе",4],["preposition",["including"],[["including",["включая","в том числе","вместе"],,0.00272237672]],"вместе",5]],"ru",,[["together",[4],1,0,999,0,1,0]],[["вместе",4,[["together",999,1,0],["along",0,1,0],["with",0,1,0]],[[0,6]],"вместе"]],,,[],64]

I was able to decode this moderately well with the code

    $kl = str_replace('[[','[',$kl);
    $kl = str_replace(']]',']',$kl);
    $kl = str_replace('[[','[',$kl);
    $kl = str_replace(']]',']',$kl);
    $kl = explode('],', $kl);
    $kl = $kl[1];
    $kl = str_replace('"',"",$kl);
    $kl = str_replace(",["," - ",$kl);
    $kl = str_replace(",",", ",$kl);
    $kl = str_replace('[','',$kl);

Does anyone recognize this format or be willing to attempt to decipher it?

Was it helpful?

Solution

It looks like a deeply nested JavaScript set of arrays used in recursive natural language parsing.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top