You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
624 B

'''
conda activate rag
pip install gensim[complete]
pip install jieba
'''
from Util.EmbeddingUtil import *
from Config.Config import *
# 在加载模型后添加自定义词典
jieba.load_userdict("./Dict/custom_dict.txt") # 文件中包含: 花呗
sentences = ['如何更换花呗绑定银行卡', '花呗更改绑定银行卡']
for sentence in sentences:
x = text_to_embedding(sentence)
# 词汇数+向量维度
with open(WORD2VEC_MODEL_PATH, 'r', encoding='utf-8') as f:
print("词汇数和向量维度:" + f.readline()) # 第一行为词汇数和向量维度,在这里不予展示