Userscript: Reverse Tree Enhancer
Have you been using a reverse tree to learn a language not yet available on Duolingo as a regular tree? Or maybe you like the challenge of having to write more in your target language than in your source language, and having to use unfamiliar grammar unexpectedly? And are you annoyed that there is no audio or listening exercices for reverse trees?
Then install my userscript (direct link), disable speaker and mic in Duolingo’s options (in order not to have audio and speaking/listening exercices in your source language), click the “Is this a reverse tree?” button at the top of your reverse tree and enjoy! (Shift-space to play the sound again).
I’ve been learning Polish (from scratch) through the reverse tree for 3/4 months now (I recently passed the third of the tree) and I got quickly annoyed by the absence of audio and of listening exercices, so I decided to write a script turning most exercices into listening exercices. As I thought it would probably be useful for other people, I cleaned it up and made it independent of the languages and I’m now ready to share it with you. In the description that follows I will use the reverse Polish tree as an example, but the script should work with all (most?) trees. I have tried it with a few other trees, but not all of them, so don’t hesitate to let me know if there is a problem with some language.
The general idea is that whenever there is some Polish in the exercice, I will say it through Google Translate’s TTS and hide it on the page, so that you have to understand what was said.
For instance when you have to translate from Polish to English, instead of showing the Polish text on the left, you will be shown a big gray box and be asked you to translate what you’ve heard instead. You will see the Polish text afterwards, whether you have it right or wrong. Don’t forget that you have to translate, it happened several times to me that I was just transcribing what I’d heard and of course my answer was wrong.
Similarly for exercices where you have to translate a single word, with images picturing it, it will hide both the Polish word and the images (it would be too easy to have to type “apple” when seeing an image of an apple) say the Polish word and ask you to type the English word.
For multiple-choice questions, I find them usually way too easy because most of the time only one of the three sentences makes any sense (even more so when they are written in English, your source language), so I decided to hide everything (the Polish sentence you have to translate and the three English suggestions), so that you only have the TTS audio to try to figure out what was said. Of course you still need to see the English suggestions in order to choose the right one, so they will be displayed whenever you’re passing the mouse over them.
And similarly for multiple-choice questions where you have to choose an image.
Finally, after sometime of using it I noticed that Google Translate’s TTS eventually gets tired of speaking and requires you to type a captcha to continue, so every once in a while you will see the error message below. Just click on “here”, solve the captcha in the new tab, then click on “Done” and you can continue.
You can play the audio again using Shift-space (as Ctrl-space is already taken by Duolingo for playing the English).
The code is available on GitHub here and feel free to tell me if you have comments, suggestions, bug reports, etc.
I hope this will be useful to some of you! :-)
I've only been using your script for around ten minutes, but I'm already finding it invaluable and can't imagine attempting the Polish tree without it! It seems I'm having a lot of difficulty recognising words with ę and ą - I'm glad I'm finding this out at a very early stage. Plus the audio comprehension is already making it easier to remember conjugation patterns... my days of spending ten minutes trying to remember ptakiem vs. ptakami may finally be over! :)
It seems like a lot of hard work went into that script (computers mostly seem like magic to me). You've done a great job and I'm sure it'll help a lot of people using reverse trees.
This is wonderful. Thank you. Take my lingots!
A bit of feedback: I ended up removing the bits to hide the target language text in most cases (except for the pictures ones). This is obviously personal preference, but it would be awesome if—for non-developers—you also patched
/settings/account to allow users to choose which exercise types to hide!
Additional: Would it be possible to take out the "complete the sentence" exercises? Like, making me choose the right form of "drink" to go with "I"? I have no idea how difficult or easy it is to change stuff like that, it just seems like those exercises aren't valuable to an English speaker (or whichever target language a person is using).
I completely agree that those exercices are useless, unfortunately I don't think I can get rid of them. It is the server which is choosing the exercices and I have no way to change that... They don't seem to happen very often though (at least in the Polish tree, maybe it's different in the Russian one).
Wow, this is absolutely fantastic! Hands down the best userscript I've ever used. It worked really seamlessly. I already finished the English to Russian tree, and man, how I wish I had had this while I was doing it. But I did that mostly through the app, so redoing lessons using this script while waiting for the Russian course to come out will be fun, and I have been thinking about dabbling in Greek for a while. :D
The "DuoLingo tree enhancer" user script from Camilo, which is also working for playing audio (e.g English->Portuguese questions in forward tree courses on right hand side L2 answers and being able to read multiple-choice L2 answers (please see my comment at the bottom of this thread"), has been successfully updated for the new DuoLingo 2017 portal code: https://www.duolingo.com/comment/19654789$comment_id=23151134
For those who are waiting for a new version, unfortunately I’ve been very busy and I will now be travelling without a computer, so I won’t be able to update it until August at the earliest. I suggest you take a look into the "DuoLingo tree enhancer" user script mentioned above. I haven’t tried it yet, but there is no doubt that it is better than nothing.
For everyone using my script, I advise you to regularly check for updates (Tampermonkey for Chrome has a "Check updates" button, and Greasemonkey probably too), follow the repository on GitHub, or just reinstall it regularly (the link at the top of the post will always point to the latest version, so you can just click on it again and it will update the script).
In particular, I fixed a few days ago an encoding problem giving (at least in some cases) a very strange pronunciation for French accented letters.
Another remark is that if you are learning a language with special diacritics (you probably are), you really should find out how to type them on your keyboard and try not to forget them. The issue is that Duo won’t warn you for missing accents (I guess it considers that you speak the language so it’s not very important to annoy you with that), but then when giving it to Google Translate the pronunciation might be completely wrong (and I have no way to fix it as Duolingo says it’s correct so I can’t figure out whether you’re missing diacritics or not).
In Greasemonkey you can even activate automatic updates, even on a per script basis! You find it in the Greasemonkey tab (under Addons) when you click on "more" (at least in German it's "mehr") under each individual script. But I think this is usually activated as a default setting as well.
One week later and I'm still extremely happy about this. ;-)
Since I know that you're following this thread, I have a little request if it's possible. It's about the type of exercise that you have in your first picture, when you have to translate the Polish text into English and the original text is now hidden so that we can only go by the audio. Would it be possible to not hide this text completely but instead have it appear while passing the mouse over it, like in the multiple choice and image exercises?
To explain why I would like this: I'm learning French though the German from French tree right now. French has some examples in its language where you can't hear a difference between different words, you only know when written or have to figure it out by meaning. I never thought about it before but now I noticed even German has them. When DL creates a listening exercise they plan accordingly, offer all the different meanings as possible translations. But now if this word comes up in a written sentence, you're of course supposed to see and recognize it. Only one answer is acceptable. But we can't see it. So it would be great if I could go over it and reveal what's written there when necessary. But still have it hidden by default as it is now.
Makes perfect sense, I didn’t think about it as it doesn’t seem to happen much in Polish, but I’m French and I know it can happen quite a lot in French. The problem of having it appearing when passing the mouse over it is that it’s too easy to do it by mistake. Maybe it should instead appear only when we click on the grey box? Or have a button somewhere?
Yes, I've also encountered this when doing the fr/en tree. I'd suggest having it show when you click on the box.
Like Bellatrix, I'm very happy with the script and this is the only small issue I've encountered. It's making the reverse tree a far more valuable learning experience.
Fixed. Now when you click on the big grey box it will show the text and then hide it again as soon as you move the mouse out of it. Of course I suggest using this feature only when you have understood the spoken text and know that it can have two different interpretations, otherwise it’s cheating :P
Is anybody using Camilo's "Duolingo Next Lesson" Tampermonkey user script?
Finally I have added a new (longer) comment highlighting some facts about
- to filter skills by strength (there was a user style to filter golden skills)
- rename skill names (adding prefixes, e.g on our www.duome.eu/USERNAME/progress page)
- a (crowns) level-up lesson strategy concept to focus on more difficult grammar (e.g Subjunctives) / Verb tense skills
in Camilo's "Duolingo Next Lesson" thread: https://forum.duolingo.com/comment/26849592$comment_id=29666271
as well as "[HOWTO]: Different ways for spaced repetition with skill strength viewer (user script and extension)" thread: https://forum.duolingo.com/comment/29304553$comment_id=29666130
I would like to invite advanced users and user script or user style programming gods to join and discuss questions and ideas on a brainstorming level.
Best regards / Viele Grüße
This is absolutely fantastic!!! Brilliant! Amazing!
I had to wait for "my" reverse tree to finally go into beta (which happened just now!) so I could try it out. I love it! And I'm glad that I can now start this tree together with this script. Thank you so much! :)
One more exercise that would be great to change would be the "listening to a word in the target language and then writing it". Especially because the audio is extremely slow in these cases, which makes it totally annoying. If the audio could be in the source language instead, that would be great. But I'm not sure if it's possible for you to work on this type of exercise because there is no written text in the source language.
No, the other way around. Right now, in this type of exercise, you get the audio in the language you're supposed to learn (target language) (not the one you want to learn if you do a Reverse Tree). Then you have to write it in this language that you're supposed to learn.
I wish it was was possible to hear the audio in the source language of the course instead of the target language.
(source, target, from this to there or from there to that, ... all so confusing ^^)
The Google TTS api recently changed. I followed this: http://stackoverflow.com/questions/32053442/google-translate-tts-api-blocked
And changed a single line of your code. Works now: playSound("http://translate.google.com/translate_tts?tl=" + targetLang + "&q=" + sentence + "&client=tw-ob");
What do you mean by "works now"? Was it not working before? And how long have you been testing this change?
If you’re talking about the need for solving a captcha, I tried to put "&client=t" as suggested in a similar post as the one you link to, and the consequence was that the day after I was presented with an error message "try again later" without any captcha for getting around it (so this time it was really blocked). It might do the same with "&client=tw-ob", although I’ll try it to see.
But have you tried it over several days? When you get the error message, you can just solve the captcha, and then you won’t get the error anymore for some time. I usually get the TTS error only once a day, at the first sentence, and after that I can do hundreds of sentences without any problem.
I like the Yandex pronunciation better but unfortunately the Yandex TTS does not automatically correct letter accents. For the record, here's how to get the 'incorrect' Yandex TTS.
I don't type letter accents because I'm lazy. I'll type "Czytaja ksiazki" instead of "Czytają książki". Google does a good job of recognizing the missing letter accents (press play sound on the page) while Yandex does not. Especially recognizable on the word ksiazki.
Therefore, Yandex is not suitable as a TTS engine.
... and on the same example, "czytaja" is not pronounced correctly. It’s really not reliable, try for instance with "Zjadlem miod" instead of the correct "Zjadłem miód". Both the "ł" and "ó" are not pronounced correctly even though the translation given is correct (so Google Translate understood what the words were supposed to be). I think Yandex is perfectly suitable as a TTS engine, it’s your job to give him a correct input (and it’s a bug that Duolingo accepts such errors without even considering them a typo).
Have you added Tampermonkey to chrome? See instructions: https://github.com/guillaumebrunerie/reversetreeenhancer
As butstay says, have you installed Tampermonkey? (it’s a Chrome extension available here: https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
I've been using this script for a couple weeks and I have to say, the updates just keep getting better and better. Thank you so much for your excellent work on this fantastic piece of scripting. It is an invaluable tool for anyone using a reverse tree and I would recommend it to anybody.
Thanks for the update IRT the captcha thing. Makes life so much easier when Google's TTS doesn't decide to wear out right when you've got a listening exercise. Hehehehe :P
Also the update with the mouse-over reveal is really handy as a learning aid - yeah, it can be cheating but sometimes I have trouble with the direct tree and have to use the turtle several times and that just happens to be a limitation of Google's TTS it seems - sometimes it's just not QUITE slow enough for me personally.
Thanks so much again for this. :D
All right, I've tried this using the English to Dutch tree. It works pretty well. The only thing is, I noticed that when it's an exercise translating from English to Dutch, the TTS reads the English sentence...with the Dutch TTS. This certainly creates some interesting (but perhaps realistic in a way) challenges trying to understand what the heck the voice is even saying...in English!
Is this the way it's "supposed" to be, or is something perhaps acting up here? Is there any way to have it not read the English text I'm supposed to translate to Dutch?
Thanks for a cool script!
Hello, great script. Thank you.
Also your tip here on the discussion forum in de-activating the audio pretty much makes sense - I overlooked it once before.
For the English-German tree reverse course (native German) of course it makes no sense that there is either
- German sentences being spoken by DuoLingo
- DuoLingo speaking German and you have to write down the sentence in German instead of translating it into English
So with switching the audio settings it seems I could succesfully kill those annoying German practice test questions. Hope so. Will have to test more.
BTW: What would be the easiest way to fast switch audio on/off? Keyboard hotkeys?
Having to go to the Profile settings menu is a little of work if you have multiple language courses active and you have to do that each 1-2 days... For the normal tree courses audio has to be ON (of course).
I was using this and it was working beautifully but stopped working entirely after the recent redesign.
Is there any effort underway to rewrite this to work with the new website? I would really love this, because I could continue working through the courses I had been working through.
I might be willing to chip in some donations to make this happen.
Hello, no I am not planning to rewrite it to work with the new website.
But have you tried the userscript "DuoLingo Tree Enhancer" from Camilo?: https://www.duolingo.com/comment/19654789. It’s an improvement of my original script with more features, and I believe it works with the new website.
I haven’t tried it yet personally but it seems quite active so I believe it should work.
"For instance when you have to translate from Polish to English, instead of showing the Polish text on the left, you will be shown a big gray box and be asked you to translate what you’ve heard instead. You will see the Polish text afterwards, whether you have it right or wrong. "
For these types of questions, is there a way to make the audio repeat before we try to translate it? I'm assuming that refreshing will just take me out of the lesson. Sometimes I am caught a little off guard and by the time I realize it's a translation question, I missed it.
Hi, thanks for the script. :) I'm learning German and the translated text (via Google) is spoken by the computer, however, the German text on the left is not grayed out. On the other hand, when I'm to choose from three pictures (like select translation of man page where I have der Mann, die Frau, der Junge options, all pictures are grayed out. I thought this might be a bug.. Thanks for your help..
No problem. A "reverse tree" is when you are using the course teaching the language you already know (in your case English) for speakers of the language you want to learn (in your case German), and this script will only work as expected if you are in this case. You can do it like that (and use my script), but be aware that there are several differences with respect to a normal course: Duolingo will all be in German, the course won’t be designed to learners of German, you won’t have the buttons for typing the special characters of German, you will be asked to translate to German more often, and so on.
I love the idea of the script but it really didn't work well with me. I had two major issues with it, both in the Japanese→English course.
- On the picture questions the script read out Undefined as the word. Is this maybe because 「」 are used as delimiters rather than ""?
- On everything else the text was covered in grey boxes that would usually (but not always) come right when I put my mouse over them, but then go back to grey boxes if I moved it away again.
I hope you can fix this because it's really very cool. I was using it in Iceweasel 38.4.0 (Debian's rebranded firefox) in Debian 3.16.7-ckt11-1+deb8u5 (stable) on kernel 3.16.0-4-amd64.
Thank you for trying it with Japanese! I haven't tried it at all with such "complicated" languages, so I'm expecting potential issues. I temporarily fixed the first issue (it will turn the Japanese quotation marks into usual quotation marks, but at least it should hide and pronounce the right thing now). For the second issue, I'm not sure I understand the problem. Note that when you have to translate from Japanese to English, the Japanese text will be hidden in a grey box, but it can be shown anyway by clicking on it.
Cool, thanks for the prompt fix. I saw it had been updated and wondered if it was because of my post. ^_^
Note that when you have to translate from Japanese to English, the Japanese text will be hidden in a grey box, but it can be shown anyway by clicking on it.
Oh... hmmm. Is there a way to disable that? Because I find it super annoying. Plus for the exercises where you have the Japanese text and have to select one of three on the right hand side all the text boxes are covered in grey making the task a bit more... interesting. :P
Even if you just point at where I can change it in the source code I'm happy to do that myself if you don't want to make it a change for everyone. I'm just not particularly familiar with JS and am not entirely sure where to make it.
Edit: Well something I removed stopped hiding stuff and the rest seems to be still working. :P Your change with the brackets seems to be going fine too thanks! It's a really good idea and I'm surprised it's actually possible. You should be very please with yourself! Have a heap of lingots.
Why do you want to disable it? Do you need to be able to click on the box without nothing happening? The reason this feature has been introduced is that in some languages there can be two different sentences which are pronounced exactly the same (for instance "Il parle" in French means "He’s talking" and "Ils parlent" means "They’re talking", and they are both pronounced exactly the same). In such cases, you need to be able to look at the text in order to know which traduction Duolingo is expecting. If you want to, you should be able to disable it by removing the "cell.onclick = …" lines in the challengeTranslateTarget function.
For multiple choice questions, it’s also on purpose that everything is hidden, so that you can concentrate on the audio without being influenced by the three choices. You can see them just by putting the mouse over them.
It's just preference I guess. Although in the specific case of Japanese part of it is that I'm also needing to learn to recognise the characters and on top of that there's also a number of homophones that are distinguishable in writing/context but not by sound. Thanks again for designing it though. :)
This is fantastic! I tried it with the English from Greek reverse tree, and the TTS works fine for the most part (producing a lot of errors with stress and rhythm), but it is just so much more interesting when audio of the actual target language is involved. I am much more motivated to finish the reverse tree now, thank you so much!
Have you already tried the new user script "DuoLingo Tree Enhancer" from Camilo?: https://www.duolingo.com/comment/19654789
I am currently using it for the English-Portuguese forward course to play the audio of PT answers (audio play was updated for multiple types of questions including multiple-choice).
Works now with the new DuoLingo 2017 portal code: https://www.duolingo.com/comment/10954397$comment_id=23151162
NEW: Camilo's script even includes now (tested for forward trees so far by myself) the possibility to read out loud multiple-choice L2 audio (e.g Portuguese from EN-PT course) answers, not only translation challenges! This has not been working before.
I guess I remember that playing audio of multiple-choice L2 (target language) challenges was included in your reverse tree enhancer script?
Question to Latcarf: Had you get it working before to even play the audio of "choose single word from drop-down box" challenges?
No, it is EOL.
The successor is "Duolingo Tree Enhancer" by Camilo since 2017 which also gives options for normal/forward trees (like your displayed French, Portuguese, German,... courses).
Please see the last reply from Latcarf in this thread: https://forum.duolingo.com/comment/10954397?comment_id=24738980