Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arunbaby0 opened this issue May 21, 2021 · 3 comments
Open

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

arunbaby0 opened this issue May 21, 2021 · 3 comments

Comments

@arunbaby0
Copy link

arunbaby0 commented May 21, 2021

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"

@kavyamanohar
Copy link

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'

@AlvinKimata
Copy link

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

@ghost
Copy link

ghost commented May 16, 2023

just add the following lines and execute it before running your code.

from indicnlp import loader
loader.load()

it works fine!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants