anoopkunchukuttan / indic_nlp_library

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

AttributeError: 'NoneType' object has no attribute 'iloc' #60

Closed AlvinKimata closed 1 year ago

AlvinKimata commented 1 year ago

I am trying to perform Orthographic Syllabification, however, I have run into an error:

AttributeError                            Traceback (most recent call last)
[<ipython-input-9-9f5f7217ed93>](https://localhost:8080/#) in <module>
      3 lang='hi'
      4 
----> 5 print(' '.join(syllabifier.orthographic_syllabify(text,lang)))

2 frames
[/usr/local/lib/python3.9/dist-packages/indicnlp/syllable/syllabifier.py](https://localhost:8080/#) in orthographic_syllabify(word, lang, vocab)
    213 def orthographic_syllabify(word,lang,vocab=None):
    214 
--> 215     p_vectors=[si.get_phonetic_feature_vector(c,lang) for c in word]
    216 
    217     syllables=[]

[/usr/local/lib/python3.9/dist-packages/indicnlp/syllable/syllabifier.py](https://localhost:8080/#) in <listcomp>(.0)
    213 def orthographic_syllabify(word,lang,vocab=None):
    214 
--> 215     p_vectors=[si.get_phonetic_feature_vector(c,lang) for c in word]
    216 
    217     syllables=[]

[/usr/local/lib/python3.9/dist-packages/indicnlp/script/indic_scripts.py](https://localhost:8080/#) in get_phonetic_feature_vector(c, lang)
    168     phonetic_data, phonetic_vectors= get_phonetic_info(lang)
    169 
--> 170     if phonetic_data.iloc[offset]['Valid Vector Representation']==0:
    171         return invalid_vector()
    172 

AttributeError: 'NoneType' object has no attribute 'iloc'

I am using indic-nlp-library version 0.91

AlvinKimata commented 1 year ago

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