Open arunbaby0 opened 3 years ago
The same error pops up when I try to perform syllabification too.
from indicnlp.syllable import syllabifier
w='जगदीशचंद्र'
lang='hi'
syllabifier.orthographic_syllabify(w,lang)
It returns
line 170, in get_phonetic_feature_vector
if phonetic_data.iloc[offset]['Valid Vector Representation']==0:
AttributeError: 'NoneType' object has no attribute 'iloc'
I was able to resolve the above issue. Please refer to the colab notebook below to see how I have resolved the issue.
https://colab.research.google.com/drive/1Ql9MTmCK1Eqg_uMKDYFgx_f5-N4O5K43#scrollTo=MdUXca0tnFcF
just add the following lines and execute it before running your code.
from indicnlp import loader loader.load()
it works fine!!
Similarity between क and ख Traceback (most recent call last): File "test.py", line 224, in
isc.get_phonetic_feature_vector(c1, lang),
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/indicnlp/script/indic_scripts.py", line 186, in get_phonetic_feature_vector
if phonetic_data.iloc[offset]['Valid Vector Representation'] == 0:
AttributeError: 'NoneType' object has no attribute 'iloc'
ALL_PHONETIC_DATA=pd.read_csv(os.path.join(common.get_resources_path(),'script','all_script_phonetic_data.csv'),encoding='utf-8')
looks like this file is not getting loaded properly.
`from indicnlp.script import indic_scripts as isc # nopep8 from indicnlp.script import phonetic_sim as psim # nopep8
c1 = 'क' c2 = 'ख' lang = 'hi'
print('Similarity between {} and {}'.format(c1, c2)) print(psim.cosine( isc.get_phonetic_feature_vector(c1, lang), isc.get_phonetic_feature_vector(c2, lang) ))`
I have exported: global INDIC_RESOURCES_PATH INDIC_RESOURCES_PATH = "/Users/arunbaby/indic_nlp_resources" global PYTHONPATH PYTHONPATH = "$PYTHONPATH:/Users/arunbaby/src"