Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not connect to Forvo #46

Open
thelhpho opened this issue Jan 6, 2025 · 5 comments
Open

Could not connect to Forvo #46

thelhpho opened this issue Jan 6, 2025 · 5 comments

Comments

@thelhpho
Copy link

thelhpho commented Jan 6, 2025

Hi there

I just installed the plugin and it's working great - apart from when I press add to Anki it tells me that "Couldn't connect to Forvo". No matter what it keeps giving me this error until I discrard it and then it uploads without the audio. Is there a way I can fix this? I tried removing the link in the profiles bit about the aduio but I get the same error.

@nairyosangha
Copy link
Member

when I press add to Anki it tells me that "Couldn't connect to Forvo".

This gets printed when forvo itself returns a 200 code. It's hard to say what went wrong here, it might've just been a problem on their side. It works fine for me now. It can have problems sometimes but usually retrying works.

No matter what it keeps giving me this error until I discrard it and then it uploads without the audio

If you discard the note it actually doesn't get uploaded at all.

I tried removing the link in the profiles bit about the aduio but I get the same error.

You mean you removed the audio_field from whatever profile was associated with the document you were reading? That should do the trick, it will not prompt forvo anymore in that case. Note that this only applies to new notes you make after that point. Notes that were stored locally before you made this change will still attempt to query forvo.
Since we need an internet connection to query forvo it stores the info it needs locally, and only does the call the moment you try to synchronize the note(s).

@thelhpho
Copy link
Author

when I press add to Anki it tells me that "Couldn't connect to Forvo".

This gets printed when forvo itself returns a 200 code. It's hard to say what went wrong here, it might've just been a problem on their side. It works fine for me now. It can have problems sometimes but usually retrying works.

No matter what it keeps giving me this error until I discrard it and then it uploads without the audio

If you discard the note it actually doesn't get uploaded at all.

I tried removing the link in the profiles bit about the aduio but I get the same error.

You mean you removed the audio_field from whatever profile was associated with the document you were reading? That should do the trick, it will not prompt forvo anymore in that case. Note that this only applies to new notes you make after that point. Notes that were stored locally before you made this change will still attempt to query forvo. Since we need an internet connection to query forvo it stores the info it needs locally, and only does the call the moment you try to synchronize the note(s).

Thanks, I just turned it off and things work fine.

I had two queries:

Is there a way to avoid duplicates for words which are really the same, for example if I was looking up the word "is" and the word "are" they would both point to the English definition of the verb "to be", however because the two words that were looked up are different it'd create two cards. Do you generally just recommend leaving that as is, or is there a way to look at the stem of the word somehow?

Is there any way to have put in a definition on the same card from the second dictionary? I have multiple dictionaries installed and it'd be good to have two dictionaries saved as default.

The app works really well in any case, thank you very much for creating it.

@nairyosangha
Copy link
Member

nairyosangha commented Jan 13, 2025

Is there a way to avoid duplicates for words which are really the same, for example if I was looking up the word "is" and the word "are" they would both point to the English definition of the verb "to be", however because the two words that were looked up are different it'd create two cards. Do you generally just recommend leaving that as is, or is there a way to look at the stem of the word somehow?

If I have to look up 'is' in "he is x" and 'are' in "they are y" then I wouldn't really have a problem with that because I obviously don't know the word very well, the sentence context being there would make them different enough for me.

That said, it would depend on your dictionary. If you look up those 2 words chances are the headword in the dict will just be "to be" for both, so you could get around this with one of the provided extensions: https://github.com/Ajatt-Tools/anki.koplugin/blob/master/extensions/EXT_dict_word_lookup.lua

Instead of saving "are" and "is" it would save "to be" for both, which would hopefully be good enough to get the duplicate detection you want. I hid this in the extensions but maybe this should be part of the main config, it comes up pretty often

Is there any way to have put in a definition on the same card from the second dictionary? I have multiple dictionaries installed and it'd be good to have two dictionaries saved as default.

There's an extension for that as well: https://github.com/Ajatt-Tools/anki.koplugin/blob/master/extensions/EXT_multi_def.lua

You will have to update the mapping in there for it to work though:

