When I am calling cleanReview function, it is showing the above error for the line review=review.lower()
'numpy.ndarray' object has no attribute 'lower'
from nltk.tokenize import RegexpTokenizer from nltk.stem.porter import PorterStemmer from nltk.corpus import stopwords import sys tokenizer=RegexpTokenizer(r’\w+’) en_stopwords=set(stopwords.words(‘english’)) ps=PorterStemmer() def getCleanReview(review): review=review.lower() review=review.replace("
"," ") # Tokenize tokens=tokenizer.tokenize(review) new_tokens=[token for token in tokens if token not in en_stopwords] stemmed_tokens=[ps.stem(token) for token in new_tokens] cleaned_review=’ '.join(stemmed_tokens) return cleaned_review
The code is the same used by prateek bhaiya in the last video. From scikit learn
That is in Mutivariate Bernoulli Event Model
Yeah the code maybe the same but there must be some error ,so I need to look at your .ipynb file. Please upload your notebook on google drive and then share the link here.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.