swapagarwal / JARVIS-on-Messenger

:speech_balloon: A community-driven python bot that aims to be as simple as possible to serve humans with their everyday tasks
https://m.me/J.A.R.V.I.S.on.Messenger
MIT License
1.35k stars 988 forks source link

Add language translation module #380

Open adrianyi opened 6 years ago

adrianyi commented 6 years ago

Feature description:

Translate a phrase from one language to another. Wit.ai already has entity called "phrase_to_translate", which does good job of picking phrases up. I already tried a simple version of this on my own, and it seems to work well.

Any ideas on how to implement it?

Google provides Google translate API, using the same key as Google Maps. Wit.ai can be easily trained to pick up source/target language and phrase to translate. There's the annoying part of adding languages... Source language is optional, as Google translate can auto-detect it. Target language can be optional and be made English by default if not provided.

I'm a little busy this week, but can get this written the following week :)

Thoughts?

casdidier commented 6 years ago

Hello Adrian, It could be nice improvement to have this module.

First implement with optionals as source and Target would be nice to have at first ^^

Then So the issue would be to find a work around for the autodetection of language. When someone wants to translate from specific language to another language that is not English ?

For the implementation , I thought of google too at first when reading your title it is fast and accurate. Still we should have a link to redirect to Google translate if the translation is not correct for the user .

paawan01 commented 6 years ago

Any updates on this ? @adrianyi @casdidier

adrianyi commented 6 years ago

Sorry I took part in a bootcamp for a bit and did not have time to work on this... I realized that Google translate is actually not free, haha, which led me to do some more research. I had to reinstall my OS and lost all progress, so I'll have to start over, sadly. I'll get back on this in the next couple of weeks!

paawan01 commented 6 years ago

@adrianyi No issues. I'd love to work on this too. Do you mind sharing what are you doing so we can collaborate ?

adrianyi commented 6 years ago

@paawan01 Would love to work together. This week is packed for me, but I should be relatively free starting Sunday night, so I'll dig up what I have so far then :)

A good alternative to Google translate may be Bing translate, which is free up to 2M characters. There's a free Russian one, but it's not very accurate...

paawan01 commented 6 years ago

I think 2M is enough for our case at least not in the long term though. We'll look for something better.

I'm busy too this week. Let's get started by this weekend. I'm excited.

casdidier commented 6 years ago

Isn't it possible to launch search on Google search : <translate "input text" into English > and get the result by reading the HTML banner that is displayed usually on top on Google links . You see those quick access results pannel