Конструирование признаков для NLP на Python
Rounak Banik
Data Scientist
| отзыв | метка |
|---|---|
'The movie was good and not boring' |
положительная |
'The movie was not good and boring' |
отрицательная |
'for you a thousand times over'
[
'for you',
'you a',
'a thousand',
'thousand times',
'times over'
]
'for you a thousand times over'
[
'for you a',
'you a thousand',
'a thousand times',
'thousand times over'
]
Генерирует только биграммы.
bigrams = CountVectorizer(ngram_range=(2,2))
Генерирует униграммы, биграммы и триграммы.
ngrams = CountVectorizer(ngram_range=(1,3))
Конструирование признаков для NLP на Python