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

"Language is not supported." #26

Open
tezer opened this issue Jun 22, 2020 · 1 comment
Open

"Language is not supported." #26

tezer opened this issue Jun 22, 2020 · 1 comment

Comments

@tezer
Copy link

tezer commented Jun 22, 2020

Hi
I am trying to use Wordnet for Finnish, but it looks like there is no Finnish data downloaded with the package.
This code produces an error below.

from wn import WordNet
from wn.constants import wordnet_30_dir
fin_wn = WordNet(wordnet_30_dir)
print(fin_wn.langs())
fin_wn.synsets(lemma, lang=lang)
4135382db444:python -u /opt/project/task_generation/generator.py
['eng']
Traceback (most recent call last):
  File "/opt/project/task_generation/generator.py", line 18, in <module>
    search_wn('cat', 'n', 'fin')
  File "/opt/project/task_generation/generator.py", line 10, in search_wn
    res = fin_wn.synsets(lemma, lang=lang)
  File "/usr/local/lib/python3.8/site-packages/wn/__init__.py", line 154, in synsets
    self._load_lang_data(lang)
  File "/usr/local/lib/python3.8/site-packages/wn/omw.py", line 79, in _load_lang_data
    raise WordNetError("Language is not supported.")
NameError: name 'WordNetError' is not defined

Do I need to install language-specific packages separately?

@goodmami
Copy link
Collaborator

@tezer I think the wordnet_30_dir is for the Princeton WordNet 3.0, which is just English. The Open Multilingual Wordnet (OMW) is what you want, so use the omw_dir variable instead. Also note that this project is not being maintained, so you might have better luck with https://github.com/goodmami/wn/ (disclaimer: I'm the author). Here's an example (using that project) to download and use the Finnish wordnet:

>>> import wn
>>> wn.download('finwn')
[...]
>>> for w in wn.words(lang='fi')[:10]:
...     print(w.lemma())
... 
entiteetti
kokonaisuus
fyysinen entiteetti
abstrahointi
käsitteellistäminen
abstrakti entiteetti
esine
fyysinen esine
samanlainen
elävä olio

If this solves your problem, feel free to close this issue.

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