gensim报错:AttributeError: The vocab attribute was removed from KeyedVector in Gensim 4.0.0.
Use KeyedVector’s .key_to_index dict, .index_to_key list, and methods .get_vecattr(key, attr) and .set_vecattr(key, attr, new_val) instead.
cut_list[i] = cn_model.vocab[word].index
# 将词转换为索引index
cut_list[i] = cn_model.vocab[word].index
参考报错内容,修改为以下内容即可,
cut_list[i] = cn_model.key_to_index [word]
# 将词转换为索引index
cut_list[i] = cn_model.key_to_index [word]