代码问题

来源: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的词典

0
1
weixin_慕斯卡0236420
count 在这里代表什么呢
2019-11-17
共1条回复

NLP实践TensorFlow打造聊天机器人

解析自然语言处理( NLP )常用技术,从0搭建聊天机器人应用并部署上线,可用于毕设。

673 学习 · 281 问题

查看课程

相似问题