Quantcast
Channel: n-grams in python, four, five, six grams? - Stack Overflow
Viewing all articles
Browse latest Browse all 18

n-grams in python, four, five, six grams?

$
0
0

I'm looking for a way to split a text into n-grams.Normally I would do something like:

import nltkfrom nltk import bigramsstring = "I really like python, it's pretty awesome."string_bigrams = bigrams(string)print string_bigrams

I am aware that nltk only offers bigrams and trigrams, but is there a way to split my text in four-grams, five-grams or even hundred-grams?

Thanks!


Viewing all articles
Browse latest Browse all 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>