I have a pandas dataframe which contains review texts. After text preprocessing I ended up with list of strings in each row. Now I want to iterate over each row of these lists of strings to check whether each string is in english or not. I want to count occurrences of non-english words to create another column "Occurrences".
For english language checking I will use pyenchant library.
Something similar to the code below
review_text sentiment error_related
0 [simple, effective, way, new, word, kid] 1 NaN
1 [fh, fcfatgv] 1 NaN
2 [son, loved, easy, even, though, son, first, g... 1 NaN
english_dict = enchant.Dict("en_US")
def enlgish_counter(df, df_text_column):
number_of_non_english_words = []
for review in df_text_column:
for word in review:
a=0
if english_dict.check(i)==False:
a=a+1
non_english_words.append(a)