赞
踩
pip install bert-serving-server
pip install bert-serving-client
bert中文模型链接:https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip
(pycharm Terminal命令行)
bert-serving-start -model_dir E:\bert\chinese_L-12_H-768_A-12 -num_worker=1
from bert_serving.client import BertClient
if __name__ == '__main__':
with open("bert.txt",'r',encoding='utf-8') as f: #读入文件转换为列表
content = f.read().splitlines()
bc = BertClient()
vec = bc.encode(content)
print(vec)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。