Views
No views yet
1from transformers import pipeline
2
3text_sim_pipeline = pipeline(
4 model="llm-book/bert-base-japanese-v3-jsts",
5 function_to_apply="none",
6)
7text = "川べりでサーフボードを持った人たちがいます"
8sim_text = "サーファーたちが川べりに立っています"
9# textとsim_textの類似度を計算
10result = text_sim_pipeline({"text": text, "text_pair": sim_text})
11print(result["score"])
12# 3.5703558921813965