How do you perform Bag ofWords(BoW) in Python without using CountVectorizer ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you perform Bag ofWords(BoW) in Python without using CountVectorizer ?

15th May 2022, 10:50 AM
Jaz
Jaz - avatar
5 Answers
+ 1
You can use collections.Counter(). https://docs.python.org/3/library/collections.html#collections.Counter
15th May 2022, 11:52 AM
Simon Sauter
Simon Sauter - avatar
+ 1
Why wouldn't you want to use CountVectorizer? Wouldn't that just end up with less functionality? Just asking.
16th May 2022, 12:45 AM
Bob_Li
Bob_Li - avatar
+ 1
Bob_Li because we were asked by our professor to find an alternative for CountVectorizer in our assignment.
16th May 2022, 1:13 AM
Jaz
Jaz - avatar
0
kung-fu training for programmers 😁 you have to replace CountVectorizer with something else. maybe this? Count Vectorizer vs TFIDF Vectorizer | Natural Language Processing https://www.linkedin.com/pulse/count-vectorizers-vs-tfidf-natural-language-processing-sheel-saket https://neptune.ai/blog/vectorization-techniques-in-nlp-guide
16th May 2022, 3:32 AM
Bob_Li
Bob_Li - avatar