Consider I have to apply CountVectorizer() on the following data:
words = [
'A am is',
'This the a',
'the am is',
'this a am',
]
I did the following:
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(corpus)
print(X.toarray())
It returns the following:
[[1 1 0 0]
[0 0 1 1]
[1 1 1 0]
[1 0 0 1]]
For reference print(vectorizer.get_feature_names()) prints ['am', 'is', 'the', 'this']
Why is 'a' not being read??
Is it that single letter words don't count as words in CountVectorizer()