Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Subash Chandra Sapkota committed Oct 28, 2024
1 parent b43219a commit 1d871cb
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions trainingModel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1180,34 +1180,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"# def word_averaging(wv, words):\n",
"# \"\"\"Averages the word vectors for a list of words.\n",
"\n",
"# Args:\n",
"# words: A list of words.\n",
"# wv: A pre-trained Gensim Word2Vec model.\n",
"\n",
"# Returns:\n",
"# A numpy array containing the average word vector.\n",
"# \"\"\"\n",
"# all_words, mean = set(), []\n",
" \n",
"# for word in words:\n",
"# if isinstance(word, np.ndarray):\n",
"# mean.append(word)\n",
"# elif word in wv.key_to_index:\n",
"# mean.append(wv.vectors_norm[wv.key_to_index[word]])\n",
"# all_words.add(wv.vectors_norm[word])\n",
"\n",
"# if not mean:\n",
"# logging.warning(\"cannot compute similarity with no input %s\", words)\n",
"# # FIXME: remove these examples in pre-processing\n",
"# return np.zeros(wv.vector_size,)\n",
"\n",
"# mean = gensim.matutils.unitvec(np.array(mean).mean(axis=0)).astype(np.float32)\n",
"# return mean\n",
"\n",
"\n",
"def average_word_vectors(model, words):\n",
" \"\"\"Averages the word vectors for a list of words.\n",
Expand Down

0 comments on commit 1d871cb

Please sign in to comment.