JASchilz / AnkiSyncDuolingo

Pull your Duolingo vocabulary into Anki, as an Anki plugin
MIT License
101 stars 10 forks source link

remove lexeme id fallback translation method; use capitalized word as fallback method #58

Closed Erich-Reitz closed 1 year ago

JASchilz commented 2 years ago

Acknowledged and thank you! Will check this out this weekend.

On Tue, Oct 25, 2022, 10:37 PM Erich Reitz @.***> wrote:


You can view, comment on, or merge this pull request online at:

https://github.com/JASchilz/AnkiSyncDuolingo/pull/58 Commit Summary

File Changes

(2 files https://github.com/JASchilz/AnkiSyncDuolingo/pull/58/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/JASchilz/AnkiSyncDuolingo/pull/58, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABO2Q4AMYOLTSKKIXVOUWKTWFC7P5ANCNFSM6AAAAAAROTXIX4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

JASchilz commented 2 years ago

Hi @Erich-Reitz ! Thanks for looking into and addressing this.

I don't touch this code too often, so I've got to build up some context. Does this relate to https://github.com/JASchilz/AnkiSyncDuolingo/issues/57 ? What's the outcome with respect to that issue: you can now get translations for most words?

I see your comment on removing https://www.duolingo.com/api/1/dictionary_page?lexeme_id=%s. I see that that's still in the duolingo.py that I pull that file from, but also there's an issue describing how this endpoint is 404'ing. Is that your experience as well?

Erich-Reitz commented 2 years ago

I see your comment on removing https://www.duolingo.com/api/1/dictionary_page?lexeme_id=%s. I see that that's still in the duolingo.py that I pull that file from, but also there's an issue describing how this endpoint is 404'ing. Is that your experience as well?

Yup! For more context about the PR, in German all nouns are capitalized, so Duolingo likely marks lowercase versions as incorrect. Example: "Tasche" is the German word for bag 'bag' translates to 'Tasche' and 'Bag' translates to 'Tasche' 'Tasche' translates to 'bag' but 'tasche' has no translation

Yet there is no real indication that 'Tasche' should be capitalized when you call get_vocabulary (except for the part of speech being "Noun")

{'strength_bars': 4, 'infinitive': None, 'normalized_string': 'tasche', 'pos': 'Noun', 
'last_practiced_ms': 1660957546000, 'skill': 'Packing', 'related_lexemes': [], 'last_practiced': '2022-08-20T01: 05: 46Z', 'strength': 0.833545, 'skill_url_title': 'Packing', 
'gender': 'Feminine', 'id': 'b9ccc1c0fd841c21d5445e3d64575bc9',
'lexeme_id': 'b9ccc1c0fd841c21d5445e3d64575bc9', 'word_string': 'tasche'},

I don't touch this code too often, so I've got to build up some context. Does this relate to https://github.com/JASchilz/AnkiSyncDuolingo/issues/57 ? What's the outcome with respect to that issue: you can now get translations for most words?

Now, all the words I was pulling have translations. German only. I don't think this change will have impacts for other languages because the lexeme id translation endpoint is broken for all languages.

JASchilz commented 2 years ago

Makes a ton of sense, thank you!

I'm pretty swamped, so it might take me a bit to get this fix in. The code wasn't immediately clear to me, but that might be just that I haven't touched the code base in a while. In any case, the idea of the fix makes a lot of sense.

On Sun, Oct 30, 2022 at 5:32 PM Erich Reitz @.***> wrote:

I see your comment on removing https://www.duolingo.com/api/1/dictionary_page?lexeme_id=%s. I see that that's still in the duolingo.py https://github.com/KartikTalwar/Duolingo/blob/5ae7cb03069f7c4165fb7260d227507daf461f75/duolingo.py#L615-L631 that I pull that file from, but also there's an issue describing how this endpoint is 404'ing https://github.com/KartikTalwar/Duolingo/issues/120. Is that your experience as well?

Yup! For more context about the PR, in German all nouns are capitalized, so Duolingo likely marks lowercase versions as incorrect. Example: "Tasche" is the German word for bag 'bag' translates to 'Tasche' https://d2.duolingo.com/api/1/dictionary/hints/en/de?tokens=%5B%22bag%22%5D and 'Bag' translates to 'Tasche' https://d2.duolingo.com/api/1/dictionary/hints/en/de?tokens=%5B%22Bag%22%5D 'Tasche' translates to 'bag' https://d2.duolingo.com/api/1/dictionary/hints/de/en?tokens=%5B%22Tasche%22%5D but 'tasche' has no translation https://d2.duolingo.com/api/1/dictionary/hints/de/en?tokens=%5B%22tasche%22%5D

Yet there is no real indication that 'Tasche' should be capitalized when you call get_vocabulary (except for the part of speech being "Noun")

{'strength_bars': 4, 'infinitive': None, 'normalized_string': 'tasche', 'pos': 'Noun', 'last_practiced_ms': 1660957546000, 'skill': 'Packing', 'related_lexemes': [], 'last_practiced': '2022-08-20T01: 05: 46Z', 'strength': 0.833545, 'skill_url_title': 'Packing', 'gender': 'Feminine', 'id': 'b9ccc1c0fd841c21d5445e3d64575bc9', 'lexeme_id': 'b9ccc1c0fd841c21d5445e3d64575bc9', 'word_string': 'tasche'},

I don't touch this code too often, so I've got to build up some context. Does this relate to #57 https://github.com/JASchilz/AnkiSyncDuolingo/issues/57 ? What's the outcome with respect to that issue: you can now get translations for most words?

Now, all the words I was pulling have translations. German only. I don't think this change will have impacts for other languages because the lexeme id translation endpoint is broken for all languages.

— Reply to this email directly, view it on GitHub https://github.com/JASchilz/AnkiSyncDuolingo/pull/58#issuecomment-1296399546, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABO2Q4FKE46MBRAHHDUGALLWF4HSTANCNFSM6AAAAAAROTXIX4 . You are receiving this because you commented.Message ID: @.***>

JASchilz commented 1 year ago

Hey @Erich-Reitz ! This work is much appreciated.

However, it looks like Duolingo has shut down the APIs that provide translations. See #59 for more information. So I won't be able to use this code.