libindic / indic-trans

The project aims on adding a state-of-the-art transliteration module for cross transliterations among all Indian languages including English.
GNU Affero General Public License v3.0
258 stars 61 forks source link

initialisation error of Transliterator #41

Closed raahulrawat closed 5 years ago

raahulrawat commented 5 years ago

trn = Transliterator(source='hin', target='eng', build_lookup=True)


ValueError Traceback (most recent call last)

in ----> 1 trn = Transliterator(source='hin', target='eng', build_lookup=True) /usr/local/lib/python3.6/dist-packages/indictrans/transliterator.py in __init__(self, source, target, decode, build_lookup, rb) 89 'Language pair `%s-%s` is not implemented.' % 90 (source, target)) ---> 91 i2o = Ind2Target(source, target, decoder, build_lookup) 92 self.transform = _get_trans(i2o, decode) 93 else: /usr/local/lib/python3.6/dist-packages/indictrans/script_transliterate.py in __init__(self, source, target, decoder, build_lookup) 20 target, 21 decoder, ---> 22 build_lookup) 23 self.letters = set(string.ascii_letters) 24 self.non_alpha = re.compile(r"([^a-zA-Z%s]+)" % (self.esc_ch)) /usr/local/lib/python3.6/dist-packages/indictrans/base.py in __init__(self, source, target, decoder, build_lookup) 67 self.esc_ch = '\x00' # escape-sequence for Roman in WX 68 self.dist_dir = os.path.dirname(os.path.abspath(__file__)) ---> 69 self.base_fit() 70 71 def load_models(self): /usr/local/lib/python3.6/dist-packages/indictrans/base.py in base_fit(self) 115 def base_fit(self): 116 # load models --> 117 self.load_models() 118 # load mapping tables for Urdu 119 if 'urd' in [self.source, self.target]: /usr/local/lib/python3.6/dist-packages/indictrans/base.py in load_models(self) 78 '%s/models/%s/classes.npy' % 79 (self.dist_dir, model), ---> 80 encoding='latin1')[0] 81 self.coef_ = np.load( 82 '%s/models/%s/coef.npy' % (self.dist_dir, model), /usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding) 445 else: 446 return format.read_array(fid, allow_pickle=allow_pickle, --> 447 pickle_kwargs=pickle_kwargs) 448 else: 449 # Try a pickle /usr/local/lib/python3.6/dist-packages/numpy/lib/format.py in read_array(fp, allow_pickle, pickle_kwargs) 690 # The array contained Python objects. We need to unpickle the data. 691 if not allow_pickle: --> 692 raise ValueError("Object arrays cannot be loaded when " 693 "allow_pickle=False") 694 if pickle_kwargs is None: ValueError: Object arrays cannot be loaded when allow_pickle=False
raahulrawat commented 5 years ago

Issue resolved. there is a error with numpy version. i had to downgrade my numpy version to 1.16.1 and now it is working fine...

Thanks