提交 994aa016 编写于 作者: Z zhangxuefei

update sentence similarity tutorial

上级 afa5c8a0
......@@ -65,7 +65,7 @@
" results = lac.lexical_analysis(data=inputs, use_gpu=True, batch_size=2)\n",
" data = []\n",
" for result in results:\n",
" data.append(\" \".join(result[\"word\"])\n",
" data.append(\" \".join(result[\"word\"]))\n",
" processed_data.append(data)\n",
"\n",
"processed_data"
......@@ -103,6 +103,7 @@
"metadata": {},
"outputs": [],
"source": [
"module = hub.Module(name=\"word2vec_skipgram\")\n",
"inputs, outputs, program = module.context(trainable=False)\n",
"vocab = load_vocab(module.get_vocab_path())\n",
"\n",
......@@ -137,6 +138,13 @@
" print(\"text_a: %s; text_b: %s; cosine_similarity: %.5f\" %\n",
" (item[0], item[1], cos_sim))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册