anoopkunchukuttan / indic_nlp_library

Resources and tools for Indian language Natural Language Processing
http://anoopkunchukuttan.github.io/indic_nlp_library/
MIT License
552 stars 161 forks source link

AttributeError: 'NoneType' object has no attribute 'ix' #20

Closed Lalit11 closed 4 years ago

Lalit11 commented 5 years ago

Getting an error after running the code "--> 180 if phonetic_data.ix[offset,'Valid Vector Representation']==0:" It is showing error in above line . Thank You

anoopkunchukuttan commented 5 years ago

What error are you getting?

Lalit11 commented 5 years ago

AttributeError Traceback (most recent call last) in 9 print('Similarity between {} and {}'.format(c1,c2)) 10 print(psim.cosine(---> 11 isc.get_phonetic_feature_vector(c1,lang), 12 isc.get_phonetic_feature_vector(c2,lang) 13 )) ~\Anaconda3\lib\site-packages\indicnlp\script\indic_scripts.py in get_phonetic_feature_vector(c, lang) 178 phonetic_data, phonetic_vectors= get_phonetic_info(lang) 179 --> 180 if phonetic_data.ix[offset,'Valid Vector Representation']==0: 181 return invalid_vector() 182 AttributeError: 'NoneType' object has no attribute 'ix'

sir above is the error code i am getting .

On Tue, Apr 30, 2019 at 6:17 PM Anoop Kunchukuttan notifications@github.com wrote:

What error are you getting?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/anoopkunchukuttan/indic_nlp_library/issues/20#issuecomment-487938531, or mute the thread https://github.com/notifications/unsubscribe-auth/AKVBRQNHW3ONLOCNL4JHVTTPTA5XNANCNFSM4HJJZAZQ .

neerajvashistha commented 4 years ago

In all the below places .ix has to be replaced with .iloc with new pandas framework .ix is no longer supported.

script/indic_scripts.py:106:    ALL_PHONETIC_VECTORS= ALL_PHONETIC_DATA.ix[:,PHONETIC_VECTOR_START_OFFSET:].as_matrix()
script/indic_scripts.py:107:    TAMIL_PHONETIC_VECTORS=TAMIL_PHONETIC_DATA.ix[:,PHONETIC_VECTOR_START_OFFSET:].as_matrix()
script/indic_scripts.py:170:    if phonetic_data.ix[offset,'Valid Vector Representation']==0: 
script/indic_scripts.py:182:    if phonetic_data.ix[offset,'Valid Vector Representation']==0: 
script/phonetic_sim.py:43:def create_similarity_matrix(sim_func,slang,tlang,normalize=True):
script/english_script.py:102:    ENGLISH_PHONETIC_VECTORS=ENGLISH_PHONETIC_DATA.ix[:,PHONETIC_VECTOR_START_OFFSET:].as_matrix()
script/english_script.py:150:    if phonetic_data.ix[offset,'Valid Vector Representation']==0: 
anoopkunchukuttan commented 4 years ago

Fixed with Neeraj's help. My earlier fix was partial, applied to iniy() method only.