Это похоже на ответ YOLO выше, но позволяет использовать несколько текстовых классов.
df = pd.DataFrame(
data = ["good,i am interested..please mail me.",
"call me...good to go with you",
"not interested...bye",
"i am not interested don't call me",
"price is too high so not interested",
"i have some requirement..please mail me"],
columns=['text'], index=[1,2,3,4,5,6])
d1 = {'no': ['Not interested','nt interested','not interested'],
'maybe': ['requirement']}
df['is_relevant'] = 'yes'
for k in d1:
match_inds = reduce(lambda x,y: x | y,
[df['text'].str.contains(pat) for pat in d1[k]])
df.loc[match_inds, 'is_relevant'] = k
print(df)
Вывод
text is_relevant
1 good,i am interested..please mail me. yes
2 call me...good to go with you yes
3 not interested...bye no
4 i am not interested don't call me no
5 price is too high so not interested no
6 i have some requirement..please mail me maybe