1. 程式人生 > >list 轉換成dictionary,並統計詞頻

list 轉換成dictionary,並統計詞頻

counter times 詞頻 ont mil mes 轉換成 new size

>>> from collections import Counter
>>> Counter([‘apple‘,‘red‘,‘apple‘,‘red‘,‘red‘,‘pear‘])
Counter({‘red‘: 3, ‘apple‘: 2, ‘pear‘: 1})

? ?

? ?

? ?

list 轉換成dictionary,並統計詞頻