stopwords list problem
Hi Maarteen,
My regular code started to give an error and I don't know why, I never changed anything. I have my own stopwords list, this is the code and below you can see the error.
Reduce dimensionality
umap_model = UMAP(n_neighbors=50, n_components=10, metric='cosine', low_memory=False)
Cluster reduced embeddings
hdbscan_model = HDBSCAN(min_cluster_size=45, metric='euclidean', cluster_selection_method='eom', prediction_data=True, min_samples=5)
Tokenize topics
vectorizer_model = CountVectorizer(stop_words=stopwords) # stopwords'ü burada çıkarıyoruz
Create topic representation
ctfidf_model = ClassTfidfTransformer()
topic_model = BERTopic(calculate_probabilities=True, verbose=True, vectorizer_model=vectorizer_model, embedding_model="all-MiniLM-L6-v2", min_topic_size=100, nr_topics='auto', umap_model=umap_model, hdbscan_model=hdbscan_model, ctfidf_model=ctfidf_model)
topics, probs = topic_model.fit_transform(docs)
I really need your urgent reply. Thanks in advance,

Your stopwords variable is a set of words, whereas the vectorizer only accepts a list of strings.
I really appreciate your quick reply, I understand the error but i've never changed anything. it was working fine till today. How can i make it work?
import spacy en = spacy.load('en_core_web_sm') stopwords = en.Defaults.stop_words
#light cleaning my_stop_words= {'alexa', 'echo', 'one', 'show' ,'echoshow', 'echo show', '/alexa', 'alexa.', 'alexa..', 'alexas', 'alexa.echo', 'echos', 'echoes', 'amazon', "'Alexa"} (i shortened the list on purpose)
stopwords.update(my_stop_words)
What might have happened is that a package version has been updated between sessions. Did you make sure that all packages have exactly the same version between sessions? In other words, did you version control your code and environment?
How can i make it work?
As I mentioned, have you tried making a list out of stopwords seeing as the error message mentions that explicitly.
Thank you Maarteen, package version should have created the problem. I'll retry. Thank you.