Python 中的 NLP 特征工程
Rounak Banik
Data Scientist
| review | label |
|---|---|
'The movie was good and not boring' |
positive |
'The movie was not good and boring' |
negative |
'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))
Python 中的 NLP 特征工程