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
35 stars 20 forks source link

I am new to pyiwn. 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 <undefined>.please help me as soon as possible. #14

Closed mahemicro96 closed 5 years ago

mahemicro96 commented 5 years ago

iwn = pyiwn.IndoWordNet() 2019-10-04:13:09:42,355 INFO [iwn.py:43] Loading hindi language synsets... Traceback (most recent call last): File "<pyshell#2>", line 1, in iwn = pyiwn.IndoWordNet() File "C:\Users\mahe\AppData\Local\Programs\Python\Python37\lib\site-packages\pyiwn\iwn.py", line 45, in init self._synset_df = self._load_synset_file(lang.value) File "C:\Users\mahe\AppData\Local\Programs\Python\Python37\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:\Users\mahe\AppData\Local\Programs\Python\Python37\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

mahemicro96 commented 5 years ago

finally i found the solution.i add the encoding="utf-8" to line 50 in iwn.py .(i.e)replaced by f = open(filename,encoding='utf-8') File "C:\Users\mahe\AppData\Local\Programs\Python\Python37\lib\site-packages\pyiwn\iwn.py", line 51, in _load_synset_file