Spacy textblob sentiment analysis very slow on a 500 rows dataset #12401
-
Hi, I was wondering how I can speed up the sent analysis with spacy textblob on a dataset with 500 rows, The sentiment analysis I applied is on the 'Review'' column. It takes a while, more than 10 minutes. I will show below the code I applied: `# Sentiment Analysis with spacy
`# test the sentiment analysis function creating a new column with the sentiment score and label sample_data['sentiment_score'], sample_data['sentiment_label'] = zip(*sample_data['Review'].apply(sentiment_analysis))` Hope there is a way to speed up the implementation. I tried to use the multiple cores processing but nothing, still slow. Thanks, Marcello |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You are loading the model in each call to
This should already speed things up a fair bit (I am assuming that A further optimization would be using |
Beta Was this translation helpful? Give feedback.
You are loading the model in each call to
sentiment_analysis
and loading the model takes a fair amount of time. I'd suggest taking the model load out of the function and passing the model in as an argument: