I’m trying to use scikit.learn which needs numpy/scipy arrays for input.
The featureset generated in nltk consists of unigram and bigram frequencies. I could do it manually, but that’ll be a lot of effort. So wondering if there’s a solution i’ve overlooked.
I’m trying to use scikit.learn which needs numpy/scipy arrays for input. The featureset generated
Share
Not that I know of, but note that scikit-learn can do n-gram frequency counting itself. Assuming word-level n-grams:
where
filesis a list of strings or file-like objects. After this,Xis a scipy.sparse matrix of raw frequency counts.