代码问题
来源:6-7 数据处理-句子编码化处理(句子和向量之间的转换)

慕瓜2168979
2018-11-01
if isinstance(max_features, int):
count = sorted(list(count.items()), key=lambda x: x[1])
if max_features is not None and len(count) > max_features:
count = count[-int(max_features):]
for w, _ in count:
self.dict[w] = len(self.dict)
else:
for w in sorted(count.keys()):
self.dict[w] = len(self.dict)
self.fited = True
这段代码什么意思?是什么作用?
写回答
1回答
-
Mr_Ricky
2019-04-29
这个实际上就是讲如何训练和生成这个word的词典
012019-11-17
相似问题