langid - classify error language identification

1k Views Asked by At

I am trying to classify several languages from a combination of tweets texts. I am getting classify import error.

import langid

df1 = pd.read_csv(old_dir+"\\"+"merged_all_csv.csv", sep=',',encoding = "ISO-8859-1",error_bad_lines = False)
        tweetText = df1.TweetText
        for t in tweetText:
            x = langid.classify(str(t))
            if lang_dict[x[0]] not in lang:
                lang[lang_dict[x[0]]] = 1
            else:
                lang[lang_dict[x[0]]] = lang[lang_dict[x[0]]] + 1

        for k, v in lang.items():
            df.set_value(q, 'Language', k)
            df.set_value(q, 'Count', v)
            q = q + 1

        df.to_csv(new_dir+'\\Language_count.csv', sep=',', index=False)

Error:

from langid import classify, rank, set_languages

ImportError: cannot import name 'classify'

I have updated the packages and still the error is persistent. How to solve this error ?

0

There are 0 best solutions below