0
基本上我有名单(整个棕色语料库)。为什么在将列表转换为Python中的字典时大小发生了变化?
dic1=brown.words()
print 'Total size of Brown Corpus :'
print len(dic1)
输出是:
Total size of Brown Corpus :
1161192
我转化该列表的字典使得所有的值2,并检查了尺寸。
dic=dict((k,2) for k in dic1)
print 'Size of the dict:'
print len(dic)
,并得到这样的输出:
Size of the dict:
56057
字典包含:(key:2)
。因此,如果列表中没有1161192字,则字典中也应该有相同数量的条目。为什么尺寸会改变?