"['fort collin men red solid pad jacket fort collin jacket topwear apparel apparel men buy fort collin men red solid pad jacket onlin india buy jacket best price', 'mango man men navi blue tailor slim fit solid formal trouser mango man trouser bottomwear apparel apparel men buy mango man men navi blue tailor slim fit solid formal trouser onlin india buy trouser best price', 'arrow men navi blue taper fit check formal trouser arrow trouser bottomwear apparel apparel men buy arrow men navi blue taper fit check formal trouser onlin india buy trouser best price', 'hane charcoal grey thermal shirt hane thermal top innerwear apparel apparel men buy hane charcoal grey thermal shirt onlin india buy thermal top best price', 'hancock men blue regular fit stripe formal shirt hancock shirt topwear apparel apparel men buy hancock men blue regular fit stripe formal shirt onlin india buy shirt best price']\n"
]
}
],
"source": [
"# apply it to our text data \n",
"# dataset is named wine_data and the text are in the column \"wmn\"\n",
"processed_wmn = [review_to_words(str(text)) for text in text_total]\n",
"C:\\Users\\User\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:1: DeprecationWarning: Call to deprecated `most_similar` (Method will be removed in 4.0.0, use self.wv.most_similar() instead).\n",
" \"\"\"Entry point for launching an IPython kernel.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"caffein\n",
"retro\n",
"transpar\n",
"junior\n",
"rubber\n",
"pace\n",
"assassin\n",
"emoji\n"
]
}
],
"source": [
"for node, _ in model.most_similar('black'):\n",
" if len(node) > 3:\n",
" print(node)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\User\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:1: DeprecationWarning: Call to deprecated `most_similar` (Method will be removed in 4.0.0, use self.wv.most_similar() instead).\n",
" \"\"\"Entry point for launching an IPython kernel.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"tshirt\n",
"proplanet\n",
"signatur\n",
"alci\n",
"price\n",
"bonati\n",
"greenturn\n",
"nautica\n",
"fritzberg\n"
]
}
],
"source": [
"for node, _ in model.most_similar('men'):\n",
" if len(node) > 3:\n",
" print(node)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\User\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:1: DeprecationWarning: Call to deprecated `most_similar` (Method will be removed in 4.0.0, use self.wv.most_similar() instead).\n",
" \"\"\"Entry point for launching an IPython kernel.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"price\n",
"dennison\n",
"oxolloxo\n",
"southbay\n",
"ivoc\n",
"excalibur\n",
"rigo\n",
"smokestack\n",
"zeal\n"
]
}
],
"source": [
"for node, _ in model.most_similar('buy'):\n",
" # Show only players\n",
" if len(node) > 3:\n",
" print(node)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bottomwear\n",
"alvaro\n",
"loungewear\n",
"apparel\n",
"headwear\n",
"peter\n",
"nightwear\n",
"pacif\n"
]
}
],
"source": [
"w1 = \"best\"\n",
"for node, _ in model.wv.most_similar (positive=w1, topn=10):\n",
" # Show only players\n",
" if len(node) > 3:\n",
" print(node)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\User\\Anaconda3\\lib\\site-packages\\gensim\\models\\keyedvectors.py:877: FutureWarning: arrays to stack must be passed as a \"sequence\" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.\n",
" vectors = vstack(self.word_vec(word, use_norm=True) for word in used_words).astype(REAL)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"men\n"
]
}
],
"source": [
"print(model.wv.doesnt_match(\"men black jeans\".split()))"