BoboTiG / ebook-reader-dict

Finally decent dictionaries based on Wiktionary for your beloved eBook reader.
http://www.tiger-222.fr/?d=2020/04/17/22/14/21-un-dictionnaire-alternatif-et-complet-pour-votre-liseuse
MIT License
386 stars 21 forks source link

[PT] Error with 'prenome' #1340

Closed BoboTiG closed 2 years ago

BoboTiG commented 2 years ago
$ python -m wikidict pt --get-word prenome
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "__main__.py", line 127, in <module>
    sys.exit(main())
  File "__main__.py", line 98, in main
    return get_word.main(args["LOCALE"], args["--get-word"], raw=args["--raw"])
  File "get_word.py", line 82, in main
    get_and_parse_word(word, locale, raw)
  File "get_word.py", line 38, in get_and_parse_word
    details = get_word(word, locale)
  File "get_word.py", line 17, in get_word
    return parse_word(word, code, locale, force=True)
  File "render.py", line 352, in parse_word
    etymology = find_etymology(word, locale, etyl_data[0])
  File "render.py", line 186, in find_etymology
    definitions.append(process_templates(word, clean(etyl), locale))
  File "utils.py", line 453, in process_templates
    text = text.replace(tpl, transform(word, tpl[2:-2], locale))
  File "utils.py", line 613, in transform
    return str(transform_apply(word, tpl, tuple(parts), locale))
  File "/.../python3.10/site-packages/cachetools/__init__.py", line 641, in wrapper
    v = func(*args, **kwargs)
  File "utils.py", line 629, in transform_apply
    return str(last_template_handler[locale](parts, locale, word=word))
  File "lang/pt/__init__.py", line 253, in last_template_handler
    return langs[parts[0]]
KeyError: 'ine-pro'
lasconic commented 2 years ago

It seems our update script for pt-langs doesn't catch all the possible languages for the etm template :). Let's see.

lasconic commented 2 years ago

To be right we would need to get the languages from

lasconic commented 2 years ago

I'm not even sure wiktionary would let us do that. It needs to hit more than 1400 pages... We could extract it from a dump instead, or go the easy route and add the missing language at the end of pt/langs.py like we did previously...

BoboTiG commented 2 years ago

1,400 pages ... Yeah, let's go with the lazy approach 👍