Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
0301Wenda authored Jun 15, 2024
1 parent c35550a commit 2ce5536
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions wangche/knock61.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "cc21727d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cosine similarity between 'United States' and 'U.S.': 0.7310774326324463\n"
]
}
],
"source": [
"import gensim\n",
"\n",
"# モデルを読み込む\n",
"model = gensim.models.KeyedVectors.load('word2vec-google-news-300.model')\n",
"\n",
"# \"United States\"\"U.S.\"のコサイン類似度を計算\n",
"similarity = model.similarity('United_States', 'U.S.')\n",
"print(f\"Cosine similarity between 'United States' and 'U.S.': {similarity}\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "32b24347",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 2ce5536

Please sign in to comment.