How do you perform Bag ofWords(BoW) in Python without using CountVectorizer ? | Sololearn: Learn to code for FREE!

+1

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

5/15/2022 10:50:10 AM

Jaz

5 Answers

New Answer

+2

Jaz , may be you should read this first before starting any coding try. https://www.journaldev.com/46591/bag-of-words-model-in-python https://vitalflux.com/text-classification-bag-of-words-model-python-sklearn/ https://www.analyticsvidhya.com/blog/2021/08/a-friendly-guide-to-nlp-bag-of-words-with-python-example/

+1

You can use collections.Counter(). https://docs.python.org/3/library/collections.html#collections.Counter

+1

Why wouldn't you want to use CountVectorizer? Wouldn't that just end up with less functionality? Just asking.

+1

Bob_Li because we were asked by our professor to find an alternative for CountVectorizer in our assignment.

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