dict_field_map = {
-- the below example sends dictionary entries from 'JMdict' to the field 'SentEng' on the anki note
-- ["JMdict Rev. 1.9"] = "SentEng",

You have to add the dictionaries (with the name as they appear in the koreader settings), together with the field you want to send them too, if you want to add multiple dicts to the same field you could do something like

local MultiDefinition = {
    description = "When trying to make the monolingual transition, it can be helpful to create a card with the language in your target language, while still also inserting the definition in your native language in a separate field.",
    -- key: dictionary name as displayed in KOreader (received from dictionary's .ifo file)
    -- value: field on the note this dictionary entry should be sent to
    dict_field_map = {
        ["One of my dictionaries"] = "Definition Field",
        ["Another dictionary here"] = "Definition Field",
    }
}

@thelhpho
Copy link
Author

Is there a way to avoid duplicates for words which are really the same, for example if I was looking up the word "is" and the word "are" they would both point to the English definition of the verb "to be", however because the two words that were looked up are different it'd create two cards. Do you generally just recommend leaving that as is, or is there a way to look at the stem of the word somehow?

If I have to look up 'is' in "he is x" and 'are' in "they are y" then I wouldn't really have a problem with that because I obviously don't know the word very well, the sentence context being there would make them different enough for me.

That said, it would depend on your dictionary. If you look up those 2 words chances are the headword in the dict will just be "to be" for both, so you could get around this with one of the provided extensions: https://github.com/Ajatt-Tools/anki.koplugin/blob/master/extensions/EXT_dict_word_lookup.lua

Instead of saving "are" and "is" it would save "to be" for both, which would hopefully be good enough to get the duplicate detection you want. I hid this in the extensions but maybe this should be part of the main config, it comes up pretty often

Is there any way to have put in a definition on the same card from the second dictionary? I have multiple dictionaries installed and it'd be good to have two dictionaries saved as default.

There's an extension for that as well: https://github.com/Ajatt-Tools/anki.koplugin/blob/master/extensions/EXT_multi_def.lua

You will have to update the mapping in there for it to work though:

dict_field_map = {
-- the below example sends dictionary entries from 'JMdict' to the field 'SentEng' on the anki note
-- ["JMdict Rev. 1.9"] = "SentEng",

You have to add the dictionaries (with the name as they appear in the koreader settings), together with the field you want to send them too, if you want to add multiple dicts to the same field you could do something like

local MultiDefinition = {
    description = "When trying to make the monolingual transition, it can be helpful to create a card with the language in your target language, while still also inserting the definition in your native language in a separate field.",
    -- key: dictionary name as displayed in KOreader (received from dictionary's .ifo file)
    -- value: field on the note this dictionary entry should be sent to
    dict_field_map = {
        ["One of my dictionaries"] = "Definition Field",
        ["Another dictionary here"] = "Definition Field",
    }
}

So i actually had the extensions already enabled by the config file, I have uncommented the code so it looks like this

  -- The plugin can query Forvo for audio of the word you just looked up.
   -- The field name where the audio will be sent to.
   --audio_field = "VocabAudio",

   -- list of extensions which should be enabled, by default they are all off
   -- an extension is turned on by listing its filename in the table below
   enabled_extensions = {
       [[
       "EXT_dict_edit.lua",
       "EXT_dict_word_lookup.lua",
       "EXT_multi_def.lua",
       "EXT_pitch_accent.lua"
       ]]
   }

however multidictionaries nor the stem of the word is saving. I understand why multi dictionaries isnt saving as I did not edit the plugin but do I need to edit the dict_word_lookup file in order for it to work for me? For reference I am learning french so maybe thats why?

@nairyosangha
Copy link
Member

So i actually had the extensions already enabled by the config file, I have uncommented the code so it looks like this

  -- The plugin can query Forvo for audio of the word you just looked up.
   -- The field name where the audio will be sent to.
   --audio_field = "VocabAudio",

   -- list of extensions which should be enabled, by default they are all off
   -- an extension is turned on by listing its filename in the table below
   enabled_extensions = {
       [[
       "EXT_dict_edit.lua",
       "EXT_dict_word_lookup.lua",
       "EXT_multi_def.lua",
       "EXT_pitch_accent.lua"
       ]]
   }

however multidictionaries nor the stem of the word is saving. I understand why multi dictionaries isnt saving as I did not edit the plugin but do I need to edit the dict_word_lookup file in order for it to work for me? For reference I am learning french so maybe thats why?

That would be because of the surrounding [[ ]] bracket, turning it into a single multi line string, which silently gets ignored when we try loading it. It has to be like this:

  -- The plugin can query Forvo for audio of the word you just looked up.
   -- The field name where the audio will be sent to.
   --audio_field = "VocabAudio",

   -- list of extensions which should be enabled, by default they are all off
   -- an extension is turned on by listing its filename in the table below
   enabled_extensions = {
       "EXT_dict_edit.lua",
       "EXT_dict_word_lookup.lua",
       "EXT_multi_def.lua",
       "EXT_pitch_accent.lua"
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants