From 994aa01610bf950ec9d9bbcd58123e74fc3ba517 Mon Sep 17 00:00:00 2001 From: zhangxuefei Date: Mon, 16 Sep 2019 18:09:06 +0800 Subject: [PATCH] update sentence similarity tutorial --- tutorial/sentence_sim.ipynb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tutorial/sentence_sim.ipynb b/tutorial/sentence_sim.ipynb index 46653d66..797c53f1 100644 --- a/tutorial/sentence_sim.ipynb +++ b/tutorial/sentence_sim.ipynb @@ -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": { -- GitLab