0
votes

Is there a bug in Python 2.7.3 in sklearn CountVectorizer? A previous post mentioned an earlier bug. Here is my simple input and I get a TypeError.

>>> from sklearn.feature_extraction.text import CountVectorizer
>>> ngram_vectorizer = CountVectorizer(analyzer='char_wb', ngram_range=(2, 2))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: __init__() got an unexpected keyword argument 'ngram_range'
1

1 Answers

2
votes

It is possible that you have an older version of sklearn installed. The keyword argument ngram_range is introduced in version 0.12 (e.g. does not exist in version 0.11).