我有符號化的文本句子的列表(YouTube評論)元素:使用collections.Counter來計數子列表
sample_tok = [['How', 'does', 'it', 'call', 'them', '?', '\xef\xbb\xbf'],
['Thats', 'smart\xef\xbb\xbf'],
... # and sooo on.....
['1:45', ':', 'O', '\xef\xbb\xbf']]
現在我想和單詞的字典,他們提到的時間量。
from collections import Counter
d = Counter()
for sent in [sample_tok]:
for words in sent:
d = Counter(words)
不幸的是,這只是計數的最後子表...
[(':', 1), ('1:45', 1), ('\xef\xbb\xbf', 1), ('O', 1)]
有沒有辦法讓它統計所有標記化的句子?