Python 中文本特徵工程
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'
]
只產生 bigram。
bigrams = CountVectorizer(ngram_range=(2,2))
產生 unigram、bigram 與 trigram。
ngrams = CountVectorizer(ngram_range=(1,3))
Python 中文本特徵工程