How to recognize language text language?

53 views
Skip to first unread message

mickeym...@gmail.com

unread,
May 13, 2016, 1:46:07 AM5/13/16
to Automate
I have a flow which reads email notifications (from and subject) if i have headset connected.

Problem is that I am receiving emails in three different languages... I sounds terrible when speak block uses german to read english or vice versa.

Is there a internal way how to recognize language before sending it to speak block? 

google translate could do that (1) but I dont like to send every email subject to google.

thanks



(1) if someone is interested, google translate could be used.

this call returns some json for the string "Scattered Showers tomorrow"

returns:
[[["Scattered Showers tomorrow !","Scattered Showers tomorrow!",,,0]],,"es",,,[["Scattered",1,[["Scattered",1000,true,false]],[[0,9]],"Scattered Showers tomorrow!",0,1],["Showers",2,[["Showers",1000,true,false]],[[10,17]],,1,2],["tomorrow",3,[["tomorrow",979,true,false]],[[18,26]],,2,3],["!",4,[["!",978,false,false]],[[26,27]],,3,4]],0.78727478,,[["en"],,[0.78727478],["en"]]]


i did not analyze the json output, but "en" is correct


Mark C

unread,
May 13, 2016, 8:34:22 AM5/13/16
to Automate, mickeym...@gmail.com
Can't think of any way other than use one of the online services such as what language.net. but most charge for API access (though its pretty cheap, like 9 euros per million characters).

Florian HubSpace

unread,
May 13, 2016, 9:16:44 AM5/13/16
to automa...@googlegroups.com, mickeym...@gmail.com
You can define dicionarys(as array) and compare the text with it.

for example dictionary english: [" the ", " a ", "ed " ....]

for every match increase a counter and the dictionary with the highest counter wins.

My sms flow use similar to detect voice control.


Online services need an algorithm, too. I think they use some similar, the only advantages of using their service is, that they have a bigger dictionary. 
Reply all
Reply to author
Forward
0 new messages