{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os; os.chdir('..')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/ubuntu/SentenceStructureComparision/venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n", "Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n" ] } ], "source": [ "from utils.get_intent import get_top_intent" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Commercial', 0.997),\n", " ('Transactional', 0.199),\n", " ('Local', 0.132),\n", " ('Navigational', 0.099),\n", " ('Informational', 0.088)]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"best cat ear headphones\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Transactional', 0.996),\n", " ('Commercial', 0.315),\n", " ('Navigational', 0.149),\n", " ('Local', 0.146),\n", " ('Informational', 0.133)]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"buy cat ear headphones\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Informational', 0.999),\n", " ('Transactional', 0.116),\n", " ('Local', 0.094),\n", " ('Commercial', 0.075),\n", " ('Navigational', 0.075)]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"how to create a facebook account\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Local', 0.997),\n", " ('Commercial', 0.134),\n", " ('Informational', 0.122),\n", " ('Navigational', 0.121),\n", " ('Transactional', 0.12)]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"barber shops in USA\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Informational', 0.892),\n", " ('Transactional', 0.685),\n", " ('Navigational', 0.533),\n", " ('Commercial', 0.123),\n", " ('Local', 0.072)]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"Razer Kraken Headsets\")" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Informational', 0.993),\n", " ('Commercial', 0.183),\n", " ('Transactional', 0.173),\n", " ('Local', 0.123),\n", " ('Navigational', 0.082)]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"Amazon Great indian festival\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Navigational', 0.998),\n", " ('Transactional', 0.271),\n", " ('Local', 0.164),\n", " ('Commercial', 0.134),\n", " ('Informational', 0.129)]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"facebook\")" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Navigational', 0.998),\n", " ('Transactional', 0.256),\n", " ('Local', 0.171),\n", " ('Informational', 0.151),\n", " ('Commercial', 0.127)]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"spotify\")" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Local', 0.997),\n", " ('Commercial', 0.136),\n", " ('Transactional', 0.124),\n", " ('Informational', 0.119),\n", " ('Navigational', 0.118)]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"parlours in dubai\")" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Informational', 0.999),\n", " ('Transactional', 0.131),\n", " ('Local', 0.09),\n", " ('Commercial', 0.072),\n", " ('Navigational', 0.069)]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"how to wear headphones\")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Navigational', 0.997),\n", " ('Transactional', 0.452),\n", " ('Local', 0.127),\n", " ('Informational', 0.126),\n", " ('Commercial', 0.12)]" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"receiptify\")" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Transactional', 0.995),\n", " ('Commercial', 0.27),\n", " ('Informational', 0.181),\n", " ('Local', 0.162),\n", " ('Navigational', 0.133)]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"cat ear headphones\")" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Transactional', 0.977),\n", " ('Navigational', 0.808),\n", " ('Commercial', 0.254),\n", " ('Informational', 0.107),\n", " ('Local', 0.081)]" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"sony headphones guide\")" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Navigational', 0.949),\n", " ('Transactional', 0.89),\n", " ('Informational', 0.328),\n", " ('Commercial', 0.113),\n", " ('Local', 0.069)]" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"wolf cut\") # informational" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Transactional', 0.996),\n", " ('Commercial', 0.217),\n", " ('Informational', 0.199),\n", " ('Navigational', 0.17),\n", " ('Local', 0.136)]" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent(\"help plumbing supply\") # informational" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Informational', 0.969),\n", " ('Commercial', 0.677),\n", " ('Transactional', 0.276),\n", " ('Local', 0.071),\n", " ('Navigational', 0.035)]" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_intent('yoga purpose') # informational" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os; os.chdir('..')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from utils.get_category import get_top_labels" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('Computers_and_Electronics', 1.0), ('Shopping', 0.182)]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_top_labels(\n", " \"best cat ear headphones\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv", "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.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }