Closed albertauyeung closed 9 months ago
Awesome, is there a way you can count the occurrence of a word or phrase after generating n-grams?
@Martinsbane you can use the CountVectorizer
in scikit-learn
to do that (https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html).
Thanks a lot, kind of a noob and don't know my way around. Thanks again
On Sun, 13 Sep 2020, 03:05 Albert Au Yeung, notifications@github.com wrote:
@Martinsbane https://github.com/Martinsbane you can use the CountVectorizer in scikit-learn to do that ( https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html ).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/albertauyeung/albertauyeung.github.io/issues/6#issuecomment-691592478, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWSPIUAEMGGVYMAJL7TQBLSFQSHHANCNFSM4MZUD6BQ .
https://albertauyeung.github.io/2018/06/03/generating-ngrams.html
N-grams are contiguous sequences of n-items in a sentence. N can be 1, 2 or any other positive integers, although usually we do not consider very large N bec...