cfiltnlp / pyiwn

A Python based API to access Indian language WordNets.
http://www.cfilt.iitb.ac.in/
Creative Commons Attribution Share Alike 4.0 International
34 stars 19 forks source link

Update iwn.py #21

Closed sushant-bahekar closed 2 years ago

sushant-bahekar commented 3 years ago

I am install pyiwn via pip.iwn=pyiwn.IndoWordNet() comment give the ERROR:'charmap' codec can't decode byte 0x8d in position 13: character maps to We can solve this by adding add the encoding="utf-8" to line 50 in iwn.py .(i.e)replaced by f = open(filename,encoding='utf-8')

SandipSPatil commented 3 years ago

I have installed Python 3.7.9 and pyiwn when I am compiling the command iwn = pyiwn.IndoWordNet() it is giving the error

2020-08-29:18:23:53,760 INFO [iwn.py:43] Loading hindi language synsets... Traceback (most recent call last): File "<pyshell#1>", line 1, in iwn = pyiwn.IndoWordNet() File "C:\Python\lib\site-packages\pyiwn\iwn.py", line 45, in init self._synset_df = self._load_synset_file(lang.value) File "C:\Python\lib\site-packages\pyiwn\iwn.py", line 51, in _load_synset_file synsets = list(map(lambda line: self._load_synset(line), f.readlines())) File "C:\Python\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 13: character maps to

We can solve this issue by adding the encoding ='utf-8' to line no 50 in iwn.py i.e replaced by f=open(filename,encoding='utf-8') in the setup.

SandipSPatil commented 3 years ago

I have installed Python 3.7.9 and pyiwn when I am compiling the command iwn = pyiwn.IndoWordNet() it is giving the error

2020-08-29:18:23:53,760 INFO [iwn.py:43] Loading hindi language synsets... Traceback (most recent call last): File "<pyshell#1>", line 1, in iwn = pyiwn.IndoWordNet() File "C:\Python\lib\site-packages\pyiwn\iwn.py", line 45, in init self._synset_df = self._load_synset_file(lang.value) File "C:\Python\lib\site-packages\pyiwn\iwn.py", line 51, in _load_synset_file synsets = list(map(lambda line: self._load_synset(line), f.readlines())) File "C:\Python\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 13: character maps to

We can solve this issue by adding the encoding ='utf-8' to line no 50 in iwn.py i.e replaced by f=open(filename,encoding='utf-8') in the setup.

update iwn.py