albertauyeung / albertauyeung.github.io

Homepage
https://albertauyeung.github.io/
0 stars 1 forks source link

Generating N-grams from Sentences in Python - Albert Au Yeung #6

Closed albertauyeung closed 9 months ago

albertauyeung commented 4 years ago

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...

Martinsbane commented 4 years ago

Awesome, is there a way you can count the occurrence of a word or phrase after generating n-grams?

albertauyeung commented 4 years ago

@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).

Martinsbane commented 4 years ago

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 .