Reputation: 720
I am using python 2.7, I am trying to get synonyms of Arabic words using Arabic WordNet
I downloaded both needed files:
AWNDatabaseManagement.py upc_db.xml
Its working fine when I enter the word itself not using a variable
outputs In Backwalter form but I managed to translate them to arabic:
But the problem is that I want to loop on a set of words, but I get the following error
Upvotes: 1
Views: 613
Reputation: 23064
I'm not familiar with the package that AWNDatabaseManagement
comes from, but from reading your question it seems to be the case that wm.get_synsetids_from_word()
will return None
when it can't find any results. (I don't know what "synsetids" are either.)
To avoid your error you can do this:
synsets = wn.get_synsetids_from_word(xxx) or []
This will assign the empty list []
to synsets
only in the cases where the function returns None
. Since an empty list is iterable, you will not get a typeerror when looping over it.
Upvotes: 2