diff --git "a/notebooks/Create TREC Product Dataset.ipynb" "b/notebooks/Create TREC Product Dataset.ipynb" new file mode 100644--- /dev/null +++ "b/notebooks/Create TREC Product Dataset.ipynb" @@ -0,0 +1,2444 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "8a743c73", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import requests\n", + "import pyarrow.parquet as pq\n", + "import os\n", + "import openai\n", + "import random\n", + "label_map = {'exact': 3, 'substitute':2, 'complement':1, 'irrelevant':0}\n", + "label_map2 = {'E': 3, 'S':2, 'C':1, 'I':0}\n", + "openai.api_key = 'YOUROPENAIKEY'#os.getenv(\"OPENAI_API_KEY\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "3b2b704d", + "metadata": {}, + "outputs": [], + "source": [ + "id2imgurl = {}\n", + "asin2trecid = {}\n", + "trecid2asin = {}\n", + "doc_id = 0\n", + "collection = {}\n", + "with open('esci.json','r') as f:\n", + " for l in f:\n", + " j = json.loads(l)\n", + " trecid2asin [doc_id] = j['asin']\n", + " asin2trecid[j['asin']] = doc_id\n", + " try:\n", + " id2imgurl[doc_id] = j['image']\n", + " except:\n", + " pass\n", + " j['doc_id'] = doc_id\n", + " collection[doc_id] = j\n", + " if 'description' not in collection[doc_id]:\n", + " collection[doc_id]['description'] = ''\n", + " if 'title' not in collection[doc_id]:\n", + " collection[doc_id]['title'] = ''\n", + " collection[doc_id]['docid'] = collection[doc_id]['doc_id']\n", + " collection[doc_id]['text'] = collection[doc_id]['description']\n", + " doc_id += 1" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "0a0c8496", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'type': 'product',\n", + " 'locale': 'es',\n", + " 'asin': 'B06XXK1JQN',\n", + " 'title': 'Estores Basic- Enrollable Traslúcido , Crudo, 150x250 cm',\n", + " 'stars': '3,9 de 5 estrellas',\n", + " 'ratings': '90 valoraciones',\n", + " 'category': ['Hogar y cocina',\n", + " 'Decoración del hogar',\n", + " 'Decoración de ventanas',\n", + " 'Persianas',\n", + " 'Persianas enrollables y estores'],\n", + " 'attrs': {'Número de productos': '1',\n", + " 'Material': 'Textura',\n", + " 'Función especial': 'sin cuerda',\n", + " 'Marca': 'Estores Basic',\n", + " 'Color': 'Crudo',\n", + " 'Tamaño': '150x6x250 cm',\n", + " 'Peso del producto': '2.76 Libras',\n", + " 'Tipo de montaje': 'Montaje interior'},\n", + " 'bullets': ['Estor enrollable Traslúcido con contrapeso de PVC, oculto',\n", + " 'Mecanismo de accionamiento de cadeneta',\n", + " 'Soportes metálicos con embellecedores para instalación a techo o pared',\n", + " 'Limpieza con un paño ligeramente húmedo',\n", + " 'Dimensiones del producto \\u200f : \\u200e 150 x 6 x 250 cm; 1.25 kilogramos',\n", + " 'Producto en Amazon.es desde \\u200f : \\u200e 28 marzo 2017',\n", + " 'Fabricante \\u200f : \\u200e NAUMOIA S.L.',\n", + " 'ASIN \\u200f : \\u200e B06XXK1JQN',\n", + " 'Número de modelo del producto \\u200f : \\u200e 11042',\n", + " 'Clasificación en los más vendidos de Amazon: nº415,582 en Hogar y cocina ( Ver el Top 100 en Hogar y cocina ) nº814 en Persianas enrollables y estores',\n", + " 'nº814 en Persianas enrollables y estores',\n", + " 'Opiniones de los clientes: 3,9 de 5 estrellas 90 valoraciones'],\n", + " 'description': 'Descripción del producto Descripción del producto Permite el paso de la luz de forma tamizada. Aporta intimidad. Soportes metálicos con embellecedores para instalación a techo o pared. Mecanismo de accionamiento de cadeneta; Limpieza con un paño ligeramente húmedo. Contenido de la caja Estor enrollable Traslúcido. Incluye soportes y accesorios para instalación a techo o pared. Descripción del producto Descripción del producto Permite el paso de la luz de forma tamizada. Aporta intimidad. Soportes metálicos con embellecedores para instalación a techo o pared. Mecanismo de accionamiento de cadeneta; Limpieza con un paño ligeramente húmedo. Contenido de la caja Estor enrollable Traslúcido. Incluye soportes y accesorios para instalación a techo o pared.',\n", + " 'info': {},\n", + " 'reviews': [{'stars': '4,0 de 5 estrellas',\n", + " 'title': 'ESTORES FANTASTICOS',\n", + " 'date': 'Revisado en España 🇪🇸 el 17 de febrero de 2018',\n", + " 'text': 'La calidad no está mal y no tiene nada que envidiar a otros que venden en los centros comerciales típicos (LM, BP, AK, etc), y éstos son mas económicos aunque sin tanta carta de colores. El envio fue muy rápido. Muy recomendable'},\n", + " {'stars': '4,0 de 5 estrellas',\n", + " 'title': 'Calidad precio si no se usa mucho , bueno',\n", + " 'date': 'Revisado en España 🇪🇸 el 18 de septiembre de 2018',\n", + " 'text': 'Precio bien Montaje bien Los bordes se deshielan si no lo enrolla con mucho cuidado porque tienden a ir hacia un lado y se salen del rodillo'},\n", + " {'stars': '3,0 de 5 estrellas',\n", + " 'title': 'Cumple función básica',\n", + " 'date': 'Revisado en España 🇪🇸 el 21 de septiembre de 2019',\n", + " 'text': 'Calidad no es muy buena, para un apaño, sencillo está bien.'},\n", + " {'stars': '4,0 de 5 estrellas',\n", + " 'title': 'Se deshilacha',\n", + " 'date': 'Revisado en España 🇪🇸 el 25 de agosto de 2019',\n", + " 'text': 'Se deshilacha'},\n", + " {'stars': '3,0 de 5 estrellas',\n", + " 'title': 'Buen precio',\n", + " 'date': 'Revisado en España 🇪🇸 el 3 de enero de 2019',\n", + " 'text': 'El material es un poco tipo papel... Pero por su precio, y toda la gama de colores que hay, merece la pena...'},\n", + " {'stars': '4,0 de 5 estrellas',\n", + " 'title': 'Esta bien',\n", + " 'date': 'Revisado en España 🇪🇸 el 16 de junio de 2019',\n", + " 'text': 'Todo correcto'},\n", + " {'stars': '4,0 de 5 estrellas',\n", + " 'title': 'Por el precio, bien',\n", + " 'date': 'Revisado en España 🇪🇸 el 29 de noviembre de 2017',\n", + " 'text': 'Está bien por el precio, pero al tacto me parece un poco áspero. Si costara lo mismo, lo volvería a comprar.'},\n", + " {'stars': '4,0 de 5 estrellas',\n", + " 'title': 'Está bien',\n", + " 'date': 'Revisado en España 🇪🇸 el 14 de septiembre de 2017',\n", + " 'text': 'Cumple su función y el color es idéntico. Lo único que su calidad de plástico no es alta, pero cumple su función'},\n", + " {'stars': '4,0 de 5 estrellas',\n", + " 'title': 'Grezze ma fanno il suo lavoro',\n", + " 'date': 'Revisado en Italia 🇮🇹 el 7 de abril de 2018',\n", + " 'text': 'Tende veramente grezze, sono come descritte però mancano totalmente di un minimo di rifinitura, sui bordi sono sfilacciate e bisogna tagliare i fili sennò si impigliano. Il cordino è troppo corto, troppo per una tenda di 250 cm! Quando la di avvolge bisogna far attenzione a non farla sovrapporre! Tutto sommato per il prezzo pagato va bene. Grazie Amazon (Prime a vita)'}],\n", + " 'price': '',\n", + " 'formats': {},\n", + " 'template': 'furniture',\n", + " 'image': 'https://m.media-amazon.com/images/I/815fXDqFFQL.__AC_SX300_SY300_QL70_ML2_.jpg',\n", + " 'doc_id': 0,\n", + " 'docid': 0,\n", + " 'text': 'Descripción del producto Descripción del producto Permite el paso de la luz de forma tamizada. Aporta intimidad. Soportes metálicos con embellecedores para instalación a techo o pared. Mecanismo de accionamiento de cadeneta; Limpieza con un paño ligeramente húmedo. Contenido de la caja Estor enrollable Traslúcido. Incluye soportes y accesorios para instalación a techo o pared. Descripción del producto Descripción del producto Permite el paso de la luz de forma tamizada. Aporta intimidad. Soportes metálicos con embellecedores para instalación a techo o pared. Mecanismo de accionamiento de cadeneta; Limpieza con un paño ligeramente húmedo. Contenido de la caja Estor enrollable Traslúcido. Incluye soportes y accesorios para instalación a techo o pared.'}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "f61fec4c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "There are 1661907 documents in the collection\n", + "There are 1480714 img urls in the collection\n" + ] + } + ], + "source": [ + "print(\"There are {} documents in the collection\".format(doc_id -1))\n", + "print(\"There are {} img urls in the collection\".format(len(id2imgurl)))" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "76ac1581", + "metadata": {}, + "outputs": [], + "source": [ + "with open('collection-imgs.json','w') as w:\n", + " for i in id2imgurl:\n", + " j = {'doc_id': i, 'image_url':id2imgurl[i]}\n", + " w.write('{}\\n'.format(json.dumps(j)))" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "35ad9bd2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "asin2trecid[collection[0]['asin']]" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "a9bd2116", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'type': 'product',\n", + " 'locale': 'us',\n", + " 'asin': 'B002VUAM46',\n", + " 'title': 'Degree Men Antiperspirant Deodorant Adventure Antiperspirant For Men With MotionSense Technology, 2.7 Ounce (Pack of 4)',\n", + " 'stars': '4.7 out of 5 stars',\n", + " 'ratings': '2,256 ratings',\n", + " 'category': ['Beauty & Personal Care',\n", + " 'Personal Care',\n", + " 'Deodorants & Antiperspirants',\n", + " 'Antiperspirants'],\n", + " 'attrs': {'Material Type Free': 'ERROR: #N/A',\n", + " 'Item Form': 'Sticks',\n", + " 'Brand': 'DEGREE',\n", + " 'Item Volume': '2.7 Fluid Ounces',\n", + " 'Scent': 'Woodsy'},\n", + " 'bullets': ['We are upgrading! For a limited time, you may receive our old 48-hour Antiperspirant Deodorant while all our new 72-hour products make it to stores. Detailed changes in product description',\n", + " 'MOTIONSENSE TECHNOLOGY: This clinically proven antiperspirant provides a unique motion-activated, odor-control technology with 2x stronger sweat protection than regular antiperspirants',\n", + " 'READY FOR WHAT’S NEXT: Take on the day with Degree Men Adventure Antiperspirant Deodorant stick. Simply twist, glide, and move',\n", + " 'UNSTOPPABLE FRESHNESS: This antiperspirant for men features a rugged fragrance that blends clean citrus, energizing fresh pepper and long-lasting notes of woods and musk',\n", + " 'RECYCLE WITH DEGREE: As well as increasing our use of reusable materials, we’re making it easier for you to recycle our antiperspirant and dry spray packaging',\n", + " 'Is Discontinued By Manufacturer \\u200f : \\u200e No',\n", + " 'Product Dimensions \\u200f : \\u200e 6 x 5 x 4 inches; 5.33 Ounces',\n", + " 'Item model number \\u200f : \\u200e 10079400483994',\n", + " 'Manufacturer \\u200f : \\u200e Unilever',\n", + " 'ASIN \\u200f : \\u200e B002VUAM46',\n", + " 'Country of Origin \\u200f : \\u200e USA',\n", + " 'Best Sellers Rank: #12,765 in Health & Household ( See Top 100 in Health & Household ) #21 in Antiperspirants',\n", + " '#21 in Antiperspirants',\n", + " 'Customer Reviews: 4.7 out of 5 stars 2,256 ratings'],\n", + " 'description': \"Product Description Degree is upgrading to our best formula yet. Our new and improved formulation gives you 72 hours of nonstop sweat and odor protection. You will still find all the same fragrances you know and love, but now with our new and improved long lasting protection! For a limited time, you may still receive our old 48-hour formulation while all our new 72-hour products make their way to a store near you. Freshen up, power up and move with confidence with Degree Men Adventure Antiperspirant Deodorant. Supercharged with 72-hour odor protection, this antiperspirant deodorant for men works as hard as you do and provides superior motion-activated protection from sweat and odor. However you move, this antiperspirant deodorant delivers unstoppable freshness for that shower-clean feeling all day long. With a rugged fragrance that blends clean citrus, energizing fresh pepper and long-lasting notes of woods and musk and non-stop odor and sweat protection, this Degree Men antiperspirant deodorant for men won’t let you down – so you can stay fresh, for all the ways you move. Product Description Degree is upgrading to our best formula yet. Our new and improved formulation gives you 72 hours of nonstop sweat and odor protection. You will still find all the same fragrances you know and love, but now with our new and improved long lasting protection! For a limited time, you may still receive our old 48-hour formulation while all our new 72-hour products make their way to a store near you. Freshen up, power up and move with confidence with Degree Men Adventure Antiperspirant Deodorant. Supercharged with 72-hour odor protection, this antiperspirant deodorant for men works as hard as you do and provides superior motion-activated protection from sweat and odor. However you move, this antiperspirant deodorant delivers unstoppable freshness for that shower-clean feeling all day long. With a rugged fragrance that blends clean citrus, energizing fresh pepper and long-lasting notes of woods and musk and non-stop odor and sweat protection, this Degree Men antiperspirant deodorant for men won’t let you down – so you can stay fresh, for all the ways you move.From the manufacturer Degree Men Adventure Antiperspirant Deodorant has a rugged fragrance that blends clean citrus, energizing fresh pepper and long-lasting notes of wood and musk. Its powerful MotionSense technology releases more fragrance as you move, so that you're ready for the most challenging adventure. 72-HOUR NONSTOP SWEAT PROTECTION This antiperspirant stick delivers unstoppable sweat and odor protection that helps keep you moving with confidence. MOTIONSENSE TECHNOLOGY Degree's breakthrough MotionSense technology reacts directly to movement to keep you feeling fresh and protected. UNSTOPPABLE CONFIDENCE Degree doesn't stop working, no matter how much you move. MOVING TOGETHER TOWARD REUSE At Degree, we're committed to creating the most reused and inclusive products possible. As well as increasing our use of reusable materials, we’re making it easier for you to recycle our antiperspirant and dry spray packaging. Read more Degree Men UltraClear DeodorantStick 72 hour Sweat and odor Black+White, 2.7 oz Degree Men Advanced Cool Rush Antiperspirant Deodorant Dry Spray, 3.8 oz Degree Men Extreme Blast Antiperspirant Deodorant Stick, 2.7 oz Main Benefit This antiperspirant for men protects against white marks and yellow stains. Active lives need Degree Men UltraClear Black + White Antiperspirant Deodorant, formulated to help you move with freedom, and feel fresh and confident. Get the crisp, arctic freshness of our fan-favorite Cool Rush deodorant in a convenient dry spray featuring MotionSense technology that works with your body. Degree Men Extreme Blast Antiperspirant Deodorant provides 48-hour sweat and odor protection that won't let you down. \",\n", + " 'info': {},\n", + " 'reviews': [{'stars': '4.0 out of 5 stars',\n", + " 'title': 'Actually is effective',\n", + " 'date': 'Reviewed in the United States on December 27, 2022',\n", + " 'text': 'I use it every two to three days, and stay oder free'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Excellent',\n", + " 'date': 'Reviewed in the United States on December 12, 2022',\n", + " 'text': 'Works for me'},\n", + " {'stars': '4.0 out of 5 stars',\n", + " 'title': 'Good stuff',\n", + " 'date': 'Reviewed in the United States on November 19, 2022',\n", + " 'text': 'It deodorizes and anti-perspirizes. Like the smell, miss the gel.'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Excelente',\n", + " 'date': 'Reviewed in the United States on November 16, 2022',\n", + " 'text': 'Muy buen precio. Funciona como se esperaba . Envío 📦 excelente El vendedor cumplió con una descripción precisa. Muy recomendable'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Works great long lasting',\n", + " 'date': 'Reviewed in the United States on October 28, 2022',\n", + " 'text': 'Works great long lasting. I would buy this product again .'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': '72 hours 👍',\n", + " 'date': 'Reviewed in the United States on October 5, 2022',\n", + " 'text': 'Good quality smell good !! 72h 👌'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Every other deodorant gives me a terrible rash',\n", + " 'date': 'Reviewed in the United States on July 13, 2022',\n", + " 'text': 'I have tried so many deodorants that smell great and feel great, until the next day… Even other degree products, I bought almost this exact same one but it was 48hr. Somehow still got a terrible rash. This formula must omit one ingredient that my skin does not like. I’ve learned my lesson trying to pick another deodorant when my store doesn’t have this one. These packs are a great value and essential for me at this point.'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'This is some good shituff',\n", + " 'date': 'Reviewed in the United States on September 24, 2022',\n", + " 'text': 'Will buy again smells great lasts long very nice'}],\n", + " 'price': '',\n", + " 'formats': {},\n", + " 'template': 'beauty',\n", + " 'image': 'https://m.media-amazon.com/images/W/WEBP_402378-T1/images/I/51+tUdTWg0L._SY300_SX300_.jpg',\n", + " 'doc_id': 1661907,\n", + " 'docid': 1661907,\n", + " 'text': \"Product Description Degree is upgrading to our best formula yet. Our new and improved formulation gives you 72 hours of nonstop sweat and odor protection. You will still find all the same fragrances you know and love, but now with our new and improved long lasting protection! For a limited time, you may still receive our old 48-hour formulation while all our new 72-hour products make their way to a store near you. Freshen up, power up and move with confidence with Degree Men Adventure Antiperspirant Deodorant. Supercharged with 72-hour odor protection, this antiperspirant deodorant for men works as hard as you do and provides superior motion-activated protection from sweat and odor. However you move, this antiperspirant deodorant delivers unstoppable freshness for that shower-clean feeling all day long. With a rugged fragrance that blends clean citrus, energizing fresh pepper and long-lasting notes of woods and musk and non-stop odor and sweat protection, this Degree Men antiperspirant deodorant for men won’t let you down – so you can stay fresh, for all the ways you move. Product Description Degree is upgrading to our best formula yet. Our new and improved formulation gives you 72 hours of nonstop sweat and odor protection. You will still find all the same fragrances you know and love, but now with our new and improved long lasting protection! For a limited time, you may still receive our old 48-hour formulation while all our new 72-hour products make their way to a store near you. Freshen up, power up and move with confidence with Degree Men Adventure Antiperspirant Deodorant. Supercharged with 72-hour odor protection, this antiperspirant deodorant for men works as hard as you do and provides superior motion-activated protection from sweat and odor. However you move, this antiperspirant deodorant delivers unstoppable freshness for that shower-clean feeling all day long. With a rugged fragrance that blends clean citrus, energizing fresh pepper and long-lasting notes of woods and musk and non-stop odor and sweat protection, this Degree Men antiperspirant deodorant for men won’t let you down – so you can stay fresh, for all the ways you move.From the manufacturer Degree Men Adventure Antiperspirant Deodorant has a rugged fragrance that blends clean citrus, energizing fresh pepper and long-lasting notes of wood and musk. Its powerful MotionSense technology releases more fragrance as you move, so that you're ready for the most challenging adventure. 72-HOUR NONSTOP SWEAT PROTECTION This antiperspirant stick delivers unstoppable sweat and odor protection that helps keep you moving with confidence. MOTIONSENSE TECHNOLOGY Degree's breakthrough MotionSense technology reacts directly to movement to keep you feeling fresh and protected. UNSTOPPABLE CONFIDENCE Degree doesn't stop working, no matter how much you move. MOVING TOGETHER TOWARD REUSE At Degree, we're committed to creating the most reused and inclusive products possible. As well as increasing our use of reusable materials, we’re making it easier for you to recycle our antiperspirant and dry spray packaging. Read more Degree Men UltraClear DeodorantStick 72 hour Sweat and odor Black+White, 2.7 oz Degree Men Advanced Cool Rush Antiperspirant Deodorant Dry Spray, 3.8 oz Degree Men Extreme Blast Antiperspirant Deodorant Stick, 2.7 oz Main Benefit This antiperspirant for men protects against white marks and yellow stains. Active lives need Degree Men UltraClear Black + White Antiperspirant Deodorant, formulated to help you move with freedom, and feel fresh and confident. Get the crisp, arctic freshness of our fan-favorite Cool Rush deodorant in a convenient dry spray featuring MotionSense technology that works with your body. Degree Men Extreme Blast Antiperspirant Deodorant provides 48-hour sweat and odor protection that won't let you down. \"}" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection[doc_id-1]" + ] + }, + { + "cell_type": "markdown", + "id": "6233cca0", + "metadata": {}, + "source": [ + "# Generate a complete dump of all dataset withouth any language specific filtering" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "c7b99710", + "metadata": {}, + "outputs": [], + "source": [ + "with open('full-collection.jsonl','w') as w:\n", + " for i in range(0,len(collection)):\n", + " doc_id = asin2trecid[collection[i]['asin']]\n", + " collection[i]['doc_id'] = doc_id\n", + " w.write(\"{}\\n\".format(json.dumps(j)))" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "9a8bb5fc", + "metadata": {}, + "outputs": [], + "source": [ + "from pyarrow import json\n", + "table = json.read_json('full-collection.jsonl') \n", + "pq.write_table(table, 'full-collection.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "id": "b130143b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1118658\n" + ] + } + ], + "source": [ + "in_english = set()\n", + "for i in range(0,len(collection)):\n", + " if collection[i]['locale'] == 'us':\n", + " in_english.add(i)\n", + "print(len(in_english))" + ] + }, + { + "cell_type": "markdown", + "id": "f309ee88", + "metadata": {}, + "source": [ + "## Generate a TREC collection style " + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "62a24ff3", + "metadata": {}, + "outputs": [], + "source": [ + "#doc_id\\ttitle\\tdescription\n", + "with open('collection.trec', 'w') as w:\n", + " for i in range(0,len(collection)):\n", + " if collection[i]['locale'] == 'us':\n", + " w.write(\"{}\\t{}\\t{}\\n\".format(collection[i]['doc_id'],collection[i]['title'],collection[i]['description']))" + ] + }, + { + "cell_type": "markdown", + "id": "bada9b7e", + "metadata": {}, + "source": [ + "## Generate a JSON collection style " + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "85deb526", + "metadata": {}, + "outputs": [], + "source": [ + "#json \n", + "with open('corpus.jsonl', 'w') as w:\n", + " for i in range(0,len(collection)):\n", + " if collection[i]['locale'] == 'us':\n", + " w.write(\"{}\\n\".format(json.dumps(collection[i])))" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "58141dfb", + "metadata": {}, + "outputs": [], + "source": [ + "from pyarrow import json\n", + "table = json.read_json('corpus.jsonl') \n", + "pq.write_table(table, 'corpus.parquet')\n", + "import json" + ] + }, + { + "cell_type": "markdown", + "id": "58a1d657", + "metadata": {}, + "source": [ + "## Pyserini Compatable" + ] + }, + { + "cell_type": "markdown", + "id": "d5c2ef3f", + "metadata": {}, + "source": [ + "Next we go ahead and make a collection in the trec format. " + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "efa549ee", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mkdir: indexes: File exists\r\n" + ] + } + ], + "source": [ + "! mkdir indexes esci-pyserini-simple esci-pyserini-full" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "80162d5f", + "metadata": {}, + "outputs": [], + "source": [ + "# pyserini with just title and description\n", + "with open('esci-pyserini-simple/collection.jsonl','w') as w: \n", + " for i in range(0,len(collection)):\n", + " if collection[i]['locale'] == 'us':\n", + " j = {}\n", + " j['id'] = collection[i]['doc_id']\n", + " j['contents'] = json.dumps({'title':collection[i]['title'],'text':collection[i]['text']})\n", + " w.write(\"{}\\n\".format(json.dumps(j)))" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "55d7f9ca", + "metadata": {}, + "outputs": [], + "source": [ + "from pyarrow import json\n", + "table = json.read_json('esci-pyserini-simple/collection.jsonl') \n", + "pq.write_table(table, 'esci-pyserini-simple/collection.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "8883a427", + "metadata": {}, + "outputs": [], + "source": [ + "# pyserini with just title and description\n", + "with open('esci-pyserini-full/collection.jsonl','w') as w: \n", + " for i in range(0,len(collection)):\n", + " if collection[i]['locale'] == 'us':\n", + " j = {}\n", + " j['id'] = collection[i]['doc_id']\n", + " j['contents'] = json.dumps(collection[i])\n", + " w.write(\"{}\\n\".format(json.dumps(j)))" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "25a4159f", + "metadata": {}, + "outputs": [], + "source": [ + "from pyarrow import json\n", + "table = json.read_json('esci-pyserini-full/collection.jsonl') \n", + "pq.write_table(table, 'esci-pyserini-full/collection.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "c8a5226c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.\n", + "2023-04-11 10:50:35,578 INFO [main] index.IndexCollection (IndexCollection.java:645) - Setting log level to INFO\n", + "2023-04-11 10:50:35,580 INFO [main] index.IndexCollection (IndexCollection.java:648) - Starting indexer...\n", + "2023-04-11 10:50:35,580 INFO [main] index.IndexCollection (IndexCollection.java:649) - ============ Loading Parameters ============\n", + "2023-04-11 10:50:35,581 INFO [main] index.IndexCollection (IndexCollection.java:650) - DocumentCollection path: esci-pyserini-simple\n", + "2023-04-11 10:50:35,581 INFO [main] index.IndexCollection (IndexCollection.java:651) - CollectionClass: JsonCollection\n", + "2023-04-11 10:50:35,581 INFO [main] index.IndexCollection (IndexCollection.java:652) - Generator: DefaultLuceneDocumentGenerator\n", + "2023-04-11 10:50:35,582 INFO [main] index.IndexCollection (IndexCollection.java:653) - Threads: 1\n", + "2023-04-11 10:50:35,582 INFO [main] index.IndexCollection (IndexCollection.java:654) - Language: en\n", + "2023-04-11 10:50:35,582 INFO [main] index.IndexCollection (IndexCollection.java:655) - Stemmer: porter\n", + "2023-04-11 10:50:35,583 INFO [main] index.IndexCollection (IndexCollection.java:656) - Keep stopwords? false\n", + "2023-04-11 10:50:35,583 INFO [main] index.IndexCollection (IndexCollection.java:657) - Stopwords: null\n", + "2023-04-11 10:50:35,583 INFO [main] index.IndexCollection (IndexCollection.java:658) - Store positions? true\n", + "2023-04-11 10:50:35,583 INFO [main] index.IndexCollection (IndexCollection.java:659) - Store docvectors? true\n", + "2023-04-11 10:50:35,584 INFO [main] index.IndexCollection (IndexCollection.java:660) - Store document \"contents\" field? false\n", + "2023-04-11 10:50:35,584 INFO [main] index.IndexCollection (IndexCollection.java:661) - Store document \"raw\" field? true\n", + "2023-04-11 10:50:35,584 INFO [main] index.IndexCollection (IndexCollection.java:662) - Additional fields to index: []\n", + "2023-04-11 10:50:35,584 INFO [main] index.IndexCollection (IndexCollection.java:663) - Optimize (merge segments)? false\n", + "2023-04-11 10:50:35,585 INFO [main] index.IndexCollection (IndexCollection.java:664) - Whitelist: null\n", + "2023-04-11 10:50:35,585 INFO [main] index.IndexCollection (IndexCollection.java:665) - Pretokenized?: false\n", + "2023-04-11 10:50:35,585 INFO [main] index.IndexCollection (IndexCollection.java:685) - Directly building Lucene indexes...\n", + "2023-04-11 10:50:35,585 INFO [main] index.IndexCollection (IndexCollection.java:686) - Index path: indexes/esci-simple-pyserini\n", + "2023-04-11 10:50:35,592 INFO [main] index.IndexCollection (IndexCollection.java:741) - ============ Indexing Collection ============\n", + "2023-04-11 10:50:35,849 INFO [main] index.IndexCollection (IndexCollection.java:845) - Thread pool with 1 threads initialized.\n", + "2023-04-11 10:50:35,849 INFO [main] index.IndexCollection (IndexCollection.java:847) - Initializing collection in esci-pyserini-simple\n", + "2023-04-11 10:50:35,854 INFO [main] index.IndexCollection (IndexCollection.java:856) - 1 file found\n", + "2023-04-11 10:50:35,855 INFO [main] index.IndexCollection (IndexCollection.java:857) - Starting to index...\n", + "2023-04-11 10:51:35,861 INFO [main] index.IndexCollection (IndexCollection.java:875) - 220,000 documents indexed\n", + "2023-04-11 10:52:35,862 INFO [main] index.IndexCollection (IndexCollection.java:875) - 410,000 documents indexed\n", + "2023-04-11 10:53:35,868 INFO [main] index.IndexCollection (IndexCollection.java:875) - 670,000 documents indexed\n", + "2023-04-11 10:55:41,644 INFO [main] index.IndexCollection (IndexCollection.java:875) - 910,000 documents indexed\n", + "2023-04-11 11:12:00,303 DEBUG [pool-2-thread-1] index.IndexCollection$LocalIndexerThread (IndexCollection.java:250) - esci-pyserini-simple/collection.jsonl: 1118658 docs added.\n", + "2023-04-11 11:56:39,748 INFO [main] index.IndexCollection (IndexCollection.java:941) - Indexing Complete! 1,118,658 documents indexed\n", + "2023-04-11 11:56:39,748 INFO [main] index.IndexCollection (IndexCollection.java:942) - ============ Final Counter Values ============\n", + "2023-04-11 11:56:39,748 INFO [main] index.IndexCollection (IndexCollection.java:943) - indexed: 1,118,658\n", + "2023-04-11 11:56:39,748 INFO [main] index.IndexCollection (IndexCollection.java:944) - unindexable: 0\n", + "2023-04-11 11:56:39,748 INFO [main] index.IndexCollection (IndexCollection.java:945) - empty: 0\n", + "2023-04-11 11:56:39,748 INFO [main] index.IndexCollection (IndexCollection.java:946) - skipped: 0\n", + "2023-04-11 11:56:39,748 INFO [main] index.IndexCollection (IndexCollection.java:947) - errors: 0\n", + "2023-04-11 11:56:39,754 INFO [main] index.IndexCollection (IndexCollection.java:950) - Total 1,118,658 documents indexed in 00:05:34\n" + ] + } + ], + "source": [ + "! python -m pyserini.index.lucene --collection JsonCollection --input esci-pyserini-simple --index indexes/esci-simple-pyserini --generator DefaultLuceneDocumentGenerator --threads 1 --storePositions --storeDocvectors --storeRaw" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "b595e9d4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.\n", + "2023-04-11 11:56:42,186 INFO [main] index.IndexCollection (IndexCollection.java:645) - Setting log level to INFO\n", + "2023-04-11 11:56:42,187 INFO [main] index.IndexCollection (IndexCollection.java:648) - Starting indexer...\n", + "2023-04-11 11:56:42,187 INFO [main] index.IndexCollection (IndexCollection.java:649) - ============ Loading Parameters ============\n", + "2023-04-11 11:56:42,188 INFO [main] index.IndexCollection (IndexCollection.java:650) - DocumentCollection path: esci-pyserini-full\n", + "2023-04-11 11:56:42,188 INFO [main] index.IndexCollection (IndexCollection.java:651) - CollectionClass: JsonCollection\n", + "2023-04-11 11:56:42,188 INFO [main] index.IndexCollection (IndexCollection.java:652) - Generator: DefaultLuceneDocumentGenerator\n", + "2023-04-11 11:56:42,188 INFO [main] index.IndexCollection (IndexCollection.java:653) - Threads: 1\n", + "2023-04-11 11:56:42,189 INFO [main] index.IndexCollection (IndexCollection.java:654) - Language: en\n", + "2023-04-11 11:56:42,189 INFO [main] index.IndexCollection (IndexCollection.java:655) - Stemmer: porter\n", + "2023-04-11 11:56:42,189 INFO [main] index.IndexCollection (IndexCollection.java:656) - Keep stopwords? false\n", + "2023-04-11 11:56:42,189 INFO [main] index.IndexCollection (IndexCollection.java:657) - Stopwords: null\n", + "2023-04-11 11:56:42,189 INFO [main] index.IndexCollection (IndexCollection.java:658) - Store positions? true\n", + "2023-04-11 11:56:42,190 INFO [main] index.IndexCollection (IndexCollection.java:659) - Store docvectors? true\n", + "2023-04-11 11:56:42,190 INFO [main] index.IndexCollection (IndexCollection.java:660) - Store document \"contents\" field? false\n", + "2023-04-11 11:56:42,190 INFO [main] index.IndexCollection (IndexCollection.java:661) - Store document \"raw\" field? true\n", + "2023-04-11 11:56:42,190 INFO [main] index.IndexCollection (IndexCollection.java:662) - Additional fields to index: []\n", + "2023-04-11 11:56:42,190 INFO [main] index.IndexCollection (IndexCollection.java:663) - Optimize (merge segments)? false\n", + "2023-04-11 11:56:42,191 INFO [main] index.IndexCollection (IndexCollection.java:664) - Whitelist: null\n", + "2023-04-11 11:56:42,191 INFO [main] index.IndexCollection (IndexCollection.java:665) - Pretokenized?: false\n", + "2023-04-11 11:56:42,191 INFO [main] index.IndexCollection (IndexCollection.java:685) - Directly building Lucene indexes...\n", + "2023-04-11 11:56:42,191 INFO [main] index.IndexCollection (IndexCollection.java:686) - Index path: indexes/esci-full-pyserini\n", + "2023-04-11 11:56:42,194 INFO [main] index.IndexCollection (IndexCollection.java:741) - ============ Indexing Collection ============\n", + "2023-04-11 11:56:42,338 INFO [main] index.IndexCollection (IndexCollection.java:845) - Thread pool with 1 threads initialized.\n", + "2023-04-11 11:56:42,338 INFO [main] index.IndexCollection (IndexCollection.java:847) - Initializing collection in esci-pyserini-full\n", + "2023-04-11 11:56:42,340 INFO [main] index.IndexCollection (IndexCollection.java:856) - 1 file found\n", + "2023-04-11 11:56:42,340 INFO [main] index.IndexCollection (IndexCollection.java:857) - Starting to index...\n", + "2023-04-11 11:57:42,333 INFO [main] index.IndexCollection (IndexCollection.java:875) - 60,000 documents indexed\n", + "2023-04-11 11:58:42,342 INFO [main] index.IndexCollection (IndexCollection.java:875) - 120,000 documents indexed\n", + "2023-04-11 11:59:42,344 INFO [main] index.IndexCollection (IndexCollection.java:875) - 180,000 documents indexed\n", + "2023-04-11 12:00:42,348 INFO [main] index.IndexCollection (IndexCollection.java:875) - 240,000 documents indexed\n", + "2023-04-11 12:01:42,352 INFO [main] index.IndexCollection (IndexCollection.java:875) - 300,000 documents indexed\n", + "2023-04-11 12:02:42,357 INFO [main] index.IndexCollection (IndexCollection.java:875) - 370,000 documents indexed\n", + "2023-04-11 12:03:42,357 INFO [main] index.IndexCollection (IndexCollection.java:875) - 430,000 documents indexed\n", + "2023-04-11 12:04:42,360 INFO [main] index.IndexCollection (IndexCollection.java:875) - 500,000 documents indexed\n", + "2023-04-11 12:05:42,363 INFO [main] index.IndexCollection (IndexCollection.java:875) - 560,000 documents indexed\n", + "2023-04-11 12:06:42,367 INFO [main] index.IndexCollection (IndexCollection.java:875) - 620,000 documents indexed\n", + "2023-04-11 12:07:42,367 INFO [main] index.IndexCollection (IndexCollection.java:875) - 640,000 documents indexed\n", + "2023-04-11 12:08:42,368 INFO [main] index.IndexCollection (IndexCollection.java:875) - 680,000 documents indexed\n", + "2023-04-11 12:09:42,378 INFO [main] index.IndexCollection (IndexCollection.java:875) - 690,000 documents indexed\n", + "2023-04-11 12:10:42,388 INFO [main] index.IndexCollection (IndexCollection.java:875) - 700,000 documents indexed\n", + "2023-04-11 12:11:42,393 INFO [main] index.IndexCollection (IndexCollection.java:875) - 740,000 documents indexed\n", + "2023-04-11 12:12:42,395 INFO [main] index.IndexCollection (IndexCollection.java:875) - 770,000 documents indexed\n", + "2023-04-11 12:13:42,400 INFO [main] index.IndexCollection (IndexCollection.java:875) - 800,000 documents indexed\n", + "2023-04-11 12:14:42,405 INFO [main] index.IndexCollection (IndexCollection.java:875) - 830,000 documents indexed\n", + "2023-04-11 12:15:42,410 INFO [main] index.IndexCollection (IndexCollection.java:875) - 860,000 documents indexed\n", + "2023-04-11 12:16:42,413 INFO [main] index.IndexCollection (IndexCollection.java:875) - 890,000 documents indexed\n", + "2023-04-11 12:17:42,414 INFO [main] index.IndexCollection (IndexCollection.java:875) - 930,000 documents indexed\n", + "2023-04-11 12:18:42,415 INFO [main] index.IndexCollection (IndexCollection.java:875) - 960,000 documents indexed\n", + "2023-04-11 12:19:42,420 INFO [main] index.IndexCollection (IndexCollection.java:875) - 990,000 documents indexed\n", + "2023-04-11 12:20:42,426 INFO [main] index.IndexCollection (IndexCollection.java:875) - 1,020,000 documents indexed\n", + "2023-04-11 12:21:42,430 INFO [main] index.IndexCollection (IndexCollection.java:875) - 1,050,000 documents indexed\n", + "2023-04-11 12:22:42,431 INFO [main] index.IndexCollection (IndexCollection.java:875) - 1,110,000 documents indexed\n", + "2023-04-11 12:22:48,622 DEBUG [pool-2-thread-1] index.IndexCollection$LocalIndexerThread (IndexCollection.java:250) - esci-pyserini-full/collection.jsonl: 1118658 docs added.\n", + "2023-04-11 12:23:27,153 INFO [main] index.IndexCollection (IndexCollection.java:941) - Indexing Complete! 1,118,658 documents indexed\n", + "2023-04-11 12:23:27,153 INFO [main] index.IndexCollection (IndexCollection.java:942) - ============ Final Counter Values ============\n", + "2023-04-11 12:23:27,154 INFO [main] index.IndexCollection (IndexCollection.java:943) - indexed: 1,118,658\n", + "2023-04-11 12:23:27,154 INFO [main] index.IndexCollection (IndexCollection.java:944) - unindexable: 0\n", + "2023-04-11 12:23:27,154 INFO [main] index.IndexCollection (IndexCollection.java:945) - empty: 0\n", + "2023-04-11 12:23:27,154 INFO [main] index.IndexCollection (IndexCollection.java:946) - skipped: 0\n", + "2023-04-11 12:23:27,154 INFO [main] index.IndexCollection (IndexCollection.java:947) - errors: 0\n", + "2023-04-11 12:23:27,163 INFO [main] index.IndexCollection (IndexCollection.java:950) - Total 1,118,658 documents indexed in 00:26:44\n" + ] + } + ], + "source": [ + "! python -m pyserini.index.lucene --collection JsonCollection --input esci-pyserini-full --index indexes/esci-full-pyserini --generator DefaultLuceneDocumentGenerator --threads 1 --storePositions --storeDocvectors --storeRaw" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "2f32b17e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 1 1167339 6.89770\n", + " 2 350574 6.88980\n", + " 3 779772 6.88730\n", + " 4 1575716 6.88410\n", + " 5 1160154 6.88360\n", + " 6 691412 6.88030\n", + " 7 1643780 6.87890\n", + " 8 1201683 6.87530\n", + " 9 1360375 6.87390\n", + "10 1571386 6.87370\n", + "11 1265234 6.87350\n", + "12 966314 6.87270\n", + "13 1425213 6.87260\n", + "14 1593423 6.87130\n", + "15 605874 6.87060\n", + "16 787982 6.86960\n", + "17 999017 6.86930\n", + "18 743049 6.86860\n", + "19 112904 6.86680\n", + "20 600733 6.86560\n", + "21 367145 6.86530\n", + "22 1544772 6.86470\n", + "23 126680 6.86450\n", + "24 486218 6.86030\n", + "25 1264548 6.85830\n", + "26 1091510 6.85750\n", + "27 1580381 6.85650\n", + "28 161353 6.85630\n", + "29 771950 6.85360\n", + "30 268918 6.85300\n", + "31 1093691 6.85290\n", + "32 976335 6.85250\n", + "33 878434 6.85140\n", + "34 497237 6.85110\n", + "35 1173589 6.85070\n", + "36 940791 6.85060\n", + "37 1549372 6.84760\n", + "38 167246 6.84670\n", + "39 581918 6.84620\n", + "40 1129931 6.84600\n", + "41 1318119 6.84100\n", + "42 218634 6.84090\n", + "43 4701 6.83990\n", + "44 715097 6.83960\n", + "45 1243454 6.83930\n", + "46 349711 6.83730\n", + "47 667817 6.83680\n", + "48 336347 6.83590\n", + "49 33430 6.83500\n", + "50 368480 6.83360\n", + "51 1140007 6.83320\n", + "52 1292138 6.83090\n", + "53 919554 6.82970\n", + "54 1003394 6.82900\n", + "55 176972 6.82880\n", + "56 996170 6.82680\n", + "57 711770 6.82550\n", + "58 462390 6.82520\n", + "59 122411 6.82380\n", + "60 93600 6.82320\n", + "61 1610856 6.82170\n", + "62 1019902 6.82150\n", + "63 307632 6.82050\n", + "64 404450 6.82030\n", + "65 570596 6.82000\n", + "66 9067 6.81960\n", + "67 1283001 6.81930\n", + "68 854319 6.81720\n", + "69 297667 6.81660\n", + "70 1189068 6.81610\n", + "71 1383863 6.81450\n", + "72 855859 6.81440\n", + "73 1093375 6.81240\n", + "74 1240564 6.81150\n", + "75 731390 6.81150\n", + "76 406312 6.81010\n", + "77 679673 6.81000\n", + "78 865406 6.80930\n", + "79 986685 6.80780\n", + "80 230998 6.80770\n", + "81 374897 6.80750\n", + "82 1105942 6.80720\n", + "83 910196 6.80720\n", + "84 1072234 6.80620\n", + "85 1454452 6.80610\n", + "86 873674 6.80590\n", + "87 1421430 6.80560\n", + "88 989004 6.80520\n", + "89 919975 6.80460\n", + "90 1558050 6.80360\n", + "91 197641 6.80240\n", + "92 314262 6.80110\n", + "93 511111 6.80090\n", + "94 131413 6.80080\n", + "95 1229659 6.80010\n", + "96 1330011 6.79900\n", + "97 733617 6.79880\n", + "98 1024163 6.79850\n", + "99 355744 6.79790\n", + "100 595695 6.79780\n" + ] + } + ], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-full-pyserini')\n", + "hits = searcher.search('iphone chargers', 100)\n", + "\n", + "for i in range(len(hits)):\n", + " print(f'{i+1:2} {hits[i].docid:4} {hits[i].score:.5f}')" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "9176c3c0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'iPhone Charger 90 Degree Lightning Cable 6ft 5 Pack Fast Charging Cable iPhone Charging Cords Right Angle USB Data Cable Compatible with iPhone 11/11 pro/Xs Max/XS/XR/7/7Plus/X/8/8Plus/6S/6S Plus/SE'" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection[1167339]['title']" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "767889e5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 1 1167339 8.10870\n", + " 2 1575716 8.09710\n", + " 3 1160154 8.08380\n", + " 4 691412 8.08050\n", + " 5 743049 8.07740\n", + " 6 605874 8.05650\n", + " 7 787982 8.04570\n", + " 8 779772 8.03540\n", + " 9 1360375 8.03010\n", + "10 1643780 8.02680\n", + "11 112904 8.02360\n", + "12 1425213 8.01630\n", + "13 966314 8.01330\n", + "14 1571386 8.00700\n", + "15 497237 8.00290\n", + "16 878434 8.00290\n", + "17 350574 7.99980\n", + "18 1544772 7.97790\n", + "19 161353 7.97340\n", + "20 486218 7.96780\n", + "21 1091510 7.94770\n", + "22 1173589 7.94630\n", + "23 268918 7.94180\n", + "24 999017 7.92920\n", + "25 600733 7.92610\n", + "26 1549372 7.91820\n", + "27 581918 7.91180\n", + "28 33430 7.91090\n", + "29 126680 7.89990\n", + "30 1593423 7.87880\n", + "31 1292138 7.87830\n", + "32 940791 7.87700\n", + "33 1201683 7.87470\n", + "34 314262 7.85350\n", + "35 976335 7.84830\n", + "36 1265234 7.83090\n", + "37 176972 7.82490\n", + "38 349711 7.82400\n", + "39 167246 7.81940\n", + "40 1383863 7.81910\n", + "41 297667 7.81610\n", + "42 1093691 7.81480\n", + "43 679673 7.81380\n", + "44 1533463 7.80410\n", + "45 367145 7.79960\n", + "46 218634 7.79710\n", + "47 336347 7.79470\n", + "48 1264548 7.79300\n", + "49 971992 7.78910\n", + "50 1169113 7.78890\n", + "51 1381463 7.78770\n", + "52 1140007 7.78760\n", + "53 1318119 7.78650\n", + "54 715097 7.78650\n", + "55 1136196 7.78590\n", + "56 989004 7.77990\n", + "57 1421430 7.77670\n", + "58 570596 7.77660\n", + "59 1093375 7.77570\n", + "60 1105942 7.76870\n", + "61 374897 7.76870\n", + "62 910196 7.76870\n", + "63 831332 7.76520\n", + "64 131413 7.76010\n", + "65 93600 7.75540\n", + "66 1240564 7.75200\n", + "67 230998 7.75030\n", + "68 1455610 7.74860\n", + "69 1137145 7.74630\n", + "70 9067 7.74430\n", + "71 928987 7.74330\n", + "72 490279 7.73470\n", + "73 1035812 7.73370\n", + "74 667817 7.72950\n", + "75 1227715 7.72870\n", + "76 882034 7.72430\n", + "77 1392009 7.72270\n", + "78 1019902 7.71940\n", + "79 122411 7.70920\n", + "80 1587837 7.70820\n", + "81 117482 7.70600\n", + "82 855859 7.70600\n", + "83 368480 7.70500\n", + "84 711770 7.70430\n", + "85 1523966 7.70410\n", + "86 1646424 7.69950\n", + "87 409954 7.69830\n", + "88 1580381 7.69750\n", + "89 1454452 7.69430\n", + "90 307632 7.69340\n", + "91 1283001 7.69240\n", + "92 951992 7.69130\n", + "93 1121061 7.68740\n", + "94 828036 7.68740\n", + "95 1586099 7.68110\n", + "96 1243454 7.67930\n", + "97 1129931 7.67830\n", + "98 4701 7.67530\n", + "99 452561 7.67470\n", + "100 407543 7.67230\n" + ] + } + ], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-simple-pyserini')\n", + "hits = searcher.search('iphone chargers', 100)\n", + "\n", + "for i in range(len(hits)):\n", + " print(f'{i+1:2} {hits[i].docid:4} {hits[i].score:.5f}')" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "ee1f6d33", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cloning into 'esci-data'...\n", + "remote: Enumerating objects: 124, done.\u001b[K\n", + "remote: Counting objects: 100% (88/88), done.\u001b[K\n", + "remote: Compressing objects: 100% (63/63), done.\u001b[K\n", + "remote: Total 124 (delta 49), reused 48 (delta 24), pack-reused 36\u001b[K\n", + "Receiving objects: 100% (124/124), 390.33 KiB | 4.94 MiB/s, done.\n", + "Resolving deltas: 100% (59/59), done.\n", + "Filtering content: 100% (2/2), 1.08 GiB | 39.45 MiB/s, done.\n" + ] + } + ], + "source": [ + "! git clone https://github.com/amazon-science/esci-data.git" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "ebfc7c24", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "shopping_queries_dataset_examples.parquet\r\n", + "shopping_queries_dataset_products.parquet\r\n", + "shopping_queries_dataset_sources.csv\r\n" + ] + } + ], + "source": [ + "! ls esci-data/shopping_queries_dataset" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "fe4f8a50", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "df_examples = pd.read_parquet('esci-data/shopping_queries_dataset/shopping_queries_dataset_examples.parquet')\n", + "df_products = pd.read_parquet('esci-data/shopping_queries_dataset/shopping_queries_dataset_products.parquet')\n", + "df_sources = pd.read_csv(\"esci-data/shopping_queries_dataset/shopping_queries_dataset_sources.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "fbeda51b", + "metadata": {}, + "outputs": [], + "source": [ + "df_examples_products = pd.merge(\n", + " df_examples,\n", + " df_products,\n", + " how='left',\n", + " left_on=['product_locale','product_id'],\n", + " right_on=['product_locale', 'product_id']\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "2b1f3423", + "metadata": {}, + "outputs": [], + "source": [ + "df_task_1 = df_examples_products[df_examples_products[\"small_version\"] == 1]\n", + "df_task_1_train = df_task_1[df_task_1[\"split\"] == \"train\"]\n", + "df_task_1_test = df_task_1[df_task_1[\"split\"] == \"test\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "1c57079d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train Labels 781638\n", + "Dev Labels 336373\n" + ] + } + ], + "source": [ + "print(\"Train Labels {}\".format(len(df_task_1_train)))\n", + "print(\"Dev Labels {}\".format(len(df_task_1_test)))" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "10df0150", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "29844\n" + ] + } + ], + "source": [ + "qid2query = {}\n", + "for row in df_task_1_train.iterrows():\n", + " if row[1]['product_locale'] == 'us':\n", + " qid = int(row[1]['query_id'])\n", + " query_text = row[1]['query']\n", + " qid2query[qid] = query_text\n", + "\n", + "for row in df_task_1_test.iterrows():\n", + " if row[1]['product_locale'] == 'us':\n", + " qid = int(row[1]['query_id'])\n", + " query_text = row[1]['query']\n", + " qid2query[qid] = query_text\n", + " \n", + " \n", + "with open('qid2query.tsv','w') as w:\n", + " for qid in qid2query:\n", + " w.write(\"{}\\t{}\\n\".format(qid, qid2query[qid]))\n", + " \n", + " \n", + "print(len(qid2query))" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "c8a8a402", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "There are 20888 queries in the train postion of the dataset\n", + "An example query and its judgements is:\n", + "{'query_text': '!awnmower tires without rims', 'labels': {1049092: 0, 314519: 3, 689593: 0, 717649: 2, 1397156: 3, 1095149: 3, 341130: 1, 911618: 3, 831070: 2, 1624211: 0, 116997: 2, 1399124: 3, 1035122: 3, 932695: 0, 580389: 0}}\n" + ] + } + ], + "source": [ + "train = {}\n", + "for row in df_task_1_train.iterrows():\n", + " if row[1]['product_locale'] == 'us':\n", + " try:\n", + " qid = int(row[1]['query_id'])\n", + " query_text = row[1]['query']\n", + " label = label_map2[row[1]['esci_label']]\n", + " if label >= 0:\n", + " pid = row[1]['product_id']\n", + " if qid not in train:\n", + " train[qid] = {}\n", + " train[qid]['query_text'] = query_text\n", + " train[qid]['labels'] = {}\n", + " trec_id = asin2trecid[pid]\n", + " train[qid]['labels'][trec_id] = label\n", + " except:\n", + " pass\n", + "print(\"There are {} queries in the train postion of the dataset\".format(len(train)))\n", + "print(\"An example query and its judgements is:\\n{}\".format(train[1]))" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "id": "7699d41c", + "metadata": {}, + "outputs": [], + "source": [ + "with open('product-search-train.qrels','w') as w:\n", + " for qid in train:\n", + " for doc_id in train[qid]['labels']:\n", + " relevancy = train[qid]['labels'][doc_id]\n", + " w.write(\"{}\\t0\\t{}\\t{}\\n\".format(qid, doc_id, relevancy))" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "id": "b453f15b", + "metadata": {}, + "outputs": [], + "source": [ + "with open('product-search-train-qrels.jsonl','w') as w:\n", + " for qid in train:\n", + " for doc_id in train[qid]['labels']:\n", + " relevancy = train[qid]['labels'][doc_id]\n", + " j = {'qid':qid, 'Q0':'Q0', 'docid':doc_id, 'rel':relevancy }\n", + " w.write(\"{}\\n\".format(json.dumps(j)))\n", + "\n", + "from pyarrow import json\n", + "table = json.read_json('product-search-train-qrels.jsonl') \n", + "pq.write_table(table, 'product-search-train-qrels.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "id": "29d4317c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
example_idqueryquery_idproduct_idproduct_localeesci_labelsmall_versionlarge_versionsplitproduct_titleproduct_descriptionproduct_bullet_pointproduct_brandproduct_color
3232!qscreen fence without holes2B07D7TBSGHusI11testFOTMISHU 6Pcs Greenhouse Hoops Rust-Free Grow ...<p><b>Description:</b><br><b>Material:</b>plas...►Material -- High-quality plastic coated steel...FOTMISHUgreen
3333!qscreen fence without holes2B07DHT2WZKusI11testZippity Outdoor Products ZP19028 Unassembled M...NoneDesigned for the Madison Vinyl Fence (item ZP1...Zippity Outdoor ProductsWhite
3434!qscreen fence without holes2B07DHX8YH2usE11testZippity Outdoor Products ZP19026 Lightweight P...NoneDesigned as a portable fence for temporary eve...Zippity Outdoor ProductsWhite
3535!qscreen fence without holes2B07DS1YCRZusS11testColourTree 4' x 50' Green Fence Privacy Screen...None★【Virgin, UV Stabilized Compounds & Thick Mate...ColourTreeGreen 2nd Generation
3636!qscreen fence without holes2B07DS3J3MBusS11testColourTree 6' x 50' Black Fence Privacy Screen...None★【Virgin, UV Stabilized Compounds & Thick Mate...ColourTreeBlack 2nd Generation
.............................................
26211632621163フリクション 消しゴム130645B00JET12SWjpE11testパイロット フリクションボールメタル専用 消去用ラバー グラデーションブラック LFBTRU...NoneNonePILOTNone
26211642621164フリクション 消しゴム130645B00JET11BUjpE11testパイロット フリクションボール専用 消去用ラバー ピンク LFBTRU10-PNoneNonePILOTNone
26211652621165フリクション 消しゴム130645B007M8TLZIjpE11testPilot フリクション消しゴム グレー (ELF-10-GY)Noneパイロット フリクション消しゴム グレー\\nグレー\\nフリクションペン用消しゴム。PILOTグレー
26211662621166フリクション 消しゴム130645B004ECLQHQjpI11testパイロット 消せるカラーサインぺン フリクションカラーズ 12色 SFC-120M-12CNone【フリクション】こすると消えるカラーペン\\n【特長】こするとインキが透明に/こすっても消しカ...PILOT12色セット
26211672621167フリクション 消しゴム130645B00M8UMT3QjpE11testパイロット フリクションボール4ウッド専用 消去用ラバー ブラック用 LFBFRU23-B【商品特長】 ●フリクションボール4ウッドのブラックに合う消去用ラバーです。 他の商品にはご...LFBFRU23-BPILOTNone
\n", + "

336373 rows × 14 columns

\n", + "
" + ], + "text/plain": [ + " example_id query query_id product_id \\\n", + "32 32 !qscreen fence without holes 2 B07D7TBSGH \n", + "33 33 !qscreen fence without holes 2 B07DHT2WZK \n", + "34 34 !qscreen fence without holes 2 B07DHX8YH2 \n", + "35 35 !qscreen fence without holes 2 B07DS1YCRZ \n", + "36 36 !qscreen fence without holes 2 B07DS3J3MB \n", + "... ... ... ... ... \n", + "2621163 2621163 フリクション 消しゴム 130645 B00JET12SW \n", + "2621164 2621164 フリクション 消しゴム 130645 B00JET11BU \n", + "2621165 2621165 フリクション 消しゴム 130645 B007M8TLZI \n", + "2621166 2621166 フリクション 消しゴム 130645 B004ECLQHQ \n", + "2621167 2621167 フリクション 消しゴム 130645 B00M8UMT3Q \n", + "\n", + " product_locale esci_label small_version large_version split \\\n", + "32 us I 1 1 test \n", + "33 us I 1 1 test \n", + "34 us E 1 1 test \n", + "35 us S 1 1 test \n", + "36 us S 1 1 test \n", + "... ... ... ... ... ... \n", + "2621163 jp E 1 1 test \n", + "2621164 jp E 1 1 test \n", + "2621165 jp E 1 1 test \n", + "2621166 jp I 1 1 test \n", + "2621167 jp E 1 1 test \n", + "\n", + " product_title \\\n", + "32 FOTMISHU 6Pcs Greenhouse Hoops Rust-Free Grow ... \n", + "33 Zippity Outdoor Products ZP19028 Unassembled M... \n", + "34 Zippity Outdoor Products ZP19026 Lightweight P... \n", + "35 ColourTree 4' x 50' Green Fence Privacy Screen... \n", + "36 ColourTree 6' x 50' Black Fence Privacy Screen... \n", + "... ... \n", + "2621163 パイロット フリクションボールメタル専用 消去用ラバー グラデーションブラック LFBTRU... \n", + "2621164 パイロット フリクションボール専用 消去用ラバー ピンク LFBTRU10-P \n", + "2621165 Pilot フリクション消しゴム グレー (ELF-10-GY) \n", + "2621166 パイロット 消せるカラーサインぺン フリクションカラーズ 12色 SFC-120M-12C \n", + "2621167 パイロット フリクションボール4ウッド専用 消去用ラバー ブラック用 LFBFRU23-B \n", + "\n", + " product_description \\\n", + "32

Description:
Material:plas... \n", + "33 None \n", + "34 None \n", + "35 None \n", + "36 None \n", + "... ... \n", + "2621163 None \n", + "2621164 None \n", + "2621165 None \n", + "2621166 None \n", + "2621167 【商品特長】 ●フリクションボール4ウッドのブラックに合う消去用ラバーです。 他の商品にはご... \n", + "\n", + " product_bullet_point \\\n", + "32 ►Material -- High-quality plastic coated steel... \n", + "33 Designed for the Madison Vinyl Fence (item ZP1... \n", + "34 Designed as a portable fence for temporary eve... \n", + "35 ★【Virgin, UV Stabilized Compounds & Thick Mate... \n", + "36 ★【Virgin, UV Stabilized Compounds & Thick Mate... \n", + "... ... \n", + "2621163 None \n", + "2621164 None \n", + "2621165 パイロット フリクション消しゴム グレー\\nグレー\\nフリクションペン用消しゴム。 \n", + "2621166 【フリクション】こすると消えるカラーペン\\n【特長】こするとインキが透明に/こすっても消しカ... \n", + "2621167 LFBFRU23-B \n", + "\n", + " product_brand product_color \n", + "32 FOTMISHU green \n", + "33 Zippity Outdoor Products White \n", + "34 Zippity Outdoor Products White \n", + "35 ColourTree Green 2nd Generation \n", + "36 ColourTree Black 2nd Generation \n", + "... ... ... \n", + "2621163 PILOT None \n", + "2621164 PILOT None \n", + "2621165 PILOT グレー \n", + "2621166 PILOT 12色セット \n", + "2621167 PILOT None \n", + "\n", + "[336373 rows x 14 columns]" + ] + }, + "execution_count": 80, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_task_1_test" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "c1ec94a1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "There are 8956 queries in the dev postion of the dataset\n", + "An example query and its judgements is:\n", + "{'query_text': '!qscreen fence without holes', 'labels': {529863: 0, 686755: 0, 20963: 3, 1603474: 2, 1061163: 0, 1551230: 0, 1123804: 3, 607296: 0, 959958: 3, 252024: 3, 1138651: 0, 484543: 0, 1189858: 3, 290002: 0, 326750: 0, 256723: 0, 617589: 0, 935454: 0, 1445740: 3, 528132: 0, 1334602: 3, 1450401: 0, 219550: 3, 1408517: 3, 1319046: 0, 1039500: 0, 598226: 0, 409307: 0, 1624687: 1, 1166881: 3, 549056: 2, 372111: 0, 603328: 0, 404432: 2, 938966: 0, 1273728: 0, 1045313: 0}}\n" + ] + } + ], + "source": [ + "test = {}\n", + "for row in df_task_1_test.iterrows():\n", + " if row[1]['product_locale'] == 'us':\n", + " try:\n", + " qid = int(row[1]['query_id'])\n", + " query_text = row[1]['query']\n", + " label = label_map2[row[1]['esci_label']]\n", + " if label >= 0:\n", + " pid = row[1]['product_id']\n", + " if qid not in test:\n", + " test[qid] = {}\n", + " test[qid]['query_text'] = query_text\n", + " test[qid]['labels'] = {}\n", + " trec_id = asin2trecid[pid]\n", + " test[qid]['labels'][trec_id] = label\n", + " except:\n", + " pass\n", + "print(\"There are {} queries in the dev postion of the dataset\".format(len(test)))\n", + "print(\"An example query and its judgements is:\\n{}\".format(test[2]))" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "id": "94332b29", + "metadata": {}, + "outputs": [], + "source": [ + "with open('product-search-dev.qrels','w') as w:\n", + " for qid in test:\n", + " for doc_id in test[qid]['labels']:\n", + " relevancy = test[qid]['labels'][doc_id]\n", + " w.write(\"{}\\t0\\t{}\\t{}\\n\".format(qid, doc_id, relevancy))" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "id": "89ada266", + "metadata": {}, + "outputs": [], + "source": [ + "with open('product-search-dev-qrels.jsonl','w') as w:\n", + " for qid in test:\n", + " for doc_id in test[qid]['labels']:\n", + " relevancy = test[qid]['labels'][doc_id]\n", + " j = {'qid':qid, 'Q0':'Q0', 'docid':doc_id, 'rel':relevancy }\n", + " w.write(\"{}\\n\".format(json.dumps(j)))\n", + "\n", + "from pyarrow import json\n", + "table = json.read_json('product-search-dev-qrels.jsonl') \n", + "pq.write_table(table, 'product-search-dev-qrels.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 138, + "id": "471caa6a", + "metadata": {}, + "outputs": [], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-simple-pyserini')\n", + "with open('pyserini-simple-dev.run','w') as w:\n", + " for qid in test:\n", + " hits = searcher.search(test[qid]['query_text'], 1000)\n", + " for i in range(0,len(hits)):\n", + " w.write(\"{}\\t0\\t{}\\t{}\\t{}\\tpyserini-simple\\n\".format(qid,hits[i].docid, i,hits[i].score))" + ] + }, + { + "cell_type": "code", + "execution_count": 139, + "id": "8293043a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "nDCG@10\t0.2134\r\n", + "P@5\t0.2377\r\n", + "P(rel=2)@5\t0.2216\r\n", + "Judged@10\t0.2080\r\n", + "R@1000\t0.5957\r\n" + ] + } + ], + "source": [ + "! ir_measures ../product-Search-Qrels-v0.1/data/product-search-dev.qrels pyserini-simple-dev.run nDCG@10 P@5 'P(rel=2)@5' Judged@10 R@1000" + ] + }, + { + "cell_type": "code", + "execution_count": 137, + "id": "c6bd392b", + "metadata": {}, + "outputs": [], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-full-pyserini')\n", + "with open('pyserini-full-dev.run','w') as w:\n", + " for qid in test:\n", + " hits = searcher.search(test[qid]['query_text'], 1000)\n", + " for i in range(0,len(hits)):\n", + " w.write(\"{}\\t0\\t{}\\t{}\\t{}\\tpyserini-full\\n\".format(qid,hits[i].docid, i,hits[i].score))" + ] + }, + { + "cell_type": "code", + "execution_count": 140, + "id": "297aedec", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "nDCG@10\t0.2478\r\n", + "P@5\t0.2720\r\n", + "P(rel=2)@5\t0.2552\r\n", + "Judged@10\t0.2436\r\n", + "R@1000\t0.6631\r\n" + ] + } + ], + "source": [ + "! ir_measures ../product-Search-Qrels-v0.1/data/product-search-dev.qrels pyserini-full-dev.run nDCG@10 P@5 'P(rel=2)@5' Judged@10 R@1000" + ] + }, + { + "cell_type": "markdown", + "id": "0d92ea00", + "metadata": {}, + "source": [ + "## Since We do not have a publicly avaible test set we go ahead and construsct one using a few methods. First, we generate spearfished queries. In other words queries which have have a direct desire for an exact match title or product id. We go ahead and generate 1000" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "7e9fdaa8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "29844" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(qid2query)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "ee2f595c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "starting to generate test queries\n", + "done generating spearfishing queries. Generating queries using LLM\n", + "0 queries generated\n", + "100 queries generated\n", + "200 queries generated\n", + "300 queries generated\n", + "400 queries generated\n", + "30734\n", + "926\n", + "{100000: 'Nike Kids Tanjun (GS) December Sky/White Running Shoe', 100001: 'Avidlove Garter Lingerie For Women Sexy Lace Teddy', 100002: 'Lovelyshop Blue Gems Rhinestone', 100003: 'B077YKYT68', 100004: \"Under Armour Men's Jungle Rat Tactical\", 100005: 'qnprt Old Lady Costume', 100006: 'B073RNKSYP', 100007: 'Baseball Display Case | Baseball Holders for Balls', 100008: 'B00APRTZ1I', 100010: 'PISSION Waterproof Cases Ultra Slim Full Body Protective', 100011: 'Baby Toddler Girls Long Sleeve', 100012: 'Skater SIH3ST-A Snoopy Mix', 100015: 'Kinto 22830 ROSETTE Champagne Glass,', 100016: 'Blushing Cherry Blossom Fragrance Oil (60ml) For', 100017: 'Lion Odor Absorbing Sand, Scent Plus,', 100018: 'B015JPRSAK', 100020: 'Only Boxes, Pack 20 Cajas de Archivo, Montaje', 100021: 'Blink Mini 2-meter USB cable (White)', 100023: 'B07YNS1C8X', 100024: 'Cecotec Plancha Vertical Fast&Furious', 100025: 'Summer Clean Rinse Baby Bather (Gray)', 100027: 'Itaba Pain Bag Cute Wallet Pochette Shoulder', 100029: 'B07G9QTCRP', 100031: 'B087M61CCL', 100032: 'B08D68H88P', 100033: 'GUM Junior Mouthwash Calies Prevention 10.1 fl oz (300 ml)', 100034: \"Rubie's Kid's Baby Shark Costume with Sound Chip\", 100035: 'Maxone 250GB Ultra Slim', 100036: 'Homemaker Spiralizer, Spiral Vegetable Slicer & Zucchini Pasta', 100037: '0618149163', 100038: 'Eternal Nail Polish Set (BEACH WALK)', 100039: 'B08KFVDK71', 100040: 'MEGATEK Portable CD Player/Radio/Bluetooth Boombox with', 100042: 'New Balance ML574 Sneakers', 100043: 'B00EWSDCC4', 100044: 'Rise Pea Protein Bar,', 100045: 'WXBOOM 100pcs 10mm Colorful', 100046: 'B07SDGB8XG', 100047: 'B00CBX8F3I', 100048: 'True Temper R6STFFEC 6 Cu. Ft Steel', 100049: 'B01AVIT1ZU', 100050: 'Dryer Vent Cleaner kit, 24 Feet', 100051: 'HEADLIGHTSDEPOT Black Housing Halogen Headlights Compatible with', 100052: 'B08HKZ7TT3', 100053: 'La Pastiche overstockArt Renoir Discarded Roses Artwork with Victorian Gold', 100054: 'Newborn Baby Girls Sunflower Romper Off', 100055: 'B00VLVESDW', 100056: 'Detroit Axle - 4WD 8-Lug Front Wheel', 100057: 'Glam And Glits Acrylic Powder Color Blend Collection BL3017 Touch', 100059: \"Casio Men's Twin Sensor\", 100060: \"KEEN Utility Men's Atlanta\", 100061: 'All Material Handling ML003-05 Mini', 100062: 'B0096FHS6E', 100063: 'Casifor Electric Nail Clipper for', 100064: 'Fabri.YWL 1955 Ford Thunderbird Vintage Look Reproduction', 100065: 'Berberine Plus 1200mg Per', 100066: 'Magical War Mug Coffee Cup Tea', 100067: 'B00KFU49K2', 100068: 'RJ-Sport No-Tie, Elastic Shoelaces,', 100069: 'B08T12DNFS', 100070: 'B07GDQ9SJY', 100071: 'JACQUET Plain Crepe 10PK, 10.5', 100072: 'B00PZLPIKQ', 100073: 'Dinosaur Pee Pee Teepee Wee', 100074: '8499151418', 100075: 'Set of 2 Embroidered Beaded', 100077: 'B01K8RJ5GY', 100078: \"Rocket Dog Women's Frannb Mule\", 100079: 'B077ZRMYQW', 100081: 'MUSETEX 6 RGB LED Dual Fans 2 Translucent Tempered', 100082: 'Harley-Davidson Enjoy Ride Oval Embossed Tin Sign, 18', 100083: 'LO QUE EL VIENTO SE', 100084: 'Tommy Hilfiger Reloj Analógico de Cuarzo para mujer', 100085: 'BLUU MAPLE 9 FT Patio Market', 100086: \"Nike Kids' Grade School Zoom Air Pegasus\", 100087: 'SPITZ JAMBOREE TOUR 2016\"醒 め', 100088: '2WEEKメニコン プレミオ 【BC】8.6【PWR】-4.50 6枚入 4箱', 100090: 'B0759VPQM7', 100091: 'B002PQCKO6', 100093: 'Western Stars [Clear With Blue Smoke', 100094: 'B07QPT11QP', 100095: 'Sorel Womens Nakiska Slide II Slipper Winter Durable', 100096: 'Universal Air Conditioner EV 939765PFC A/C', 100097: '[Curiace Trading(キュリアストレーディング)] 45QT クーラーボックス', 100098: 'Hisencn Gas Grill Repair', 100099: 'B01LE7U1PG', 100100: 'B09CYHJD4K', 100103: 'CRAFTSMAN CMXZVBE38759 2-1/2 in. x 20 ft. POS-I-LOCK', 100104: '(35 Pack) Premium Lids for Chafing Pans 9\" x 13\"', 100105: \"Fashion Forms Women's Ultimate Silicone Gel Petals\", 100106: 'Loctite (Lock Tight) Screw Loose Stop for Tired, Glue 241', 100107: 'B074HJ5T1K', 100108: 'Dietorelle, Caramelo masticable - 800 gr.', 100109: 'Rothco Leather Regular Width', 100110: \"Il paese che non c'è. Ediz. a\", 100111: 'MUEBLIX | Literas Juveniles 90x190 | Estructura', 100112: 'B07BZQVKMP', 100113: 'B07GL4K3YJ', 100115: 'SanDisk Ultra SDSQUNA-128G-GHENA Micro SD Card', 100116: 'Perricone MD Neuropeptide Facial Conformer', 100117: 'B08MKTZJR2', 100118: '4496025477', 100119: \"Koolaburra by UGG Women's Milo Slipper\", 100120: 'B0794P3M4D', 100121: 'RAKU Cat Tower, Cardboard House,', 100122: 'B07WZV8442', 100123: 'B004TB7B1M', 100124: 'YINHONYUHE Mascarilla Quirúrgica Desechable Homologada, 50', 100125: '6 Pcs Mini Pop Fidget Toy,Mini Push Pop', 100126: 'B00DG08B7U', 100127: 'B07L5T6XJJ', 100128: \"adidas Women's Must Haves Winners Tee\", 100129: 'ZINUS Owen Wood Platform', 100130: 'Designsify All I Care About is Baton', 100131: 'Oakley XS O-Frame MX', 100133: 'DC Collectibles Batman Arkham Origins', 100134: 'Common Sense is So', 100135: 'B07TVKLVCV', 100137: 'Chicos - Moto Correpasillos Mini Custom de Color Fucsia con', 100138: 'GreatNeck 7 Piece Nut Driver Set', 100139: 'Soft Spiked Light Up Bracelets with Flashing Blinking LED Lights', 100140: 'BLU G9 PRO | 2020 | All Day Battery |', 100141: 'SOAIY 2x40cm Luz bajo mueble cocina con sensor movimiento de', 100142: 'B07PB8W7X9', 100143: 'B07MLRRGFS', 100145: \"Daily Ritual Women's Supersoft\", 100146: 'KIMERA SAMURAI Coconut Creamer -', 100147: 'B077NSZ9PX', 100148: 'B09CPYFGBM', 100149: 'Onvian Bike Alarm with Remote, Wireless', 100151: 'B08HHD837Q', 100152: 'Rain-X 800002243 Glass Treatment- 7 fl oz.', 100153: 'Dyson Gentle Air Attachment', 100154: 'Musiclily Metric 3 Way Guitar Pickup Toggle', 100155: 'B08FB63V49', 100156: 'B07L92PSMP', 100157: 'B07BXJTF7Z', 100158: 'Viper Billiard Master 2-1/4\" Regulation Size Billiard/Pool Balls,', 100159: 'WACACO Nanopresso con NS Adapter,', 100161: 'Amazon Basics 18-Piece Stoneware Dinnerware Set - Smokey', 100162: 'B083MV5562', 100163: '1790611903', 100164: 'B074M44VZ6', 100165: 'BornBeauty Mini USB LED Nail', 100166: 'B07R7RGW3J', 100167: 'WolVolk Police Helicopter - Solid Built Push & Go', 100168: 'B082QZMV9J', 100170: 'B087JH899Q', 100171: 'Coppertone Defend & Care Sensitive Skin Sunscreen Lotion Broad', 100172: '0375430490', 100173: 'Tminnov Baby Diaper Caddy', 100174: 'B0052MQVK4', 100175: 'B08YJV89QG', 100176: 'B07R5H8QSY', 100177: 'Iridescent Metal Lighter Case for BIC Lighters, Lighter', 100178: 'B07VPFJ167', 100179: 'B077359MBL', 100180: 'Nagai Kosan Side Table, White, Top Plate, 11.8 x 11.8', 100183: 'Dove Men+Care Dermacare Scalp', 100184: 'B07G5VGD13', 100185: \"Columbia Men's Ascender Softshell Jacket\", 100186: 'Focus Foodservice 905525 Cupcake Muffin Pan,', 100187: 'LUMAR Ordenador Gaming Sobremesa', 100188: 'Vornado MD1-0018 Replacement Ultrasonic', 100189: 'Digital Innovations 4190100 Clean Dr.', 100190: 'The Heirloom Life Gardener:', 100191: 'B07CK1MSV9', 100193: \"Lapurete's® Paquete de 10 Gramos De 25 Paquetes\", 100194: 'Acer V6 V196LB 19\" HD', 100195: 'Streamlight 75458 Stinger DS LED HL 800-Lumen Rechargeable Dual Switch', 100196: 'B07DWNR63S', 100197: 'B07C6P9QHC', 100198: 'Alex Evenings womens Plus Size Midi Scoop Neck Shift', 100199: 'Staub Cast Iron 3.5-qt Braiser with Glass Lid -', 100200: 'B00XA7SGK6', 100201: \"Nesseo Men's Compression Wear,\", 100202: 'B00CP53EYC', 100203: 'TRUE LINE Automotive Universal 7 Inch', 100204: \"Smiffy's - Disfraz de princesa griega\", 100205: 'California Grown Organic Jujube Red Dates,', 100206: 'Yammy - Pack Primeras Frutas -', 100207: 'Trilogía de Aléxandros: El hijo del sueño | Las arenas', 100208: 'B087CZZNDJ', 100210: 'Junta Universal Impacto Juego Articulaciones En U', 100211: 'B07MPCJDXS', 100214: 'B07VVNQ8QQ', 100215: 'Mug - Ceramic Tea/Coffee -', 100216: 'Steam Iron with Retractable Cord, 1200W Steam Iron Auto', 100217: 'B07RGWMM8Y', 100218: 'B00MEHLYY8', 100220: 'Alnorm Conjunto de Bufanda y', 100221: 'B007BT4YKU', 100222: 'para iPad Mini 1/2/3 7.9 Pulgadas Cubierta de', 100224: 'Onion Holder, Newness All-in-One', 100225: 'YOZLY Nightgown Womens Cotton Knit Long Sleepwear', 100226: '1559570504', 100227: 'B07P211Q4R', 100228: 'Closecret Lingerie Women’s 6 Pack Seamless Underwear', 100229: 'Lixada Esterilla de Yoga TPE Insípido con Línea de Posición', 100230: 'B089CFZJGX', 100231: 'newgarden Lampara de pie Lola', 100232: \"Timex Men's TW4B18500 9J\", 100233: 'NYHI 50-Pack Extra Small Disposable Aluminum Oblong Foil Pans with', 100234: 'B001D1KO8S', 100235: 'siawadeky Bouquet, Message Cards, 9 Types,', 100236: 'BIANGEY Mesa de Picnic de Madera', 100237: '9000047A Face Shields, 10 Pieces, Face Protection', 100238: 'Wood Trick Wooden Toy Train Set with', 100239: 'B07PVF1V6L', 100240: 'Pure Encapsulations PureResponse Multivitamin | Support for', 100241: 'Aqueon MiniBow LED Kit, 2.5', 100242: 'B079SHC4SM', 100243: 'B077YJ4818', 100244: 'Casio Wave Ceptor WVA-M650', 100245: \"Ekouaer Long Nightgown,Women's Loungewear Short Sleeve\", 100246: 'SPLOTY Tire Inflator Air Compressor Portable 12V', 100247: 'Badge Magic Hemming Tape Peel & Stick', 100248: 'B08LP1LXL6', 100249: 'Suction Cup Hooks, Set of 6, 2\" Clear Heavy', 100251: \"Simple Joys by Carter's baby-girls 4-Piece Fleece\", 100252: 'onlypuff Pocket Shirts for Women Casual', 100253: 'TRUSCO TOWEP-4050-10P Economy Type Water Oil', 100255: \"United Athle 508801 Men's\", 100256: 'Sparhai24 10 filtros de repuesto G4 para Zehnder ComfoAir 350', 100257: 'Acrylic Paint - Apple Barrel 12 pack', 100258: 'Smithsonian Handbooks: Insects (Smithsonian Handbooks) (DK', 100259: 'Lazy Susan Turntable Organizer, Non Skid', 100260: 'B07T9ND2BF', 100261: 'B08TB3V7B9', 100262: 'B09G9SZ71X', 100263: 'B0731PD7C9', 100264: 'B07H9LJN3T', 100265: 'B07NVRZJDD', 100266: 'B008U2X1KG', 100267: 'B07C1XSMN4', 100269: 'MyGift 4-Inch Unglazed Gray Cement', 100271: 'Nurse Clothes, Extreme, Cute, Sexy, Thin,', 100272: 'AGF ブレンディ ナチューム かぼちゃのラテ 4本 ×4個 【 デカフェ・ノンカフェイン 】', 100273: 'White Tissue Paper for Gift Wrapping, Gift Packaging, Floral,', 100274: 'B071RGX6LV', 100275: 'B00S3R6HXG', 100276: 'SureFire G2X Pro 600', 100277: 'Nordic Ware Platinum Collection Anniversary Bundtlette', 100278: 'Toozey Dog Pooper Scooper, Upgraded Adjustable Long', 100280: 'Extra Large Moist Heating Pad', 100281: 'iDecorlife Premium White 11x14 Picture Frames', 100282: 'B09C16WHCH', 100283: 'InvisiClean Aura II Air Purifier for Home', 100284: 'Mi primer libro para', 100285: 'B086D1466V', 100286: 'B07QD24H8T', 100287: 'B00DBY5TD0', 100288: 'B01791EBIE', 100289: 'B07F19SNL9', 100290: 'DEWALT Miter Saw Stand, Heavy', 100292: 'B00B55Y2X0', 100294: 'Gueray Portable CD Player,', 100296: 'B094NTGK6Y', 100297: 'B010NZV0GE', 100298: 'HAPY SHOP 80 Pcs Silver Alligator Hair', 100299: \"Kindness Rocks: A children's book about kindness, empathy and growth\", 100300: 'B07SN13BSS', 100301: 'Tampón de Tinta Trodat 9052', 100302: 'MYSTERY RANCH 19761326 GALLAGATOR Gallagator 4.9 gal (19 L)', 100303: 'Kids Headphones Bulk 5 Pack', 100304: 'Bandai Hobby RX-78-2 Gundam \"Mobile Suit Gundam\" Perfect', 100305: 'B00DXI3JZO', 100308: 'NutraBio PRE Stim Free – Caffeine Free', 100309: 'B07QMKCZQ8', 100310: 'Mimosa Bar Sign But First Mimosas - Gold foil', 100314: 'Nantucket Neighbors (Nantucket Beach Plum Cove Book 2)', 100315: 'Lawson Exclusive Fall Rilakkuma', 100316: 'B01FGBS342', 100317: 'NIXIUKOL Batidora de Mano 1000W,', 100318: 'Contigo AUTOSEAL Courtney Kids & Tweens', 100319: 'Portable RGB Gaming Mechanical Keyboard USB Type', 100321: 'B07T81S8M3', 100322: 'Elite (Elite) Volano/drivo/Kura For Body 329770001', 100323: 'B083PQBTB7', 100324: 'Equal-i-zer 91-00-4250 High Performance Lubricant (4', 100326: 'Happiness Store 縄跳び 大繩 長なわ', 100327: 'Connectyle Kids Wide Brim Mesh', 100328: '0310701287', 100329: 'B07C76SDJ6', 100330: 'Talking Products, Talking Tile', 100331: 'Nine Forty Industrial Strength Ultimate', 100332: 'JONATHAN Y SMB108D-9 Ourika Moroccan Geometric', 100333: 'B00HD41I8E', 100334: 'Embryolisse Lait-crème Fluid 75ml', 100335: 'B01LZWW2FD', 100336: 'B07TZ3DKT9', 100337: 'URAQT Diademas Mujer, Boho Diademas para', 100338: 'Mell-Chan Dress-Up Set, Boys Kindergarten Outfit', 100340: 'B07WWJHD25', 100341: 'Music Notes Notation Band Wall Sticker Decal,', 100342: 'Depory Safety Pantalla Facial, Casco de', 100345: 'B001197PV6', 100346: 'UCGOU Bubble Mailers 7.25x12 Inch Teal 25 Pack', 100347: \"O'NEILL Men's Standard Surf Tie Boardshorts\", 100348: 'B00SQW5KFO', 100349: 'Part Another Former Car Play Technique – Ready to Use,', 100350: 'Google Wi-Fi System Mesh', 100351: 'B087FCLFZD', 100352: 'Matching Delivery Robe and Swaddle Blanket', 100353: 'TECHSHARE Faja de cumpleaños, corona de cumpleaños', 100354: 'Honey-Can-Do DRY-04446 Small Wall-Mounted Drying Rack, White', 100355: 'yosager Premium Bird Feeding', 100356: 'Osaki Medical Plus Heart Straw Cup', 100357: 'B00B5ZQLC0', 100358: 'Physicians Formula Highlighter Makeup Powder Mineral Glow Pearls, Light Bronze', 100359: 'XUER Ergonomic Office Chair', 100361: 'Bosch Professional GBH2400 Martillo perforador SDS', 100362: 'B083DPXKDC', 100364: 'Hi-Tech XSK K124 3D/6G RFT Kit XK124', 100365: 'Garmin ECHOMAP Plus 73cv Ice', 100366: 'B07KS4XXV5', 100367: 'Burst B-146 Random Booster Vol.16 (Random Booster', 100368: 'B08HQJKD3G', 100369: 'YONEX AC1025P Tennis Badminton Grip', 100370: 'Wingslove Sujetador Minimizador de Copa', 100371: 'JINGYAT 10 Inch Bamboo', 100372: 'B07WJMLQF3', 100373: '[Kutsujimo Dot Com] Low', 100376: 'B07MBMQNKQ', 100377: 'B01GHS8MA8', 100378: 'B07JK3NWHC', 100379: 'B00CFQWKHI', 100380: \"Spencer 50'/15M Logger Tape Refill\", 100381: 'B07618RK8M', 100383: 'Bosch PY21W Pure Light Lámparas para vehículos -', 100384: 'Sony Xperia XZ Premium', 100385: 'B000WAN7K8', 100386: 'B07BS2X6VP', 100387: 'Bullpadel Mochila BPM Negro/Silver', 100388: 'Granitestone Original Stackmaster 5 Piece Mini', 100389: 'B072PS48NS', 100391: 'B005KS5G60', 100392: 'B086X41FSY', 100393: 'B003WJOD6S', 100394: 'Wilton 300 Count Party Pack Standard Baking', 100395: '888 Display - Pack of 6 Boxes', 100397: 'B0872XGDWJ', 100398: 'B00027LF7S', 100400: 'Santora Hair Dryer, Large Air', 100401: 'B01E5JKS76', 100402: '0307339459', 100403: 'B07YY7F3RZ', 100405: 'B07B9HYBHH', 100406: 'DKB Evian Jetted Whirlpool', 100407: '5G WiFi Projector, WiMiUS', 100408: 'B0892SVFY8', 100409: 'Nerf Mega Accustrike Dart Refill Combat Blaster', 100410: 'Pet Parents Premium Washable Dog', 100412: 'G Organic, Strawberry, Gatorade', 100413: '4776923033', 100415: 'B07LFZ4SCB', 100416: 'B07QZV4WBW', 100418: 'Goodman 4 Ton 14', 100419: 'StoreYourBoard Bike Storage Rack,', 100420: 'B071Z9K2XS', 100422: 'B087FZF3ML', 100424: 'LED Candles, Ymenow Warm', 100425: 'B088KS6934', 100428: 'VAKA Luminous Light Up Quad Roller Skate', 100430: 'Hankook Optimo H724 All-Season Tire -', 100431: 'B078HGY4Z6', 100432: \"Nanatang Badflower Logo Men's Long Sleeve Sweatshirt's\", 100433: 'B07H2JS63P', 100434: 'Hombre Pantalones Harem -', 100435: 'Daiwa Liberty Club Short Swing', 100436: 'Microsoft Surface Laptop 2', 100437: 'B004V23YV0', 100438: 'B01LYOEJHA', 100439: 'Orblue Lemon Zester &', 100440: 'Phosphoric Acid (Tech Grade)', 100441: 'Historic Charleston and the Lowcountry', 100442: 'MISS MOLY Mujer Bragas Moldeadoras Braguitas', 100443: 'Midland - X-TALKER T31VP,', 100444: 'Sobres blancos tamaño 110x220mm con ventana marca Edicards.', 100445: 'B07KSB949J', 100446: 'B07NMLC97P', 100447: 'B06XXZWR52', 100449: 'B007S467YO', 100451: 'B00RINP9HG', 100453: 'Regalos Hombre Originales Gorro Bluetooth', 100454: 'AnnTec LED Candle Light, LED Glass,', 100455: 'Bed Sheet Clips, Set of', 100456: 'B00XDR8ZCC', 100457: \"DELIMIRA Women's Full Coverage\", 100458: 'B00HVI10EO', 100459: 'Canomo Lamp Light Kit Make a', 100460: 'Creanoso Adulting Stickers for Women', 100461: 'SONGSH Canciones Luces Creativas', 100462: \"Cicy Bell Women's Sunflower\", 100463: 'B096YHRZHL', 100464: 'B0090VI9DA', 100465: 'B07TJ1W116', 100466: 'B08HRP82S7', 100467: 'India Hicks: Island Style', 100468: 'Personalized Garden Flag for', 100469: 'B00HKC17R6', 100470: 'B00ADKY6TI', 100471: 'B07DG7DKX5', 100472: 'Reloj analogico Los Vengadores Marvel', 100474: 'Glory Be Saints A to', 100475: 'Pacific Foods Creamy Butternut Squash Soup, Organic, 32', 100477: 'RUNSY Battery Case Compatible with', 100478: 'B01KF72VEA', 100479: 'DKNY Be Delicious Fresh Blossom', 100480: 'GJTr Fluffy Slippers Cushion Hotel Specs', 100481: \"MixMatchy Women's Striped Print Ribbed Knit Crop\", 100482: 'Bathadore Bathroom Sink Drain Stopper', 100483: 'B07N3954DZ', 100484: 'LG Electronics OLED65C7P 65-Inch 4K Ultra', 100485: 'Knox 52430400 Personal Organizer Refill,', 100486: 'B07TDZHM6R', 100487: \"SODA CHOYA Women's Round Toe Faux\", 100488: 'B08MQFZJ17', 100489: 'adidas Fef Pre Jkt Chaqueta', 100490: 'PurO3 Ozonated Coconut Oil with Lavender -', 100491: 'Farm Plastic Supply - Clear Greenhouse Plastic', 100492: 'Sekonic SE L-208 TwinMate', 100493: '6\" Motorcycle Steel Splash Guard Short/Long', 100494: 'Pleasant Hearth FN-5700 Fenwick Fireplace Glass Door,', 100496: 'B07MYK6VRC', 100497: 'Autel TPMS Sensors MX-Sensor 2 in 1 TPS218 (315MHz +', 100498: 'Magna-Tiles Cars Expansion Set, The Original Magnetic', 100499: 'Disney Monsters Inc Slippers Mike Wazowski Character Slipper Socks with', 200000: '\"VIPMOTOZ LED Third Brake Cargo Light for Ford F150 1997-2003\"', 200001: '\"4-player folding card game table with green playing surface and cup holders\"', 200002: 'Bonne B26 bridal headdress beaded motif wedding accessory', 200003: '\"professional hair cutting scissors extremely sharp blades 6 inch barber scissors set for men and women Fagaci\"', 200004: '\"Southwire 50\\' 14/3 Romex indoor electrical wire\"', 200005: 'OneTouch Delica Plus 30 Gauge Lancets for Diabetes Blood Test', 200006: '\"6 ft scaffold 1100 lbs capacity MetalTech Safeclimb Baker Style\"', 200007: '\"16 oz clear plastic cups with flat lids set of 50\"', 200008: '\"Rokinon Cine DS Lens Kit Micro Four Thirds 16mm 35mm 50mm 85mm\"', 200009: '\"Caretech Japan CA-10SU Self-Propelled Aluminum Folding Wheelchair Happiness Blue\"', 200010: '\"Interruptor de apagado automático de batería 12V/24V 300A para barco marino y automóviles\"', 200011: '\"Thader Th Pharma V-Color Kit de Tinte permanente Sin Amoniaco No. 7.03 Rubio medio natural dorado\"', 200012: 'Samsung 32GB USB 3.0 Flash Drive', 200013: \"Carhartt Men's Heavyweight Short-Sleeve Pocket T-Shirt\", 200014: '\"JBL EON610 2-Way Power Speaker portable\"', 200015: '\"Brüder Mannesmann M12420 Elektrotacker\"', 200016: '\"green camouflage RFID trifold canvas wallet for men with mini coin purse and front pocket for kids\"', 200017: 'Plus Size Fairy Godmother Costume Adult Cinderella Cosplay for Women', 200018: 'Elegant satin floral lace ribbon lingerie set', 200019: '\"SEBOWEL Women\\'s Waffle Knit Hoodie Sweatshirt Plus Size\"', 200020: '\"Mermaid tail blanket ocean blue aqua for kids adults teens\"', 200021: '\"historical novel cliff-dwellers\"', 200022: \"KARACTERMANIA children's travel accessory thermal lunch bag\", 200023: '\"6 Pairs Women Dr Motion Graduated Compression Knee High Socks Assorted Floral\"', 200024: 'SUNWILL 14 oz Coffee Mug Set Double Wall Stainless Steel Travel Tumbler Cool Grey & Rose Gold', 200025: '\"Raleigh Cadent 24 inch hybrid bike for kids\"', 200026: 'Amazon Basics 5-Blade Razor Refills for Men 12 Cartridges', 200027: 'Hofdeco nautical indoor outdoor pillow cover navy blue compass anchor 12x20 set of 2', 200028: '\"Tape in hair extensions 20 inch dark brown Remy human hair\"', 200029: '\"Unisex quick drying water shoes for swimming, yoga, snorkeling, beach\"', 200030: '1 inch metal D rings for sewing keychains belts dog leash DIY accessories', 200031: 'Please provide the product title and description for generating an appropriate query.', 200032: '\"ASICS Women\\'s Gel-Venture 7 trail running shoes\"', 200033: '\"Amazon Basics Lightweight Microfiber Bed Sheet Set Twin Bright White 14-inch deep pockets\"', 200034: 'Camiseta técnica 42K Atria para mujer con diseño asimétrico y tejido GEO-TEC', 200035: '\"Rubbermaid Commercial BRUTE 14-Gallon Tote Storage Bin with Lid Gray\"', 200036: 'Nike Youth Legend 7 Club MG Soccer Cleats Black', 200037: '\"POGTMM Women\\'s Fall Long Sleeve O-Neck Patchwork T-Shirt with Thumb Holes\"', 200038: 'Sony PS4 Slim 1TB Black Console with Wifi', 200039: 'Please provide the product title and description for generating a query.', 200040: '\"KACO macaron highlighter marking pens for students\"', 200041: '\"Plastic Pumpkin Trick or Treat Buckets Halloween set of 12\"', 200042: '\"iPhone 11 Pro Max privacy tempered glass screen protector set of 2\"', 200043: '\"Xperia 10 II Blue Light Cut Glass Film Asahi Japanese Ultra Thin Anti-Bubble Anti-Fingerprint\"', 200044: 'Pahajim Women Fashion Purses Handbags Shoulder Tote Bags Top Handle Satchel', 200045: '\"Dogfish 500GB Msata Internal SSD\"', 200046: '\"Women\\'s 2 piece outfits hooded jacket and pants set tracksuit\"', 200047: '\"The North Face men\\'s hoodie Open Gate Camo CG46-287\"', 200048: '\"Spode Christmas Tree Highball Glasses Set of 4\"', 200049: \"Nike Dri-Fit Men's Half Zip Golf Top\", 200050: 'NordECO HOME Luxury Soft Faux Fur Fleece Cushion Cover 16x16 Light Grey 2 Pack', 200051: '\"40mm nickel plated laminated steel padlock pack of 12 with 2-inch long shackle and keys\"', 200052: '\"七月に流れる花 八月は冷たい城 講談社文庫\"', 200053: '\"Jigsaw Puzzle Mat Roll Up for 1500 and 2000 Pieces with Storage and Inflatable Tube\"', 200054: 'Vestido Paw Patrol para niñas La Patrulla Canina Skye', 200055: 'Echo Dot Wall Mount Holder Black AhaStyle', 200056: '\"Women\\'s UPF 50+ cotton linen bucket sun hat beige small\"', 200057: 'Womens black mesh lace bodysuit jumpsuit XL', 200058: \"Under Armour Men's Tech 2.0 Short-Sleeve T-Shirt loose fit quick dry\", 200059: '\"men\\'s sauna suit diet pants sportswear fat burner fitness wear exercise running weight loss black\"', 200060: 'Ailun iPod Touch 7 6 5 TPU Clear Case Slim Lightweight', 200061: '\"no drill tension curtain rod oil rubbed bronze 28-48 inch\"', 200062: '\"blue light blocking gaming reading glasses anti glare uv protection\"', 200063: '\"Osprey Daylite Shoulder Sling for daily essentials and quick hikes\"', 200064: '\"Big Sean Metro Boomin Double Or Nothing Exclusive Metallic Silver Vinyl\"', 200065: '\"詳細! Python 3 入門ノート\" search', 200066: 'Fein StarLock E-Cut Fine Oscillating Saw Blade for Aluminum Profiles and Copper Pipes', 200067: '\"Pinzon 160-Gram Plaid Flannel Cotton Bed Sheet Set Queen Red Grey Plaid\"', 200068: '\"Womens wide brim straw sun hat UPF 50+ summer beach\"', 200069: 'Hokkaido Deer Lotion CICA Ceramide Vitamin C 5.1 fl oz', 200070: '\"octopus hand towel 15x30 decorative bathroom kitchen\"', 200071: '\"PANA Acrylic Nail Brush Size 10 with White Swirl Blue Handle and Pink Ferrule\"', 200072: 'Muga Black Felt Letter Board 12x12 inch with 485 Precut Letters and Stand', 200073: '\"ultra-purified water pack of 12 with solar-powered purification process and oxygen infused\"', 200074: '\"Mighty Gadget 20 pack crepe paper assorted colors\"', 200075: '\"blue butterfly knife training practice bladeless G10 handle\"', 200076: 'hypoallergenic baby bottle dishwashing liquid fragrance free', 200077: '\"high waisted tummy control shapewear for women plus size\"', 200078: '\"Weslo Climber Total Body Workout Vertical Climber Stepper\"', 200079: '\"leakproof mini bento box for kids navy blue\"', 200080: 'コーチ 2way ショルダーバッグ シグネチャー F79998', 200081: '子供用ゲームスマートウォッチ 電話 1.54 HD タッチスクリーン 音楽プレーヤー カメラレコーダー', 200082: '中村食肉 魔法のスパイス マキシマム 万能スパイス', 200083: 'Sabitori Shokunin rust remover spray professional cleaning detergent', 200084: '\"99% pure water baby wipes made in Japan paraben free\"', 200085: '\"Small breed wet dog food Hill\\'s Science Diet Chicken & Barley Recipe\"', 200086: '\"Greystone 0.9 cu ft stainless steel built-in microwave\"', 200087: 'Fate/Grand Order Lancer Tamamo no Mae Ani-Statue Kotobukiya', 200088: 'SALONIA 2-Way Hair Iron Straight & Curly 1.3 inches Professional Grade', 200089: '48 inch wide dacron quilt batting upholstery foam padding', 200090: 'bolso bandolera HP Value Topload para portátiles 14 pulgadas negro', 200091: '\"Cooler Master MasterBox Q500L Micro-ATX Tower with ATX Motherboard Support and Transparent Acrylic Side Panel\"', 200092: '\"PROSTEEL Herringbone Choker Necklace Stainless Steel Sterling Silver\"', 200093: \"L'Or Espresso Ristretto Intensidad 11 cápsulas compatibles Nespresso\", 200094: '\"90 degree right angled Micro USB 2.0 Male to Female extension cable 50cm for tablet phone\"', 200095: 'ドトールコーヒー カフェインレス ドリップパック 20P', 200096: '\"OtterBox Symmetry Disney Princess Mulan iPhone Xs iPhone X case\"', 200097: '\"LOLIAS anillos de pareja plata de ley 925 sol y luna anillo de compromiso ajustable\"', 200098: 'detergente liquido lavavajillas ecover limon aloe vera', 200099: \"Quiksilver Men's Long Sleeve Rashguard UPF 50 Sun Protection Surf Shirt\", 200100: 'Switch protective film Japanese glass blue light reduction water repellent anti-fingerprint', 200101: 'Champú crecimiento cabello con extracto de cebolla y café sin sulfatos ni parabenos', 200102: '\"Knirps T.200 Duomatic paraguas de bolsillo multicolor\"', 200103: '\"Bobolink women\\'s short sleeve yoga tops dri fit workout running shirts\"', 200104: 'Injustice Gods Among Us Omnibus Vol 1', 200105: '10k white gold Singapore chain necklace for women', 200106: 'Black Cast Iron Norfolk Door Latch 8\" Tall Thumb Lock with Mounting Hardware', 200107: 'magnetic dart board for kids boys girls gifts', 200108: '\"Ralph Lauren Meadow Lane Kaley King Comforter Blue Multi\"', 200109: '\"Colchón viscoelástico Titán para dolores de espalda 135x190 firmeza alta\"', 200110: '\"Medicated SEKKISEI Lotion 360ml\"', 200111: 'Blue rectangular plastic tablecloth 54x108 inch for parties and outdoor', 200112: '\"Kinesiotape azul 5cm x 5m Mobitape Mobiclinic vendaje neuromuscular aliviar dolor muscular\"', 200113: '\"1/2-in EZ-Fluid angle stop valve chrome brass water shut off valve 10-pack\"', 200114: \"Dotty the Dalmatian plush mascot costume men's\", 200115: '\"11x14 white picture frame set for 8x10 photos with mat\"', 200116: 'Please provide the product title and description for generating an appropriate query.', 200117: 'R.P.G. Game Master Guide', 200118: '\"Buffalo TeraStation 3410 Rack 4TB NAS HDD\"', 200119: '\"Lord of the Rings Wizard Sign T-Shirt Geek Clothing\"', 200120: 'HOBO Vintage Euro Slide Credit Card Holder Wallet', 200121: '\"XR Extinction Rebellion Rebel For Life T-Shirt\"', 200122: 'SAFAVIEH Dip Dye Collection wool accent rug ivory navy 2x3', 200123: 'MSI GE66 Raider 15.6\" FullHD 300Hz Intel Core i7 32GB RAM 1TB SSD Nvidia RTX3080 Windows 10 Titanium Blue', 200124: '\"Demon Podium Full Face Bike Helmet lightweight with air flow management system\"', 200125: '\"adidas ladies climalite short-sleeve polo\"', 200126: '\"Letter tracing book for preschoolers ages 3-5\"', 200127: 'Probrico flat black cabinet pulls 3 inch hole centers T bar handle kitchen dresser 10 pack', 200128: '\"permethrin insect repellent for clothing and gear\"', 200129: 'Oposiciones Corporaciones Locales Ayuntamientos Policía Bomberos Informáticos Músicos Ingenieros Delineantes', 200130: 'ergonomic stool adjustable height footrest ring parquet wheels', 200131: '\"4 ton hydraulic low profile floor jack with dual piston quick lift pump\"', 200132: '\"Commercial electric shredder cross cut A4 12 sheets CD DVD card compatible\"', 200133: '\"Madagascar Bourbon Planifolia Grade A Vanilla Beans 5-6 inches\"', 200134: '\"K-Y Duration Spray for Men Lidocaine Desensitizer\"', 200135: 'An Untamed Heart Red River of the North book', 200136: '\"Red Oak preglued wood veneer edge banding roll\"', 200137: '\"Kipling black cross-body medium sized handbag\"', 200138: '\"Nike USA Stadium Away Jersey Blue White\"', 200139: '\"long halter evening gown formal slit chiffon bridesmaid dress open back\"', 200140: 'Diddy Kong stuffed plush Little Buddy Super Mario', 200141: '\"Indoor bug zapper plug in YUNLIGHTS electric fly trap mosquito killer\"', 200142: 'Amylee Weeks Love You More measuring cup set', 200143: 'Product title and description are missing. Please provide the necessary information to generate a query.', 200144: \"Women's wide ankle pants loose fit casual elegant\", 200145: 'Ziaja Cupuazú loción corporal bronceadora 300ml', 200146: '\"iPad Air 10.5 protective film paper-like writing anti-glare\"', 200147: 'Nautica Boys School Uniform Khaki Pants Flat Front Elastic Waistband', 200148: 'tatuajes temporales para niñas com-four arcos', 200149: '\"LOL Surprise Color Change Dolls with 7 Surprises for ages 4-7 years old\"', 200150: 'セカンドルーツ アーガイル カーディガン レディース 0A-R04', 200151: 'gold tea cup and saucer holder set', 200152: '\"Waterproof dog car seat cover for large pets in black\"', 200153: \"Mai Puru Endo Mai's First Photo Collection\", 200154: 'Taburete de bar ajustable vintage industrial iKayaa en metal y madera de pino', 200155: '\"dream catcher wall decals quotes girls bedroom living room decor\"', 200156: 'Virgen María Jesús lienzo religioso decoración de pared pintura de acuarela póster sin marco 70x90cm', 200157: \"Bulova Men's Phantom Crystal 98A229 Gold Silver-tone Watch\", 200158: '\"Giorgio Armani Code Colonia men\\'s Eau de Toilette Spray 2.5 oz\"', 200159: '\"加味逍遙散料エキス錠クラシエ 180錠\"', 200160: '\"rustic entryway coat rack and shoe bench with storage hooks\"', 200161: '\"20代で得た知見\" product search', 200162: 'Microsoft Surface Pro 7 with Type Cover, Surface Pen, 10th Gen Core i3, 4GB RAM, 128GB SSD, Windows 10, Platinum', 200163: '2.75 x 2.75 inch printable labels inkjet laser compatible 300 pack', 200164: 'Durio Hooded Cloak Halloween Christmas Vampire Witch Cape Cosplay Costume', 200165: '\"Zoostliss Crimping Tool for Coaxial Cable RG6 RG59 with Blue F Connector\"', 200166: '\"Samsung IPolis Wisenet SRN-473S grabadora de vídeo en red 4 canales PoE\"', 200167: 'Todo lo que dejé atrás Las Tres Marías nº 3', 200168: 'Cubot X50 Android 11 8GB 128GB Smartphone 6.67\" pantalla FHD+ 64MP cámara 4500mAh batería', 200169: 'Please provide the product title and description for me to generate an appropriate query.', 200170: '30 cm vintage rustic toscano wooden wall clock', 200171: '\"Kiss Tweetheart False Nails with accents and super hold adhesive\"', 200172: 'Bestway Piscina Desmontable Tubular Steel Pro Max 305x76 cm', 200173: '\"Torino Pro Hard Wave Brush for coarse hair 360 waves\"', 200174: 'VITALDIN SPORT Power Gummies BCAA naranja vegano', 200175: '\"Sulawesi Mineral 7.5 for shrimp aquariums\"', 200176: 'Ateco Pastry Leaf Tube Set White', 200177: '\"6-inch Pearl TP-6N Training Pad with adjustable stand\"', 200178: '\"Handmade black samurai wakizashi sword\"', 200179: '\"50ft RGB 5050 Led Strip Lights for Bedroom with 44 Keys Remote Controller and 12V Power Supply\"', 200180: '\"Extra large Hallmark Christmas gift bag with tissue paper\"', 200181: '\"glass essential oil diffuser ultrasonic aromatherapy humidifier wood natural\"', 200182: \"Sperry Kid's Port Boot water resistant puddle jumper shoes\", 200183: '6mm Gaiam reversible non-slip yoga mat', 200184: 'EIBACH Pro-Street-S chasis resorte amortiguador AUDI A4 Limousine 8W2 B9', 200185: '\"Grunt Style Rifle Flag 2.0 Men\\'s Hoodie\"', 200186: 'Motorola Moto E6 Play 5.5\" pantalla, 2GB RAM, 32GB almacenamiento, Android 9.0, Dual SIM, Gris', 200187: 'Cuisinart portable venture gas grill red with wooden lid and 154 sq in cooking grate', 200188: '\"Organic Kabuli Chana 4 lb White\"', 200189: '\"small measuring rice bin Asvel\"', 200190: '\"Fat Brain Toys Shake & Make Words Game for ages 6 to 11\"', 200191: '\"memoir At Home in the World\"', 200192: '\"3.6V cordless rechargeable electric tacker with 8mm needles and charger\"', 200193: '\"早期購入特典 D.D. Imitation Rain Snow Man with SixTONES CD+DVD-B スリーブ仕様 クリアファイル-C A5サイズ\"', 200194: '\"Ken Parker núm. 02: Hombres de honor Homicidio en Washington\"', 200195: '\"Angel Soft 2-ply mega roll toilet paper\"', 200196: '\"Western Peak Shotgun Bullet Shell Antler Necklace and Earrings Set Copper Silver\"', 200197: \"Brickell Men's Morning Face Care Routine I, gel limpiador facial, tónico sin alcohol, exfoliante facial, crema para ojos, suero de día con vitamina C, humectante facial diario, perfumado\", 200198: '\"300 piece jigsaw puzzle Kitchen Memories by Steve Crisp\"', 200199: '\"automatic wine opener with foil cutter\"', 200200: '\"FOCO Men\\'s Neon Athletic Short\"', 200201: 'pink canopy bed curtains for girls full size bedroom decor', 200202: 'るくるく 10 アフタヌーンコミックス', 200203: '\"Parrilla de acero inoxidable plegable con mango de madera WolfWise para barbacoa portátil\"', 200204: \"SweatyRocks Women's Crop Top Hoodie Letter Print\", 200205: '2x72 belt grinder small wheel set and holder for knife grinders', 200206: 'Celestial Seasonings Honey Vanilla Chamomile Herbal Tea 20 Count', 200207: '\"SanDisk Cruzer Fit 32GB USB 2.0 Ultra Small Flash Drive\"', 200208: '\"Black TPU AirPods case anti fingerprints with wristband and accessories\"', 200209: '\"4PCS adjustable right angle clamps for woodworking, welding, and cabinet making\"', 200210: 'dinosaur birthday party supplies decoration set', 200211: 'Steampunk Venetian Masquerade Mask for Halloween Party', 200212: '\"buffalo plaid flannel pajama pants for women with pockets\"', 200213: '誕生日 飾り付け 風船 Happy Birthday バルーン パーティー 装飾 RunTure ブルー', 200214: '\"men\\'s silicone wedding rings breathable rubber bands 6 pack\"', 200215: '冷蔵 中華いか山菜 100g 甘酸っぱい味 ごま油 食感', 200216: '\"time management hacks to stop procrastination and increase productivity book\"', 200217: 'Qualsen 木製ハンガー スーツ 洋服 ジャケット コート用 5本組セット', 200218: 'short black cosplay wig for men', 200219: '\"compression knee sleeve for knee pain support running weightlifting sports\"', 200220: '\"black and white buffalo check dishtowel set farmhouse kitchen\"', 200221: '\"Anadol SF33 localizador digital de satélite pantalla LCD\"', 200222: 'TKSTAR GPS Tracker TK905 for Motorcycles and Vehicles with Long Standby Time and Waterproof', 200223: '\"large black hair claw clips for thick hair women girls\"', 200224: \"Capezio Women's Turtleneck Long Sleeve Leotard\", 200225: '\"4 inch iron display stand for decorative plates, photos, and small artwork\"', 200226: '\"Aluminum Camera Cage with Top Handle Grip for Sony A7RIII A7III A7II DSLR\"', 200227: '\"white plush velvet office chair adjustable height\"', 200228: 'Power Rangers Lightning Collection 6-Inch Psycho Rangers 5-Pack action figures with accessories', 200229: '\"Blue pet grooming gloves for hair removal and massage\"', 200230: 'Please provide the product title and description for me to generate an appropriate query.', 200231: '\"Chainsaw Girl Goth Punk Emo Vintage Horror Movie T-Shirt\"', 200232: '\"5L matte black rectangular trash can with soft close lid and anti-bag slip liner for bathroom or kitchen\"', 200233: '\"CINRA 20PCS Disposable Tattoo Tubes Grips Mixed Sizes\"', 200234: '\"Kicode Power Tower with Bench Pull Up Bar Dip Station Home Gym Exercise Equipment\"', 200235: '\"wholesale 925 silver bracelet cuff bangle Kuyiuif Classic 10pcs\"', 200236: 'Huffy 12V Battery Powered Ride On ATV for kids aged 2-5', 200237: '\"Pure Original Ingredients Black Cohosh Root 100 Capsules no additives fillers lab verified\"', 200238: '\"Silicone Key Fob Cover for Honda Accord, Civic, CR-V, and Pilot\"', 200239: '\"eyebrow tattoo stickers natural black dark brown\"', 200240: 'ナチュラリ クリアUVモイスチャー ソフトコンタクトレンズ -2.00', 200241: '\"maybet dog nutritional supplement 60 tablets\"', 200242: \"Women's Hotouch fringe vest faux suede 70s hippie sleeveless cardigan\", 200243: '10 foot Mogami guitar cable right angle to straight', 200244: '\"seasonal garden flags set double sided burlap outdoor decorations\"', 200245: 'Bosch Compressor Trumpet Air Horn', 200246: '\"Clinical Companion for Fundamentals of Nursing E-Book English Edition\"', 200247: 'HOKEMP Braga Tanga de Encaje Mujer Pack de 5', 200248: 'Ardell Double Individuals Knot Free Black Medium lashes', 200249: 'Just My Style Youniverse Lava Lip Gloss Lab STEM Kit for Kids DIY Makeup', 200250: 'Dulcolax Soft Chews Mixed Berry Laxative Magnesium Hydroxide', 200251: 'buscar Razor Power Core E100 Scooter eléctrico', 200252: 'Cold Steel Medieval Buckler Polymer Shield HEMA', 200253: 'Nike Womens Free RN Flyknit 2018 Black White Size 8.5W Running Shoes', 200254: '\"Amazon Basics ドアハンガー 4連 フリップダウンフック\"', 200255: 'HDMI to RCA converter for TV, Roku, Fire Stick, DVD, Blu-ray player', 200256: 'The Hope Fulfilled: The Rise of Modern Israel book', 200257: 'Técnicas y procesos en instalaciones domóticas y automáticas libro electricidad electrónica', 200258: \"Nautica Men's Short Sleeve Crew Neck Sleep Tee\", 200259: '\"Di hola Spanish Edition book\"', 200260: '\"Carhartt Men\\'s Big Tall Storm Defender Heavyweight Jacket Waterproof Breathable\"', 200261: '\"Columbia Women\\'s Newton Ridge Waterproof Hiking Boot lightweight comfortable\"', 200262: 'Coffee Brown Metallic Embroidery Thread 5000 Yards', 200263: 'Husky Welcome Door Mat Cute Cat Sun Cartoon 36 x 24 inches', 200264: '\"39 watt halogen PAR20 clear medium base bulb\"', 200265: 'Buitoni Masa para Pizza Tradizionale 260g', 200266: '\"300 piece Halloween jigsaw puzzles value set by Various Artists\"', 200267: '\"Charm14 NFL Womens Cell Phone Wallet\"', 200268: '\"Sliding Compound Miter Saw TSS102L with Laser\"', 200269: 'Eridanus tapón de desagüe fregadero válvula grande pop-up latón', 200270: '\"hardcover leatherette journal A5 lined 192 pages 5.7 x 8.4 inches Simply Genius\"', 200271: '\"Esbit stainless steel stove compact with solid fuel and alcohol burners\"', 200272: '\"Kanga Care Rumparooz One Size Reusable Cloth Diaper Cover\"', 200273: 'How to Train Your Dragon party table cover', 200274: 'G Fuel Shiny Splash Energy Powder aDrive 40 Servings', 200275: '\"Balenciaga and Spanish Painting book\"', 200276: '\"light blue throw pillow covers 20x20 for sofa couch bed home decoration\"', 200277: '\"Calefacción por infrarrojos Könighaus 800W con termostato y programa de 7 días, marco blanco y color negro\"', 200278: 'Tactical Solutions Low Ride Browning Buck Mark .22 Holster Ambidextrous Black', 200279: '10Pcs Mini Diamond Needle File Set 6 Inch 150 Grit', 200280: 'Organic baby toddler short sleeve tight fit pajamas Lamaze', 200281: 'Transformers Bumblebee Inflatable Kids Costume', 200282: '\"Z For Zachariah DVD post-apocalyptic movie\"', 200283: '\"organic peppermint herbal tea for digestive discomfort\"', 200284: '\"calcetines ejecutivos de algodón para hombres y mujeres hecho en Europa\"', 200285: '\"Smart essential oil diffuser with 500ml capacity and voice control\"', 200286: 'Funny Cats Puns Tank Top', 200287: '\"purple ergonomic document copy holder with side arm\"', 200288: \"NFL Women's OTS Fleece Hoodie\", 200289: '\"metallic birthday ribbon thin string set for DIY crafts\"', 200290: '\"Women\\'s Pokemon character sneaker socks size M\"', 200291: 'Casio wall clock radio wooden frame analog 11.6 inches', 200292: 'Enameled Cast Iron Dutch Oven 6.5 quart Olive Green', 200293: '\"Gladiator Lacrosse Bounce Pitch Back Rebounder Model 05011\"', 200294: '\"Stromberg Carlson VGD-02-4000 Louvered Tailgate for 1500, 2500, and 3500 series trucks\"', 200295: '\"Leg Avenue Women\\'s Lace Thigh Highs Hosiery\"', 200296: '\"universal knife and tool sharpener with adjustable angle guides\"', 200297: '\"3 Turrones clásicos Artesanos en Estuche de Pino Jijona Alicante Yema Tostada\"', 200298: '\"cotton candy party kit 100 cones five flavors\"', 200299: 'North Face Pivoter School Laptop Backpack Federal Blue Shady Blue', 200300: '\"baby proofing child safety locks for cabinets and drawers\"', 200301: '\"4 Pairs Stainless Steel Magnetic Stud Earrings for Men Women 6MM Non Pierced Clip On\"', 200302: 'KOKUYO Campus Notebook B5 Dotted A-Ruled 5-Colors 6 Pack', 200303: 'iPhone 6 Plus replacement touch screen LCD panel with repair tools', 200304: '\"Yoshikawa Kohiya thick baked pancake ring round set SJ2002\"', 200305: '\"VERYKE L-Shaped sectional sofa chenille fabric golden legs living room\"', 200306: '\"Amazon exclusive Battleship with planes strategy board game for ages 7 and up\"', 200307: 'Hunter Watson Indoor ceiling fan with LED light and pull chain control, New Bronze finish', 200308: '\"Kids sandwich cutter and sealer set with star, heart, and circle shapes for lunchbox and bento box\"', 200309: '\"Calvin Klein Women\\'s Invisibles Hipster Panty\"', 200310: '\"OTTERBOX COMMUTER SERIES iPhone 11 Pro case with PopSockets PopGrip\"', 200311: 'AQUOS Zero 6 SHG04 protective film blue light cut anti-glare antibacterial', 200312: 'Pink princess bed canopy mosquito net for twin full queen size beds', 200313: '14K Gold Plated Cubic Zirconia Ear Cuff Adjustable Huggie Earrings Non Piercing Jewelry Gift for Women Girls', 200314: '\"Plaskidy plastic forks for kids set of 16 BPA free dishwasher safe\"', 200315: '戦国小町苦労譚 農耕戯画 1 コミック アース・スターコミックス', 200316: '\"10th birthday decorations for girl\"', 200317: '\"Dr. Martens Men\\'s Icon 2295 Steel Toe Wellington Boots\"', 200318: '\"V8 Energy Peach Mango drink pack of 24\"', 200319: 'Black+Decker 5-Cup Coffeemaker Dust Proof Cover', 200320: '60\" Casa Vieja Spyder Modern Farmhouse Ceiling Fan Oil Rubbed Bronze Low Profile for Bedroom Living Room', 200321: '\"ECOWISH Women Off Shoulder Floral Print Beach Shorts Jumpsuit\"', 200322: 'girls princess dress up costume headband accessories', 200323: '\"Car glass coating agent with shampoo conditioner and water repellent for glossy finish\"', 200324: 'Tribesigns 3-Shelf Rolling Printer Stand with Storage Rustic Brown', 200325: '\"Nicpro Art Mechanical Pencils Set for Writing, Sketching, and Drawing with Lead Refills\"', 200326: '\"Kaenon Men\\'s Polarized Sunglasses Burnet Full Coverage Matte Tortoise\"', 200327: '\"Inflatable Solar System Set for Classroom Decor\"', 200328: 'Mickey Mouse glow sketch beach towel 28x58', 200329: '\"120 pack silver metal drapery hooks pins for curtains with clear box 3 x 2.4 cm\"', 200330: '\"Levi\\'s Women\\'s High Waisted Mom Shorts\"', 200331: 'Find RAINBEAN foldable laptop table for bed with storage space and bamboo wood grain', 200332: '15 inch Damascus steel hunting knife with sheath', 200333: 'Tri Sugar Shield 60 Vcaps Pack of 2', 200334: '3-Tier Desktop Electric Water Fountain with LED Indoor Outdoor Tabletop Zen Meditation', 200335: 'Bestway Flow Clear 1500 GPH above ground pool filter pump', 200336: 'The Soviet Mind: Russian Culture under Communism book', 200337: '\"Vince Camuto Women\\'s Catheryna Fashion Boot\"', 200338: '\"Samsung Notebook 7 Spin Tropical Beach Paradise decal skin 13.3 inch\"', 200339: '\"Dr. Martens Women\\'s Shriver Hi Fashion Boot chunky sole\"', 200340: '私がモテないのはどう考えてもお前らが悪い! コミック 1-12巻 セット検索', 200341: 'juDanzy kids knee high tube socks with grips', 200342: \"SheIn Women's Black Mesh Hem Rib Knit Short Sleeve Crop Top\", 200343: '\"Double sided rug tape for laminate flooring 2 inch 30 yards\"', 200344: '\"A+D Original Diaper Rash Ointment 1.5 Ounce Tube\"', 200345: '100% Cotton Throw Blanket for Couch Sofa Bed Outdoors Hypoallergenic 83\"x70\" Brown', 200346: '\"migraine relief hat hot cold therapy reusable MarkGifts\"', 200347: '電動コーヒーミル TAOCOCO 200W 水洗い可能', 200348: '\"iPhone 11 Pro Max green case with slide camera cover and ring kickstand\"', 200349: '\"Desktop Miniature Basketball Game Toy Christmas Gift Fun Sports Novelty Gag Gift Idea\"', 200350: '\"McCormick Coconut Extract 2 fl oz gluten-free non-GMO\"', 200351: '\"King Acid\" product search', 200352: 'disfraz escocesa sexy mujer talla 40/42', 200353: '\"Strike Industries muzzle flash tracer for green glow BBs\"', 200354: \"Lugz Women's Empire Hi Wvt Fashion Boot\", 200355: '\"avocado oil mayonnaise Primal Kitchen 24 oz\"', 200356: '\"Amazon Essentials Women\\'s Lightweight Crewneck Cardigan Sweater Plus Size\"', 200357: '\"Apple Lime Green Deco Mesh Ribbon 10 inch for Christmas Wreath and Spring Decorations\"', 200358: '\"Elara Jeans mujer cintura alta slim fit botones Chunkyrayan\"', 200359: 'Pizarra magnética portátil deAO con taburete y accesorios para niños', 200360: '1/2 Carat Princess Cut Diamond Stud Earrings 10K Gold Platinum', 200361: 'High Quality Emu Oil 15ml for skin care and muscle pain relief', 200362: 'Please provide the product title and description for me to generate a suitable query.', 200363: '\"Initial gold necklace figaro chain stainless steel 18K personalized alphabet\"', 200364: 'AUGYMER stainless steel serrated bread knife 7.9 inches', 200365: 'The Fifth Agreement book self-mastery Toltec Wisdom', 200366: '\"X-Large waterproof car trash can garbage bag\"', 200367: '\"Fly London Wuni135fly women\\'s sandals\"', 200368: 'Please provide the product title and description for me to generate an appropriate query.', 200369: 'iPhone notebook case Vermeer painting girl with pearl earrings', 200370: '\"U Shape Floating Metal Bookshelf White Set of 2\"', 200371: 'Ernie Ball Custom Gauge 11 Nickel Guitar String 6 Pack', 200372: '\"artificial eucalyptus plant for wedding jungle theme party home decor\"', 200373: 'Spider-Man Miles Morales Venom 3 Pack T-Shirts for kids', 200374: '\"Bobbi Brown Lip Color Rum Raisin 3.4g\"', 200375: '\"GE 6-Device Backlit Universal Remote Control for Samsung, Vizio, LG, Sony, Sharp, Roku, Apple TV, Blu-Ray, DVD, Master Volume Control, Rose Gold\"', 200376: '22mm Left Clutch Brake Lever for CT200U Trail 200 Mini Bike 196cc 98cc', 200377: '\"sparkly rhinestone mesh face mask for women masquerade party glitter bling Christmas\"', 200378: 'USB submersible pump aquarium fountain hydroponics pet water supply', 200379: 'Patinete eléctrico Hoverboard 6.5\" antipinchazos LED luces auto-equilibrio UL2272 certificado', 200380: '\"Perfecasa Svelte Wooden Pants Hangers with Clips 10 Pack\"', 200381: '\"Dell Optiplex 390 DT desktop computer Intel Core i3-2100 8GB DDR3 1TB Windows 10 Professional 64 Bit\"', 200382: '\"wooden puzzles montessori toys for toddlers 1-3 years old educational learning vehicles\"', 200383: '\"7x5ft Black and Gold Balloons Backdrop for Birthday Party Photography\"', 200384: '\"Replacement Dog Crate Pan for MidWest and New World Dog Crate\"', 200385: '\"OPPO Realme X2 Pro 9H hardness protective film anti-reflective fingerprint authentication made in Japan\"', 200386: '\"こころ\" product search', 200387: '\"15 inch artificial silk phalaenopsis orchid flower plant golden blue ceramic pot\"', 200388: '\"waterproof dog raincoat with reflective stripes and colorful patterns for small medium large dogs\"', 200389: '\"NFL Tampa Bay Buccaneers dog jersey x-large\"', 200390: '\"Steel Pegboard Hooks 50-Pack 1 inch L-Hook for organizing tools and accessories\"', 200391: 'ダイソン V11 Fluffy コードレス 掃除機', 200392: '\"small animal graduation cap costume for guinea pigs, hedgehog, birds, turtles, hamster, bearded dragon, rabbit, ferret\"', 200393: 'Please provide the product title and description for me to generate an appropriate query.', 200394: '\"Immuson 12x20 plastic produce bags on a roll for fruits and vegetables\"', 200395: '\"LYXOTO Baby Hair Clips set of 10 bow knot cute stylish birthday gift\"', 200396: 'Espejo de maquillaje con luz LED FASCINATE tríptico con aumentos 3X, 2X, 1X y rotación de 180°', 200397: '\"Agantree Welcome Stencils for porch front door drawing painting spraying\"', 200398: '\"Soda Pop Can Covers Made in USA BPA-Free Retains Fizz\"', 200399: '\"Klein Tools Mini Tube Cutter for copper and aluminum tubing\"', 200400: '\"Belkin QODE Ultimate Pro Keyboard Case for iPad Air 2 White\"', 200401: '\"Layout Kids Mobile F-03J Disney Silicone Case Minnie Mouse\"', 200402: '2-pack aluminum no firearms guns or weapons allowed sign 10x7 waterproof', 200403: '\"Speck CandyShell Grip iPhone XR Case Black Oasis Green\"', 200404: '\"Schleich Pastor Alemán Figura Multicolor 16831\"', 200405: 'HDMI to VGA DVI HDMI adapter 4 in 1 video converter for laptop monitor projector', 200406: '\"Isotonix Digestive Enzymes with Probiotics for stomach upset and immune support\"', 200407: '3D Skull Ice Cube Tray Silicone Mold for Whiskey Cocktail', 200408: '\"Stars in the Desert\" book', 200409: '\"Draw-Tite Reese Fifth Wheel Slider Unit with 4 Rollers 15K 16K 20K Head Assemblies\"', 200410: '\"gluten-free vegan Shiragiku Koji spores for miso and shoyu koji\"', 200411: '\"red boutonniere for men wedding lapel pins groomsman corsages\"', 200412: '\"Gucci Guilty Intense men\\'s eau de toilette spray 1.6 oz\"', 200413: '\"sympathy cards bulk pack with envelopes and unique designs\"', 200414: '\"Benefit Boi ing Hydrating Concealer Light Medium\"', 200415: '21x21 beige sun shade sail patio UV protection outdoor backyard', 200416: 'Bosch Cobalt M42 drill bit set', 200417: '\"Zealer 1800pcs Crystals AB Nail Art Rhinestones Flatback Glass Charms for Nails Decoration Eye Makeup Clothes Shoes Mix Sizes\"', 200418: 'Rembrandt El Regreso del Hijo pródigo Giclee Papel de Arte impresión', 200419: '\"Keeper of Dragon Magic Ultra card CT15-EN004\"', 200420: 'black wood electric guitar ornament', 200421: '\"Martillo de impacto inalámbrico Einhell TE-HD 18 Li-Solo Power X Change\"', 200422: '5 Pcs Colorful Mini Silicone Whisks Stainless Steel Non Stick for Cooking Baking', 200423: '縄文を創った男たち 上巻 信長 秀吉 家康', 200424: 'Figma Avengers Age of Ultron Iron Man Mark 43 Exclusive', 200425: '\"BlendShe Carlotta chaqueta acolchada de plumas para mujer con cuello alto\"', 200426: 'Please provide the product title and description.', 200427: 'Deflecto 5-bin horizontal tilt bin storage system black', 200428: '\"Duracell EasyTab Hearing Aid Batteries Size 312 Brown 10 packs\"', 200429: '\"PEARL IZUMI Elite Thermal Arm Warmer for cool weather cycling with water-shedding fleece and unisex sizing\"', 200430: '\"New American citizen mug US flag coffee cup gift\"', 200431: 'NBA Ultra Game mens tank top sleeveless muscle t-shirt', 200432: 'Please provide the product title and description for me to generate a query.', 200433: 'Thayers Rose Petal Witch Hazel Aloe Vera Toner 12 oz 2 pack', 200434: 'Señores del caos libro metal satánico Es Pop ensayo', 200435: '\"Fractal Design Ion+ 860w 80 Plus Platinum Certified ATX Power Supply\"', 200436: '\"Portable DVD Player 12.5 inch HD Swivel Screen with Car Headrest Mount Case and Car Charger\"', 200437: '\"clear PVC heat shrink wrap bags 10x14 inches for shoes, soap, book, bath bombs, candles, jars, and DIY projects\"', 200438: '6 inch ceramic polka dot patterned indoor planter pot with drainage hole', 200439: \"Citizen xC Women's Eco-Drive Radio Controlled Watch Happy Flight Series\", 200440: 'Swiss Army wool blanket for camping outdoors emergency kits 59x80 inches', 200441: '\"32GB USB 3.0 OTG Flash Drive for Android Type-C and Micro USB\"', 200442: 'Pioneer 3.5\" 250W Bullet Car Tweeter TS-B350PRO', 200443: '\"Mini DisplayPort to HDMI Adapter for Surface Pro, MacBook Air, Thinkpad X1\"', 200444: '\"Disney Parks Minnie Mouse Navy Blue Polka Dot Ears Pink Sequin Bow Headband\"', 200445: 'Promax CF-2 Cold Forged 2 Piece Crank 6061-t6 aluminum', 200446: '\"organic sprouted grain flax bread gluten free vegan paleo frozen\"', 200447: '\"blackout French door curtains light grey 26x68 inches\"', 200448: 'Duramax 6.6L Diesel Compression Adapter 2005 and Up', 200449: 'World of Warcraft Horde Ceramic Coffee Mug 11 ounces', 200450: '\"large washable donut dog bed with calming cuddler and head support\"', 200451: 'KORG DS-DAC-100 USB DAC Digital to Analog Converter', 200452: 'Spotted Zebra Girls and Toddlers Cozy Knit Joggers pack of 2', 200453: 'Scattergories Categories game for ages 12 and up', 200454: 'Sterling Silver Cultured Pearl Baptism to Bride Cross Bracelet for Girls', 200455: '\"Mayton wooden bunkie board slats Twin XL Beige\"', 200456: '\"Microsoft Surface Pro Signature Type Cover Platinum FFP-00141 for Surface Pro 7\"', 200457: '\"3 wheel kick scooter for kids with flashing wheels and adjustable handlebar\"', 200458: '映画ドラえもん のび太と雲の王国 DVD', 200459: '\"natural dry puppy food chicken salmon oatmeal 30-pound bag\"', 200460: '\"Thankful Deluxe Fall Party Dinnerware Bundle with Dinner Plates, Dessert Plates, and Large Napkins\"', 200461: \"Grunt Style Old No. 76 Men's T-Shirt\", 200462: '\"Ombre highlight short bob human hair wig brown to blonde Brazilian straight remy for black women\"', 200463: \"Hurley Men's Printed Backpack Light Carbon\", 200464: '\"double zipper smart key case genuine leather\"', 200465: '\"Car windshield sun shade with storage pouch for medium-sized vehicles\"', 200466: '週刊���衆 2020年5月11・18日号 雑誌検索', 200467: '\"ARKSEN 36 inch aluminum truck bed storage box with T-handle lock\"', 200468: 'Camper Zapatillas Runner Up mujer silueta deportiva plataforma', 200469: '\"Big Black Metal Box card storage case compatible with Cards Against Humanity\"', 200470: '\"Men\\'s low rise pouch thong underwear\"', 200471: '\"acrylic lollipop holder cake pop stand with sticks, bags, and twist ties\"', 200472: '\"Fire 7 Kids Edition Tablet 7 inch display 16 GB Yellow Kid-Proof Case\"', 200473: '\"wax seal kit for wedding invitations envelope stamp set\"', 200474: 'iPhone X/XS Juliet Rose Rifle Paper Co. case', 200475: '\"OTC 4842 Heavy Duty Valve Spring Compressor\"', 200476: \"What Happens When Women Pray Leader's Guide\", 200477: '\"cordless portable blender rechargeable battery smoothie mixer travel\"', 200478: '\"fall sunflower pumpkin placemats set of 6 cotton linen washable table mats\"', 200479: '\"Zippo Lighter 12 Value Packs with 6 Flints and 6 Wicks\"', 200480: 'Nightmare Before Christmas throw pillow covers vintage newspaper design', 200481: '\"月刊モーニング・ツー 2017年4月号雑誌\"', 200482: '\"KATUMO Baby Crib Mobile Woodland Hot Air Balloons Birds Clouds Nursery Decoration\"', 200483: '\"Oil rubbed bronze outdoor wall mount lighting fixtures twin pack\"', 200484: 'HON Volt Black Leather Office Desk Chair', 200485: '\"KING DOO preserved eternal blue rose in glass dome gift for women\"', 200486: '\"Clou Beaute Neon Colors Gel Polish Set\"', 200487: '\"12 oz disposable coffee cups with lids and stirrer straws 100 pack\"', 200488: '\"large cat tree condo furniture with multiple platforms and sisal ropes\"', 200489: 'White Dog Lock Edge large gaming mouse pad rubber cloud pattern design 700x300x3mm', 200490: '\"Marvel Avengers Endgame Gauntlet T-Shirt\"', 200491: '\"Jill & Joey Maternity Belt Belly Band Medium Beige Pregnancy Support\"', 200492: '\"Custom Self Inking Rubber Stamp 4 Lines Extra Ink Pad A1848\"', 200493: '\"Stoplight Sleep Enhancing Alarm Clock for Kids Train Car Clock\"', 200494: '16 Pack Oral B Braun Electric Toothbrush Replacement Brush Heads', 200495: 'Outtag Cargador AC Dell Chromebook 11 Inspiron 11 3000 Series 65W', 200496: '\"adidas women\\'s bomber jacket\"', 200497: '\"Type A/C Type III inflatable swimming pool filter cartridge 10.6x20.3cm\"'}\n" + ] + } + ], + "source": [ + "new_queries = {}\n", + "new_qid = 100000 # start qid at 100000\n", + "print(\"starting to generate test queries\")\n", + "with open('test-direct.qrel','w') as w:\n", + " with open('test-direct-qrels.jsonl','w') as w2:\n", + " for i in range(0,500):\n", + " selected_document = random.randint(0, len(collection))\n", + " rand_choice = random.randint(0,2) # 0 chooses the asin, 1 uses some exact match from title, 2 uses some exact match from text\n", + " if rand_choice == 0:\n", + " new_queries[new_qid] = collection[selected_document]['asin']\n", + " candidate_query = new_queries[new_qid]\n", + " elif rand_choice == 1:\n", + " num_words = random.randint(3,7)\n", + " candidate_query = ' '.join(collection[selected_document]['title'].split(' ')[:num_words])\n", + " if len(candidate_query.split(' '))> 3:\n", + " new_queries[new_qid] = candidate_query\n", + " elif rand_choice == 2:\n", + " num_words = random.randint(3,10)\n", + " candidate_query = ' '.join(collection[selected_document]['title'].split(' ')[:num_words])\n", + " if len(candidate_query.split(' '))> 3:\n", + " new_queries[new_qid] = candidate_query\n", + " qid2query[new_qid] = candidate_query\n", + " doc_id = collection[selected_document]['doc_id']\n", + " w.write(\"{}\\t0\\t{}\\t1\\n\".format(new_qid, doc_id))\n", + " j = {'qid':new_qid, 'Q0':'Q0', 'docid':doc_id, 'rel':1 }\n", + " w2.write(\"{}\\n\".format(json.dumps(j)))\n", + " new_qid += 1\n", + " print(\"done generating spearfishing queries. Generating queries using LLM\")\n", + " new_qid = 200000 # generated queries start qid at 200000 for generated queries\n", + " for i in range(0,500):\n", + " if i % 100 == 0:\n", + " print(\"{} queries generated\".format(i))\n", + " selected_document = random.randint(0, len(collection))\n", + " prompt = 'Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\\n\\n'\n", + " prompt += '### Instruction: \\n\\n You are a product search engine. Given the following product title and description what would be a query which a user would issue to find this item?\\n\\n'\n", + " prompt += '### Input:\\n\\n'\n", + " prompt += 'Product title:{}\\n'.format(collection[selected_document]['title'])\n", + " prompt += 'Product Description:{}\\n'.format(collection[selected_document]['text'])\n", + " prompt += '### Response: \\n'\n", + " message=[{\"role\": \"user\", \"content\": prompt}]\n", + " try:\n", + " response = openai.ChatCompletion.create(\n", + " model=\"gpt-4\",\n", + " max_tokens=100,\n", + " temperature=0.7,\n", + " messages = message)\n", + " candidate_query = response['choices'][0]['message']['content']\n", + " qid2query[new_qid] = candidate_query\n", + " new_queries[new_qid] = candidate_query\n", + " doc_id = collection[selected_document]['doc_id']\n", + " w.write(\"{}\\t0\\t{}\\t1\\n\".format(new_qid, doc_id))\n", + " j = {'qid':new_qid, 'Q0':'Q0', 'docid':doc_id, 'rel':1 }\n", + " w2.write(\"{}\\n\".format(json.dumps(j)))\n", + " new_qid += 1\n", + " except:\n", + " pass\n", + " \n", + "print(len(qid2query)) \n", + "print(len(new_queries))\n", + "print(new_queries)\n", + "\n", + "\n", + "from pyarrow import json\n", + "table = json.read_json('test-direct-qrels.jsonl') \n", + "pq.write_table(table, 'test-direct-qrels.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "ef1c1f2b", + "metadata": {}, + "outputs": [], + "source": [ + "with open('qid2query.tsv','w') as w:\n", + " for qid in qid2query:\n", + " w.write(\"{}\\t{}\\n\".format(qid, qid2query[qid])) " + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "52910bea", + "metadata": {}, + "outputs": [], + "source": [ + "with open('2023-test-queries.tsv','w') as w:\n", + " for qid in new_queries:\n", + " w.write(\"{}\\t{}\\n\".format(qid, new_queries[qid])) " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "d8451c91", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'\"Type A/C Type III inflatable swimming pool filter cartridge 10.6x20.3cm\"'" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "qid2query[qid]" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "8f229507", + "metadata": {}, + "outputs": [], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-simple-pyserini')\n", + "with open('pyserini-simple-test-2023.run','w') as w:\n", + " for qid in new_queries:\n", + " hits = searcher.search(new_queries[qid], 100)\n", + " for i in range(0,len(hits)):\n", + " w.write(\"{}\\t0\\t{}\\t{}\\t{}\\tpyserini-simple\\n\".format(qid,hits[i].docid, i,hits[i].score))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "979653f4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "nDCG@10\t0.3765\r\n", + "P@5\t0.0850\r\n", + "P(rel=2)@5\t0.0000\r\n", + "Judged@10\t0.0460\r\n", + "R@100\t0.5110\r\n" + ] + } + ], + "source": [ + "! ir_measures test-direct.qrel pyserini-simple-test-2023.run nDCG@10 P@5 'P(rel=2)@5' Judged@10 R@100" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "ca458adc", + "metadata": {}, + "outputs": [], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-full-pyserini')\n", + "with open('pyserini-full-test-2023.run','w') as w:\n", + " for qid in new_queries:\n", + " hits = searcher.search(qid2query[qid], 100)\n", + " for i in range(0,len(hits)):\n", + " w.write(\"{}\\t0\\t{}\\t{}\\t{}\\tpyserini-full\\n\".format(qid,hits[i].docid, i,hits[i].score))" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "ff744a37", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "nDCG@10\t0.4702\r\n", + "P@5\t0.1018\r\n", + "P(rel=2)@5\t0.0000\r\n", + "Judged@10\t0.0552\r\n", + "R@100\t0.6172\r\n" + ] + } + ], + "source": [ + "! ir_measures test-direct.qrel pyserini-full-test-2023.run nDCG@10 P@5 'P(rel=2)@5' Judged@10 R@100" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "5a7fa88d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'query_text': '!awnmower tires without rims',\n", + " 'labels': {1049092: 0,\n", + " 314519: 3,\n", + " 689593: 0,\n", + " 717649: 2,\n", + " 1397156: 3,\n", + " 1095149: 3,\n", + " 341130: 1,\n", + " 911618: 3,\n", + " 831070: 2,\n", + " 1624211: 0,\n", + " 116997: 2,\n", + " 1399124: 3,\n", + " 1035122: 3,\n", + " 932695: 0,\n", + " 580389: 0}}" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "train[qid]['query_text']" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "325ee7dd", + "metadata": {}, + "outputs": [], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-full-pyserini')\n", + "with open('pyserini-full-train-2023.run','w') as w:\n", + " for qid in train:\n", + " hits = searcher.search(train[qid]['query_text'], 100)\n", + " for i in range(0,len(hits)):\n", + " w.write(\"{}\\t0\\t{}\\t{}\\t{}\\tpyserini-full\\n\".format(qid,hits[i].docid, i,hits[i].score))" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "d5d9fa3b", + "metadata": {}, + "outputs": [], + "source": [ + "from pyserini.search.lucene import LuceneSearcher\n", + "\n", + "searcher = LuceneSearcher('indexes/esci-simple-pyserini')\n", + "with open('pyserini-simple-train-2023.run','w') as w:\n", + " for qid in train:\n", + " hits = searcher.search(train[qid]['query_text'], 100)\n", + " for i in range(0,len(hits)):\n", + " w.write(\"{}\\t0\\t{}\\t{}\\t{}\\tpyserini-simple\\n\".format(qid,hits[i].docid, i,hits[i].score))" + ] + }, + { + "cell_type": "markdown", + "id": "f3180428", + "metadata": {}, + "source": [ + "## Now we can go ahead and generate triples. We will use positive labels we have and mine negatives from bm25 top 100" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "id": "4812b911", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1049092\n", + "314519\n", + "689593\n", + "717649\n", + "1397156\n", + "1095149\n", + "341130\n", + "911618\n", + "831070\n", + "1624211\n", + "116997\n", + "1399124\n", + "1035122\n", + "932695\n", + "580389\n" + ] + } + ], + "source": [ + "for doc in train[qid]['labels']:\n", + " print(doc)" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "id": "4821dc7f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'From the brand Previous page MaxAuto is a thriving brand which has been committed to meeting customer needs with high-quality tires. Our lineup include tires applied in Lawn & Garden, Agriculture, Golf Cart, ATV/UTV, ST Trailer, light truck, etc. We\\'ve obtained such certification as US DOT(2000),EU ECE(2006),Middle East SASO. The testing center has passed the CNAS(2017), German TÜV(2018), to ensure that all of our products are manufactured with the same quality standards. Lawn Mower Tires Visit the Store Lawn Mower Tires Visit the Store Lawn Mower Tires Visit the Store Lawn Mower Tires Visit the Store Lawn Mower Tires Visit the Store Next page Product Description About MaxAuto Brand >>Focus on high-quality speciality tire manufacturer In 1997, we began to invest in the development and production of ATV tires. Since then, we continue to expand our technical capabilities, production capacity and research and development. With a comprehensive range of applications and broad product line, and an annual output of 80 million sets, we highlight our industry leadership in the speciality tire and continue to maintain our innovation and creativity. >>Our Advantage We offer the best quality - worldwide. All major production technology and machines own designs; we have established production bases around the world. America, Australia, New Zealand and Asia This is how we ensure that all our products the same quality standards worldwide. How to Read a Tire? Tire Specifications: 1. Material: Rubber 2. Tire Size: 16X6.50-8 3. Load Range: Max. 620lbs@28psi 4. Tire Type: Tubeless 5. Rim Width: 5.375\" 6. SW: 165mm / 6.50\" 7. OD: 410mm / 16.14\" 8. Rating: 4 PLY 9. Tread Depth: 7.1mm/ 0.28\" 10. Pattern: P332 16X6.50-8 P512 16X6.50-8 P332 16X6.50-8 P328 16X6.50-8 P508 Ply Rating 4PR 4PR 4PR 4PR Tread Depth(mm) 5.5mm 7.1mm 12mm 4mm Max Load(Lbs) 615lbs 620lbs 615lbs 620lbs PSI 28 28 28 28 Why Choose Our Tire? The role of unique pattern design Increase the tire and the ground friction; Reduce tire noise to enhance comfort; For the tire cooling, drainage; Improve vehicle handling performance; The advantages of our service 1.Our factory has the professional R&D team and strong production capacity. We strictly check every product. We aims to manufacture premium tires. 2.Seller Fulfilled Prime. The advantages of our brand tires 1.Our tires adopt a special rubber formula, wear resistance, anti-aging and heat resistance than other brands of tires 2.Unique pattern design make your car in a variety of road safety and ease of driving. '" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection[1095149]['description']" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "id": "abe064b1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'type': 'product',\n", + " 'locale': 'us',\n", + " 'asin': 'B082K7V2GZ',\n", + " 'title': 'NEIKO 20601A 14.5” Steel Tire Spoons Tool Set, Tire Tools Include 3 Piece Tire Spoons, 3 Piece Rim Protector, Valve Tool, 6 Piece Valve Cores, Motorcycle Tire Changer, Dirt Bike Tire Levers',\n", + " 'stars': '4.5 out of 5 stars',\n", + " 'ratings': '5,926 ratings',\n", + " 'category': ['Automotive',\n", + " 'Tools & Equipment',\n", + " 'Tire & Wheel Tools',\n", + " 'Tire Repair Tools'],\n", + " 'attrs': {},\n", + " 'bullets': ['Make sure this fits by entering your model number.',\n", + " 'STEEL-IRON TIRE SPOONS: Each tire lever is constructed of hardened steel-iron with curved tips that provides strong toughness and reliable durability.',\n", + " 'WHEEL PROTECTION: Each tire spoon kit comes with three highly durable polypropylene rim protectors to prevent damage to the rims while working on motorcycle, lawnmower, or dirt bike in conjunction with the tire changing tools.',\n", + " 'LONGER TIRE TOOLS: Each tire iron spoon is an extra-long lever at 14.5 inches and offers more leverage and power when changing tires.',\n", + " '4-POINT VALVE TOOL: The included 4-point valve tool allows for quick and easy deflation of tires and valve core replacement when changing tires.',\n", + " 'TIRE APPLICATIONS: This tire lever tool set includes bike and dirt bike tire spoons, ATV, lawn tractor, garden tractor, lawnmower, car, and motorcycle tire spoons for tire changing.'],\n", + " 'description': \"Product Description 20601A Neiko Tire Spoons Rim Protector and Valve Tool Set is the perfect tool for any mechanics, homeowners, or DIY-ers! Whether you’re working on a car or motorcycle, this complete package of tools is great for removing damaged tires. The set not only includes one, but three flexible rim guards to prevent any damage to the rims while using the tire spoons. As an added BONUS, the set includes 6 Brass Schrader Valve Cores for convenience. Product Features: - Tire spoons are constructed of high quality Hardened Steel-Iron for ultimate durability/strength - Chrome polish finish that protects the tool from rust/corrosion and allows for hassle-free cleaning - Curved tips allow for easy insertion to any and all applications - Extra long length lever at 14.5 inches to easily prop out damaged tires without using extra force - Ergonomic, contoured, rubberized groove handle provides a natural non-slip grip while reducing hand fatigue and maximizing leverage power - 4 point valve tool with mouth side for attachments of various bits, deflation needle side that can be used to deflate the needle or remove stuck rocks in tire grooves, valve core side for quick removal and installation of valve core stems, and the screw thread side to easily clean the threads of the wheel stems Product Description 20601A Neiko Tire Spoons Rim Protector and Valve Tool Set is the perfect tool for any mechanics, homeowners, or DIY-ers! Whether you’re working on a car or motorcycle, this complete package of tools is great for removing damaged tires. The set not only includes one, but three flexible rim guards to prevent any damage to the rims while using the tire spoons. As an added BONUS, the set includes 6 Brass Schrader Valve Cores for convenience. Product Features: - Tire spoons are constructed of high quality Hardened Steel-Iron for ultimate durability/strength - Chrome polish finish that protects the tool from rust/corrosion and allows for hassle-free cleaning - Curved tips allow for easy insertion to any and all applications - Extra long length lever at 14.5 inches to easily prop out damaged tires without using extra force - Ergonomic, contoured, rubberized groove handle provides a natural non-slip grip while reducing hand fatigue and maximizing leverage power - 4 point valve tool with mouth side for attachments of various bits, deflation needle side that can be used to deflate the needle or remove stuck rocks in tire grooves, valve core side for quick removal and installation of valve core stems, and the screw thread side to easily clean the threads of the wheel stemsFrom the manufacturer Read more Premium Tire Changing Tool Kit Quality Construction The hardened steel iron construction through out the lever shaft to the curved tips, yield the ultimate in strength and durability that gives this tool set supreme effectiveness when tire changing. What's Included: 3 Piece - Hardend Steel-Iron Tire Spoon Levers 3 Piece - Rim Protectors 1 Piece - 4-Way Valve Tool 6 Piece - Brass Schrader Valve Cores Read more Rust Resistant With a polished chrome finish, you don't need to worry about your tire spoons getting rust on them. Longer Reach At 14.5 inches long, you can gain the leverage and utilize the force needed on your tires with ease! Ergonomics The rubber grip is ergonomically designed for comfort and control, and allows you to maximize your leverage. 4-Way Valve Tool and 6 Valve Cores Included With the 4-Way valve tool, you have a clean thread, valve core remover, deflation needle and tapping mouth, all-in-one, in addition to 6 brass valve cores all included. Read more Read more \",\n", + " 'info': {'Item Package Quantity': '\\u200e1',\n", + " 'Best Sellers Rank': '#1,619 in Automotive ( See Top 100 in Automotive ) #4 in Steering & Suspension Tools #26 in Tire Repair Tools',\n", + " 'Batteries Required?': '\\u200eNo',\n", + " 'Part Number': '\\u200e20601A',\n", + " 'Manufacturer': '\\u200eNeiko',\n", + " 'Item Weight': '\\u200e1.76 pounds',\n", + " 'Date First Available': 'December 10, 2019',\n", + " 'ASIN': 'B082K7V2GZ',\n", + " 'Item model number': '\\u200e20601A',\n", + " 'Batteries Included?': '\\u200eNo',\n", + " 'Included Components': '\\u200eTire spoons, Rim protectors',\n", + " 'Package Dimensions': '\\u200e15.27 x 4.65 x 1.73 inches',\n", + " 'Customer Reviews': '4.5 out of 5 stars 5,926 ratings 4.5 out of 5 stars',\n", + " 'Power Source': '\\u200eHand Powered',\n", + " 'Style': '\\u200e13 PIECE, 14.5\" TIRE SPOONS',\n", + " 'Country of Origin': '\\u200eChina'},\n", + " 'reviews': [{'stars': '5.0 out of 5 stars',\n", + " 'title': \"You get your money's worth.\",\n", + " 'date': 'Reviewed in the United States on December 20, 2022',\n", + " 'text': 'The tools are sturdy, nicely priced and most importantly..... they WORK! I was able to remove a tire that had a hole, patch it internally and reinstall because of these spoons! If an older man like me can fight with a tire using these successfully, then just about anyone can. The 3 rim protectors that accompany the 3 spoon bars do their job and protect the finish of your rims.'},\n", + " {'stars': '4.0 out of 5 stars',\n", + " 'title': 'Not Bad',\n", + " 'date': 'Reviewed in the United States on December 27, 2022',\n", + " 'text': 'Good Tool'},\n", + " {'stars': '4.0 out of 5 stars',\n", + " 'title': 'not bad for the money',\n", + " 'date': 'Reviewed in the United States on December 9, 2022',\n", + " 'text': 'these will be perfect for my new tire changes. no sharp edges to clean up, decent handles,and long enough for the leverage needed. not bad for the money.'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Perfect tire tools',\n", + " 'date': 'Reviewed in the United States on December 27, 2022',\n", + " 'text': 'Strong and worthy of your money'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Very good',\n", + " 'date': 'Reviewed in the United States on December 18, 2022',\n", + " 'text': 'Very worth the money. They are strong tools'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Some of the best',\n", + " 'date': 'Reviewed in the United States on December 13, 2022',\n", + " 'text': 'Spoons worked really well. Was actually very surprised with how good they did. Definitely would recommend!'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Great product for the price',\n", + " 'date': 'Reviewed in the United States on December 4, 2022',\n", + " 'text': 'No problems at all, great for motorcycle tires and has a small footprint when packing for a ride.'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'High quality. Recommended',\n", + " 'date': 'Reviewed in the United States on December 10, 2022',\n", + " 'text': 'Good product. Exactly as you would expect'},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'worked well',\n", + " 'date': 'Reviewed in Canada on December 28, 2020',\n", + " 'text': \"worked great. Rakes some muscle but I was able to mount 4 times once I figured one thing out. Once you have 1 side of the tire on the rim and you push on the bottom front side of the tire keep that edge inside the valley of the rim. Kinda hard to explain in words. With the edge in the valley you get a lot of slack on the top side of the tire and don't need as much prying force to get it over the rim.\"},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Great quality motorcycle tire spoons',\n", + " 'date': 'Reviewed in Canada on July 31, 2020',\n", + " 'text': \"It was my first time changing both front and rear tires on my 2003 VFR800 and man was it a pain to remove and install the tires, especially the really stiff front one. I'll be sure to warm them up in the sun next time! These tire spoons helped make the job at least bearable. I have no idea how people can fit rim protectors while doing it, as there's barely any room to maneuver them onto the rim! The paint on my rim has chipped at a few places, but there's no scratch so far. I'll be more careful next time haha...\"},\n", + " {'stars': '2.0 out of 5 stars',\n", + " 'title': \"Wasn't able to change my 110/70 and 140/70 tires on the bike.\",\n", + " 'date': 'Reviewed in Canada on July 11, 2020',\n", + " 'text': \"I really appreciate that there is a third spoon but breaking the bead was a trick and I just wasn't able to comfortably stretch the sidewall over the wheel rim without scratching the wheel terribly. The plastic rim protectors are too thick to be truly useful. Maybe it was because the tires were 5 years old and narrow bias-ply construction, but just ended up taking the new tires and the wheels to a shop to be changed.\"},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Great atv tire spoons',\n", + " 'date': 'Reviewed in Canada on October 3, 2021',\n", + " 'text': \"Have mounted 4 sets of atv tires now with these spoons. Rim protectors help, I mounted tires on new anodized gold rims and didn't leave one scratch anywhere. 3 spoons are needed for the small hard sidewall of atv tires, like the grippy handles and plated steel spoons won't rust or corrode for a long time\"},\n", + " {'stars': '5.0 out of 5 stars',\n", + " 'title': 'Buen material',\n", + " 'date': 'Reviewed in Mexico on July 5, 2022',\n", + " 'text': 'Es muy fácil de usar!! Vi un vídeo y entendí por qué vienen 3, es más fácil ocupando las 3!! Si no quieres que se raye lo cromadas que están se deben utilizar los accesorios que vienen incluidos!!'}],\n", + " 'price': '$20.70',\n", + " 'formats': {},\n", + " 'template': 'home_improvement',\n", + " 'image': 'https://m.media-amazon.com/images/I/719JxN+pVWL._AC_SY300_SX300_.jpg',\n", + " 'doc_id': 689593,\n", + " 'docid': 689593,\n", + " 'text': \"Product Description 20601A Neiko Tire Spoons Rim Protector and Valve Tool Set is the perfect tool for any mechanics, homeowners, or DIY-ers! Whether you’re working on a car or motorcycle, this complete package of tools is great for removing damaged tires. The set not only includes one, but three flexible rim guards to prevent any damage to the rims while using the tire spoons. As an added BONUS, the set includes 6 Brass Schrader Valve Cores for convenience. Product Features: - Tire spoons are constructed of high quality Hardened Steel-Iron for ultimate durability/strength - Chrome polish finish that protects the tool from rust/corrosion and allows for hassle-free cleaning - Curved tips allow for easy insertion to any and all applications - Extra long length lever at 14.5 inches to easily prop out damaged tires without using extra force - Ergonomic, contoured, rubberized groove handle provides a natural non-slip grip while reducing hand fatigue and maximizing leverage power - 4 point valve tool with mouth side for attachments of various bits, deflation needle side that can be used to deflate the needle or remove stuck rocks in tire grooves, valve core side for quick removal and installation of valve core stems, and the screw thread side to easily clean the threads of the wheel stems Product Description 20601A Neiko Tire Spoons Rim Protector and Valve Tool Set is the perfect tool for any mechanics, homeowners, or DIY-ers! Whether you’re working on a car or motorcycle, this complete package of tools is great for removing damaged tires. The set not only includes one, but three flexible rim guards to prevent any damage to the rims while using the tire spoons. As an added BONUS, the set includes 6 Brass Schrader Valve Cores for convenience. Product Features: - Tire spoons are constructed of high quality Hardened Steel-Iron for ultimate durability/strength - Chrome polish finish that protects the tool from rust/corrosion and allows for hassle-free cleaning - Curved tips allow for easy insertion to any and all applications - Extra long length lever at 14.5 inches to easily prop out damaged tires without using extra force - Ergonomic, contoured, rubberized groove handle provides a natural non-slip grip while reducing hand fatigue and maximizing leverage power - 4 point valve tool with mouth side for attachments of various bits, deflation needle side that can be used to deflate the needle or remove stuck rocks in tire grooves, valve core side for quick removal and installation of valve core stems, and the screw thread side to easily clean the threads of the wheel stemsFrom the manufacturer Read more Premium Tire Changing Tool Kit Quality Construction The hardened steel iron construction through out the lever shaft to the curved tips, yield the ultimate in strength and durability that gives this tool set supreme effectiveness when tire changing. What's Included: 3 Piece - Hardend Steel-Iron Tire Spoon Levers 3 Piece - Rim Protectors 1 Piece - 4-Way Valve Tool 6 Piece - Brass Schrader Valve Cores Read more Rust Resistant With a polished chrome finish, you don't need to worry about your tire spoons getting rust on them. Longer Reach At 14.5 inches long, you can gain the leverage and utilize the force needed on your tires with ease! Ergonomics The rubber grip is ergonomically designed for comfort and control, and allows you to maximize your leverage. 4-Way Valve Tool and 6 Valve Cores Included With the 4-Way valve tool, you have a clean thread, valve core remover, deflation needle and tapping mouth, all-in-one, in addition to 6 brass valve cores all included. Read more Read more \"}" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection[int(hits[0].docid)]" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "id": "df74389c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0 samples processed\n", + "100 samples processed\n", + "200 samples processed\n", + "300 samples processed\n", + "400 samples processed\n", + "500 samples processed\n", + "600 samples processed\n", + "700 samples processed\n", + "800 samples processed\n", + "900 samples processed\n", + "1000 samples processed\n", + "1100 samples processed\n", + "1200 samples processed\n", + "1300 samples processed\n", + "1400 samples processed\n", + "1500 samples processed\n", + "1600 samples processed\n", + "1700 samples processed\n", + "1800 samples processed\n", + "1900 samples processed\n", + "2000 samples processed\n", + "2100 samples processed\n", + "2200 samples processed\n", + "2300 samples processed\n", + "2400 samples processed\n", + "2500 samples processed\n", + "2600 samples processed\n", + "2700 samples processed\n", + "2800 samples processed\n", + "2900 samples processed\n", + "3000 samples processed\n", + "3100 samples processed\n", + "3200 samples processed\n", + "3300 samples processed\n", + "3400 samples processed\n", + "3500 samples processed\n", + "3600 samples processed\n", + "3700 samples processed\n", + "3800 samples processed\n", + "3900 samples processed\n", + "4000 samples processed\n", + "4100 samples processed\n", + "4200 samples processed\n", + "4300 samples processed\n", + "4400 samples processed\n", + "4500 samples processed\n", + "4600 samples processed\n", + "4700 samples processed\n", + "4800 samples processed\n", + "4900 samples processed\n", + "5000 samples processed\n", + "5100 samples processed\n", + "5200 samples processed\n", + "5300 samples processed\n", + "5400 samples processed\n", + "5500 samples processed\n", + "5600 samples processed\n", + "5700 samples processed\n", + "5800 samples processed\n", + "5900 samples processed\n", + "6000 samples processed\n", + "6100 samples processed\n", + "6200 samples processed\n", + "6300 samples processed\n", + "6400 samples processed\n", + "6500 samples processed\n", + "6600 samples processed\n", + "6700 samples processed\n", + "6800 samples processed\n", + "6900 samples processed\n", + "7000 samples processed\n", + "7100 samples processed\n", + "7200 samples processed\n", + "7300 samples processed\n", + "7400 samples processed\n", + "7500 samples processed\n", + "7600 samples processed\n", + "7700 samples processed\n", + "7800 samples processed\n", + "7900 samples processed\n", + "8000 samples processed\n", + "8100 samples processed\n", + "8200 samples processed\n", + "8300 samples processed\n", + "8400 samples processed\n", + "8500 samples processed\n", + "8600 samples processed\n", + "8700 samples processed\n", + "8800 samples processed\n", + "8900 samples processed\n", + "9000 samples processed\n", + "9100 samples processed\n", + "9200 samples processed\n", + "9300 samples processed\n", + "9400 samples processed\n", + "9500 samples processed\n", + "9600 samples processed\n", + "9700 samples processed\n", + "9800 samples processed\n", + "9900 samples processed\n", + "10000 samples processed\n", + "10100 samples processed\n", + "10200 samples processed\n", + "10300 samples processed\n", + "10400 samples processed\n", + "10500 samples processed\n", + "10600 samples processed\n", + "10700 samples processed\n", + "10800 samples processed\n", + "10900 samples processed\n", + "11000 samples processed\n", + "11100 samples processed\n", + "11200 samples processed\n", + "11300 samples processed\n", + "11400 samples processed\n", + "11500 samples processed\n", + "11600 samples processed\n", + "11700 samples processed\n", + "11800 samples processed\n", + "11900 samples processed\n", + "12000 samples processed\n", + "12100 samples processed\n", + "12200 samples processed\n", + "12300 samples processed\n", + "12400 samples processed\n", + "12500 samples processed\n", + "12600 samples processed\n", + "12700 samples processed\n", + "12800 samples processed\n", + "12900 samples processed\n", + "13000 samples processed\n", + "13100 samples processed\n", + "13200 samples processed\n", + "13300 samples processed\n", + "13400 samples processed\n", + "13500 samples processed\n", + "13600 samples processed\n", + "13700 samples processed\n", + "13800 samples processed\n", + "13900 samples processed\n", + "14000 samples processed\n", + "14100 samples processed\n", + "14200 samples processed\n", + "14300 samples processed\n", + "14400 samples processed\n", + "14500 samples processed\n", + "14600 samples processed\n", + "14700 samples processed\n", + "14800 samples processed\n", + "14900 samples processed\n", + "15000 samples processed\n", + "15100 samples processed\n", + "15200 samples processed\n", + "15300 samples processed\n", + "15400 samples processed\n", + "15500 samples processed\n", + "15600 samples processed\n", + "15700 samples processed\n", + "15800 samples processed\n", + "15900 samples processed\n", + "16000 samples processed\n", + "16100 samples processed\n", + "16200 samples processed\n", + "16300 samples processed\n", + "16400 samples processed\n", + "16500 samples processed\n", + "16600 samples processed\n", + "16700 samples processed\n", + "16800 samples processed\n", + "16900 samples processed\n", + "17000 samples processed\n", + "17100 samples processed\n", + "17200 samples processed\n", + "17300 samples processed\n", + "17400 samples processed\n", + "17500 samples processed\n", + "17600 samples processed\n", + "17700 samples processed\n", + "17800 samples processed\n", + "17900 samples processed\n", + "18000 samples processed\n", + "18100 samples processed\n", + "18200 samples processed\n", + "18300 samples processed\n", + "18400 samples processed\n", + "18500 samples processed\n", + "18600 samples processed\n", + "18700 samples processed\n", + "18800 samples processed\n", + "18900 samples processed\n", + "19000 samples processed\n", + "19100 samples processed\n", + "19200 samples processed\n", + "19300 samples processed\n", + "19400 samples processed\n", + "19500 samples processed\n", + "19600 samples processed\n", + "19700 samples processed\n", + "19800 samples processed\n", + "19900 samples processed\n", + "20000 samples processed\n", + "20100 samples processed\n", + "20200 samples processed\n", + "20300 samples processed\n", + "20400 samples processed\n", + "20500 samples processed\n", + "20600 samples processed\n", + "20700 samples processed\n", + "20800 samples processed\n" + ] + } + ], + "source": [ + "num_negatives = 100\n", + "num_written = 0\n", + "with open(\"train.jsonl\",'w') as w:\n", + " for qid in train:\n", + " if num_written % 100 == 0:\n", + " print(\"{} samples processed\".format(num_written))\n", + " j = {}\n", + " j['query_id'] = qid\n", + " j['query'] = train[qid]['query_text']\n", + " j['positive_passages'] = []\n", + " j['negative_passages'] = []\n", + " prove_positive = []\n", + " for doc_id in train[qid]['labels']:\n", + " relevance = train[qid]['labels'][doc_id]\n", + " if relevance == 3:\n", + " doc = collection[doc_id]\n", + " i = {}\n", + " prove_positive.append(doc_id) # keep track of positives to ensure we don't count them as random negatives\n", + " i['docid'] = doc_id\n", + " i['title'] = collection[doc_id]['title']\n", + " i['text'] = collection[doc_id]['description']\n", + " j['positive_passages'].append(i)\n", + " hits = searcher.search(j['query'], num_negatives)\n", + " for z in range(0,len(hits)):\n", + " if hits[z].docid not in prove_positive:\n", + " i = {}\n", + " i['docid'] = int(hits[z].docid)\n", + " i['title'] = collection[i['docid']]['title']\n", + " i['text'] = collection[i['docid']]['description']\n", + " j['negative_passages'].append(i)\n", + " w.write('{}\\n'.format(json.dumps(j)))\n", + " num_written += 1\n", + " \n", + "#from pyarrow import json\n", + "#table = json.read_json('train.jsonl') \n", + "#pq.write_table(table, 'train.parquet')\n", + "#import json\n", + "from json2parquet import convert_json\n", + "convert_json('train.jsonl','train.parquet') # have to do this as the block size has some issue " + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "id": "3e02694a", + "metadata": {}, + "outputs": [], + "source": [ + "num_negatives = 100\n", + "with open(\"dev.jsonl\",'w') as w:\n", + " for qid in test:\n", + " j = {}\n", + " j['query_id'] = qid\n", + " j['query'] = test[qid]['query_text']\n", + " j['positive_passages'] = []\n", + " j['negative_passages'] = []\n", + " prove_positive = []\n", + " for doc_id in test[qid]['labels']:\n", + " relevance = test[qid]['labels'][doc_id]\n", + " if relevance == 3:\n", + " doc = collection[doc_id]\n", + " i = {}\n", + " prove_positive.append(doc_id) # keep track of positives to ensure we don't count them as random negatives\n", + " i['docid'] = doc_id\n", + " i['title'] = collection[doc_id]['title']\n", + " i['text'] = collection[doc_id]['description']\n", + " j['positive_passages'].append(i)\n", + " hits = searcher.search(j['query'], num_negatives)\n", + " for z in range(0,len(hits)):\n", + " if hits[z].docid not in prove_positive:\n", + " i = {}\n", + " i['docid'] = int(hits[z].docid)\n", + " i['title'] = collection[i['docid']]['title']\n", + " i['text'] = collection[i['docid']]['description']\n", + " j['negative_passages'].append(i)\n", + " w.write('{}\\n'.format(json.dumps(j)))\n", + "\n", + "from pyarrow import json\n", + "table = json.read_json('dev.jsonl') \n", + "pq.write_table(table, 'dev.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "id": "da43a975", + "metadata": {}, + "outputs": [], + "source": [ + "num_negatives = 100\n", + "with open(\"test.jsonl\",'w') as w:\n", + " for qid in new_queries:\n", + " j = {}\n", + " j['query_id'] = qid\n", + " j['query'] = new_queries[qid]\n", + " j['positive_passages'] = []\n", + " j['negative_passages'] = []\n", + " w.write('{}\\n'.format(json.dumps(j)))\n", + "\n", + "from pyarrow import json\n", + "table = json.read_json('test.jsonl') \n", + "pq.write_table(table, 'test.parquet')\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8f7cd3a5", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "base", + "language": "python", + "name": "base" + }, + "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.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}