From 2c563d541b2f627adbbe5199495743edec5808b7 Mon Sep 17 00:00:00 2001 From: jacko460 <jacko460@student.liu.se> Date: Thu, 7 Nov 2024 15:13:05 +0100 Subject: [PATCH] lab 1 done, no reflections --- l1/TM-Lab1.ipynb | 758 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 630 insertions(+), 128 deletions(-) diff --git a/l1/TM-Lab1.ipynb b/l1/TM-Lab1.ipynb index 4b023f6..067f3f5 100644 --- a/l1/TM-Lab1.ipynb +++ b/l1/TM-Lab1.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 88, "id": "2c92aa93-cf15-4e1c-975e-fea9bbe0b0c4", "metadata": { "deletable": false, @@ -75,7 +75,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 89, "id": "fd4982e3-3df4-4837-97b5-4c300b0d4a20", "metadata": { "deletable": false, @@ -116,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 90, "id": "141b8fbb-7a52-4cec-8d9f-921f4694e9c8", "metadata": {}, "outputs": [ @@ -198,7 +198,7 @@ "205 The Empire has fallen, and the Age of Great Mercenaries Now Begins!\\nCreate Your Ultimate Team And Strike Down Your Enemies!\\n\\nCAPTIVATING AND STUNNING ARTWORK\\n- Experience the high-quality anime illustrations you have never seen before.\\n- Meet Brown Dust's charming Mercenaries now.\\n\\nASSEMBLE LEGENDARY MERCENARIES\\n- Over 300 Mercenaries and a Variety of Skills.\\n- Discover the Unique Mercenaries, 6 Devils and Dominus Octo.\\n- All Mercenaries can reach max level and the highest rank.\\n\\... " ] }, - "execution_count": 96, + "execution_count": 90, "metadata": {}, "output_type": "execute_result" } @@ -217,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": 91, "id": "595bb7af-5ee4-4b8e-8f5e-df5aaae688d9", "metadata": {}, "outputs": [ @@ -227,7 +227,7 @@ "'Introducing the best Brick Breaker game that everyone can enjoy.\\nEnjoy various missions and addictively simple play control.\\n\\n[Features]\\n- Hundreds of stages and various missions\\n- No limit to play such as Heart, play as much as you can!\\n- 5 kinds of various items and items reinforcement system\\n- No network required\\n- game file is as low as 20M, light-weight download!\\n- supports tablet screen\\n- supports Google Play Leaderboards, Achievement, Multiplay\\n- supports 14 languages\\n\\nHomepage:\\nhttps://play.google.com/store/apps/dev?id=4931745640662708567\\n\\nFacebook: \\nhttps://www.facebook.com/spcomesgames/'" ] }, - "execution_count": 97, + "execution_count": 91, "metadata": {}, "output_type": "execute_result" } @@ -254,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 92, "id": "0ca674d8-c2df-4c8f-bb3d-6d59bdc401fb", "metadata": { "deletable": false, @@ -278,7 +278,7 @@ "\twith 267110 stored elements and shape (1614, 27877)>" ] }, - "execution_count": 98, + "execution_count": 92, "metadata": {}, "output_type": "execute_result" } @@ -301,7 +301,7 @@ }, { "cell_type": "code", - "execution_count": 99, + "execution_count": 93, "id": "10d112e7-e564-4e47-a633-38910709947f", "metadata": {}, "outputs": [ @@ -344,7 +344,7 @@ }, { "cell_type": "code", - "execution_count": 100, + "execution_count": 94, "id": "2f43ad18-aa4e-4d31-85de-0a7419767c37", "metadata": { "deletable": false, @@ -415,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 95, "id": "ccf46d50-ea74-42d7-86e2-6520dde6eac6", "metadata": { "deletable": false, @@ -434,7 +434,7 @@ { "data": { "text/html": [ - "<style>#sk-container-id-2 {\n", + "<style>#sk-container-id-1 {\n", " /* Definition of color scheme common for light and dark mode */\n", " --sklearn-color-text: black;\n", " --sklearn-color-line: gray;\n", @@ -464,15 +464,15 @@ " }\n", "}\n", "\n", - "#sk-container-id-2 {\n", + "#sk-container-id-1 {\n", " color: var(--sklearn-color-text);\n", "}\n", "\n", - "#sk-container-id-2 pre {\n", + "#sk-container-id-1 pre {\n", " padding: 0;\n", "}\n", "\n", - "#sk-container-id-2 input.sk-hidden--visually {\n", + "#sk-container-id-1 input.sk-hidden--visually {\n", " border: 0;\n", " clip: rect(1px 1px 1px 1px);\n", " clip: rect(1px, 1px, 1px, 1px);\n", @@ -484,7 +484,7 @@ " width: 1px;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-dashed-wrapped {\n", + "#sk-container-id-1 div.sk-dashed-wrapped {\n", " border: 1px dashed var(--sklearn-color-line);\n", " margin: 0 0.4em 0.5em 0.4em;\n", " box-sizing: border-box;\n", @@ -492,7 +492,7 @@ " background-color: var(--sklearn-color-background);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-container {\n", + "#sk-container-id-1 div.sk-container {\n", " /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n", " but bootstrap.min.css set `[hidden] { display: none !important; }`\n", " so we also need the `!important` here to be able to override the\n", @@ -502,7 +502,7 @@ " position: relative;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-text-repr-fallback {\n", + "#sk-container-id-1 div.sk-text-repr-fallback {\n", " display: none;\n", "}\n", "\n", @@ -518,14 +518,14 @@ "\n", "/* Parallel-specific style estimator block */\n", "\n", - "#sk-container-id-2 div.sk-parallel-item::after {\n", + "#sk-container-id-1 div.sk-parallel-item::after {\n", " content: \"\";\n", " width: 100%;\n", " border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n", " flex-grow: 1;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-parallel {\n", + "#sk-container-id-1 div.sk-parallel {\n", " display: flex;\n", " align-items: stretch;\n", " justify-content: center;\n", @@ -533,28 +533,28 @@ " position: relative;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-parallel-item {\n", + "#sk-container-id-1 div.sk-parallel-item {\n", " display: flex;\n", " flex-direction: column;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-parallel-item:first-child::after {\n", + "#sk-container-id-1 div.sk-parallel-item:first-child::after {\n", " align-self: flex-end;\n", " width: 50%;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-parallel-item:last-child::after {\n", + "#sk-container-id-1 div.sk-parallel-item:last-child::after {\n", " align-self: flex-start;\n", " width: 50%;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-parallel-item:only-child::after {\n", + "#sk-container-id-1 div.sk-parallel-item:only-child::after {\n", " width: 0;\n", "}\n", "\n", "/* Serial-specific style estimator block */\n", "\n", - "#sk-container-id-2 div.sk-serial {\n", + "#sk-container-id-1 div.sk-serial {\n", " display: flex;\n", " flex-direction: column;\n", " align-items: center;\n", @@ -572,14 +572,14 @@ "\n", "/* Pipeline and ColumnTransformer style (default) */\n", "\n", - "#sk-container-id-2 div.sk-toggleable {\n", + "#sk-container-id-1 div.sk-toggleable {\n", " /* Default theme specific background. It is overwritten whether we have a\n", " specific estimator or a Pipeline/ColumnTransformer */\n", " background-color: var(--sklearn-color-background);\n", "}\n", "\n", "/* Toggleable label */\n", - "#sk-container-id-2 label.sk-toggleable__label {\n", + "#sk-container-id-1 label.sk-toggleable__label {\n", " cursor: pointer;\n", " display: block;\n", " width: 100%;\n", @@ -589,7 +589,7 @@ " text-align: center;\n", "}\n", "\n", - "#sk-container-id-2 label.sk-toggleable__label-arrow:before {\n", + "#sk-container-id-1 label.sk-toggleable__label-arrow:before {\n", " /* Arrow on the left of the label */\n", " content: \"▸\";\n", " float: left;\n", @@ -597,13 +597,13 @@ " color: var(--sklearn-color-icon);\n", "}\n", "\n", - "#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {\n", + "#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {\n", " color: var(--sklearn-color-text);\n", "}\n", "\n", "/* Toggleable content - dropdown */\n", "\n", - "#sk-container-id-2 div.sk-toggleable__content {\n", + "#sk-container-id-1 div.sk-toggleable__content {\n", " max-height: 0;\n", " max-width: 0;\n", " overflow: hidden;\n", @@ -612,12 +612,12 @@ " background-color: var(--sklearn-color-unfitted-level-0);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-toggleable__content.fitted {\n", + "#sk-container-id-1 div.sk-toggleable__content.fitted {\n", " /* fitted */\n", " background-color: var(--sklearn-color-fitted-level-0);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-toggleable__content pre {\n", + "#sk-container-id-1 div.sk-toggleable__content pre {\n", " margin: 0.2em;\n", " border-radius: 0.25em;\n", " color: var(--sklearn-color-text);\n", @@ -625,79 +625,79 @@ " background-color: var(--sklearn-color-unfitted-level-0);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-toggleable__content.fitted pre {\n", + "#sk-container-id-1 div.sk-toggleable__content.fitted pre {\n", " /* unfitted */\n", " background-color: var(--sklearn-color-fitted-level-0);\n", "}\n", "\n", - "#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n", + "#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n", " /* Expand drop-down */\n", " max-height: 200px;\n", " max-width: 100%;\n", " overflow: auto;\n", "}\n", "\n", - "#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n", + "#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n", " content: \"▾\";\n", "}\n", "\n", "/* Pipeline/ColumnTransformer-specific style */\n", "\n", - "#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", + "#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", " color: var(--sklearn-color-text);\n", " background-color: var(--sklearn-color-unfitted-level-2);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", + "#sk-container-id-1 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", " background-color: var(--sklearn-color-fitted-level-2);\n", "}\n", "\n", "/* Estimator-specific style */\n", "\n", "/* Colorize estimator box */\n", - "#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", + "#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", " /* unfitted */\n", " background-color: var(--sklearn-color-unfitted-level-2);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", + "#sk-container-id-1 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n", " /* fitted */\n", " background-color: var(--sklearn-color-fitted-level-2);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-label label.sk-toggleable__label,\n", - "#sk-container-id-2 div.sk-label label {\n", + "#sk-container-id-1 div.sk-label label.sk-toggleable__label,\n", + "#sk-container-id-1 div.sk-label label {\n", " /* The background is the default theme color */\n", " color: var(--sklearn-color-text-on-default-background);\n", "}\n", "\n", "/* On hover, darken the color of the background */\n", - "#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {\n", + "#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {\n", " color: var(--sklearn-color-text);\n", " background-color: var(--sklearn-color-unfitted-level-2);\n", "}\n", "\n", "/* Label box, darken color on hover, fitted */\n", - "#sk-container-id-2 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n", + "#sk-container-id-1 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n", " color: var(--sklearn-color-text);\n", " background-color: var(--sklearn-color-fitted-level-2);\n", "}\n", "\n", "/* Estimator label */\n", "\n", - "#sk-container-id-2 div.sk-label label {\n", + "#sk-container-id-1 div.sk-label label {\n", " font-family: monospace;\n", " font-weight: bold;\n", " display: inline-block;\n", " line-height: 1.2em;\n", "}\n", "\n", - "#sk-container-id-2 div.sk-label-container {\n", + "#sk-container-id-1 div.sk-label-container {\n", " text-align: center;\n", "}\n", "\n", "/* Estimator-specific */\n", - "#sk-container-id-2 div.sk-estimator {\n", + "#sk-container-id-1 div.sk-estimator {\n", " font-family: monospace;\n", " border: 1px dotted var(--sklearn-color-border-box);\n", " border-radius: 0.25em;\n", @@ -707,18 +707,18 @@ " background-color: var(--sklearn-color-unfitted-level-0);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-estimator.fitted {\n", + "#sk-container-id-1 div.sk-estimator.fitted {\n", " /* fitted */\n", " background-color: var(--sklearn-color-fitted-level-0);\n", "}\n", "\n", "/* on hover */\n", - "#sk-container-id-2 div.sk-estimator:hover {\n", + "#sk-container-id-1 div.sk-estimator:hover {\n", " /* unfitted */\n", " background-color: var(--sklearn-color-unfitted-level-2);\n", "}\n", "\n", - "#sk-container-id-2 div.sk-estimator.fitted:hover {\n", + "#sk-container-id-1 div.sk-estimator.fitted:hover {\n", " /* fitted */\n", " background-color: var(--sklearn-color-fitted-level-2);\n", "}\n", @@ -805,7 +805,7 @@ "\n", "/* \"?\"-specific style due to the `<a>` HTML tag */\n", "\n", - "#sk-container-id-2 a.estimator_doc_link {\n", + "#sk-container-id-1 a.estimator_doc_link {\n", " float: right;\n", " font-size: 1rem;\n", " line-height: 1em;\n", @@ -820,31 +820,31 @@ " border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n", "}\n", "\n", - "#sk-container-id-2 a.estimator_doc_link.fitted {\n", + "#sk-container-id-1 a.estimator_doc_link.fitted {\n", " /* fitted */\n", " border: var(--sklearn-color-fitted-level-1) 1pt solid;\n", " color: var(--sklearn-color-fitted-level-1);\n", "}\n", "\n", "/* On hover */\n", - "#sk-container-id-2 a.estimator_doc_link:hover {\n", + "#sk-container-id-1 a.estimator_doc_link:hover {\n", " /* unfitted */\n", " background-color: var(--sklearn-color-unfitted-level-3);\n", " color: var(--sklearn-color-background);\n", " text-decoration: none;\n", "}\n", "\n", - "#sk-container-id-2 a.estimator_doc_link.fitted:hover {\n", + "#sk-container-id-1 a.estimator_doc_link.fitted:hover {\n", " /* fitted */\n", " background-color: var(--sklearn-color-fitted-level-3);\n", "}\n", - "</style><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>NearestNeighbors(metric='cosine', n_neighbors=10)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" checked><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\"> NearestNeighbors<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.5/modules/generated/sklearn.neighbors.NearestNeighbors.html\">?<span>Documentation for NearestNeighbors</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>NearestNeighbors(metric='cosine', n_neighbors=10)</pre></div> </div></div></div></div>" + "</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>NearestNeighbors(metric='cosine', n_neighbors=10)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\"> NearestNeighbors<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.5/modules/generated/sklearn.neighbors.NearestNeighbors.html\">?<span>Documentation for NearestNeighbors</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>NearestNeighbors(metric='cosine', n_neighbors=10)</pre></div> </div></div></div></div>" ], "text/plain": [ "NearestNeighbors(metric='cosine', n_neighbors=10)" ] }, - "execution_count": 101, + "execution_count": 95, "metadata": {}, "output_type": "execute_result" } @@ -871,7 +871,7 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 96, "id": "d70bfb5a-3648-44ad-aa3a-dfa39838ffc3", "metadata": { "deletable": false, @@ -923,7 +923,7 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": null, "id": "3d30a52e-bdac-412b-b9c4-8e9cc17436a6", "metadata": { "deletable": false, @@ -969,98 +969,97 @@ " <tbody>\n", " <tr>\n", " <th>0</th>\n", - " <td>Pancake Tower</td>\n", - " <td>Let's see how many pancakes you can pile up!!</td>\n", + " <td>Pony Princess Academy</td>\n", + " <td>Join your favorite princess ponies in the most prestigious fashion & academy around! Get ready for a semester full of style & fun! Prance down the runway, show off your favorite new outfits, dress up in style, pose for your pony cover shoot & so much more! \\n\\nMake sure to sign up for the Pony Fashion Competition & vote for the most stylish princess pony! You can even attend a Pony Fashion Class - balance books to practice for the runway, practice your poses & more! Hurry up, Pony Princess A...</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", - " <td>Cooking School: Games for Girls</td>\n", - " <td>Children like to help their parents. They especially like to help with cooking . When there is a cooking in the kitchen, it is no way to play. But cooking is a complicated process and often it ends up with a huge mess in the kitchen. But what if you are so eager to cook pancakes, cake or cupcakes? How to cook all that without doing a cleaning after? We have a solution! Home Cooking School with our curious Hippo has opened especially for parents and children! We do not only cook food here. We...</td>\n", + " <td>Pony Style Box</td>\n", + " <td>Pony Style Box is an incredibly fun and creative app to dress-up and style your very own pony in thousands of different ways! \\n\\nYou can choose between 5 different ponies, make crazy haircuts like in a hair salon, dress and saddle them up, take pictures and watch their amazing animations and special effects! Every pony has its own character, dance moves and surprises.\\n\\nLet your creativity blossom! Use different colors, add accessories, hairspray, nail varnish and stickers as well as hairp...</td>\n", " </tr>\n", " <tr>\n", " <th>2</th>\n", - " <td>Hell’s Cooking — crazy chef burger, kitchen fever</td>\n", - " <td>⭐ ⭐ ⭐ ⭐ ⭐ New world of crazy cooking is here. Feel what it means to be a master chef who prepares fantastic fast food in a prominent king kitchen! If you haven't ever tried yourself as a hamburger chef cook, it's possibly the best time for making diner. Download and launch Hell's Cooking — crazy chef burger, kitchen fever HD game and get prepared to jump into a fever and adventurous perfect world of burgers.\\n\\nNew girls game Hell's Cooking gives you lots of opportunities for your crazy cafe...</td>\n", + " <td>Pokémon Masters</td>\n", + " <td>Start a new adventure in the Pokémon world! Explore the all-new island of Pasio!\\n\\nThere’s a tournament of 3-on-3 battles being held on Pasio called the Pokémon Masters League. Aim to become its champion as you battle with famous Trainers and make a dream team of friends on the way!\\n\\nForm a team with three Trainers and their Pokémon to target your opponents' weaknesses and deal big damage!\\n\\nEnjoy co-op play with friends all around the world! In co-op play, three players team up for fun,...</td>\n", " </tr>\n", " <tr>\n", " <th>3</th>\n", - " <td>Solitaire</td>\n", - " <td>Solitaire Free by Solitaire Card Games is the #1 klondike solitaire games on android. The solitaire Free is popular and classic card games you know and love.\\n\\nWe carefully designed a fresh solitaire free modern look, woven into the wonderful solitaire classic feel that everyone loves. \\n\\nExperience the crisp, clear, and easy to read cards, simple and quick animations, and subtle sounds, in either landscape or portrait views. \\n\\nYou can move cards with a single tap or drag them to their d...</td>\n", + " <td>Pokémon Quest</td>\n", + " <td>• The Pokémon you know and love have turned into...cubes?! Head out in search of treasure with your cube-shaped Pokémon buddies on Tumblecube Island—a land where everything is a cube! Your goal is to find the awesome goodies said to be hidden on the island ! The Pokémon you know and love from Pokémon Red and Pokémon Blue appear in this game.\\n\\n• Battle by tapping! The simple controls make for lively and fun battles! Danger is lurking, so you’ll need the help of your Pokémon buddies on your ...</td>\n", " </tr>\n", " <tr>\n", " <th>4</th>\n", - " <td>Rummy - Free</td>\n", - " <td>Play the famous Rummy card game on your Android Smartphone or Tablet !! \\n\\nPlay rummy with 2, 3, or 4 players against simulated opponents playing with high-level artificial intelligence. \\nThere are a number of rules that can be modified, making this game very faithful to the original. \\n\\n*** MANY VARIATIONS INCLUDED *** \\n\\nMany rummy variations are included in the application: \\n\\n- From 2 to 4 players. \\n- Choose the AI level of opponents. \\n- Number of cards dealt to each player (from ...</td>\n", + " <td>Polar Flow – Sync & Analyze</td>\n", + " <td>Polar Flow is a sports, fitness, and activity analyzer to be used with Polar GPS sports watches, fitness trackers, and activity trackers.* Follow your training and activity and instantly see your achievements. You can see all of your training and activity data on your phone on the go, and sync them wirelessly to the Polar Flow.\\n\\n*Compatible devices: http://support.polar.com/en/support/polar_flow_app_and_compatible_devices\\n\\nREVIEWS OF POLAR FLOW\\n\"I found Polar Flow to be a terrific compl...</td>\n", " </tr>\n", " <tr>\n", " <th>5</th>\n", - " <td>Sago Mini Trucks and Diggers</td>\n", - " <td>Drive a dump truck with Rosie the hamster! Pile dirt high and dig deep in the ground with diggers, cranes and bulldozers. Build a home for a new friend! Choose a barn, a castle or even a cupcake-house. Don’t forget to add the finishing touches for the proud owner.\\n\\nOn this construction site, kids love being the boss. With six mighty machines and piles of dirt, you can build all day! Part of the award-winning suite of Sago Mini apps, this app puts kids in charge.\\n\\nSago Mini apps have no i...</td>\n", + " <td>Pocket Tower: Building Game & Megapolis Kings</td>\n", + " <td>Trump isn't the only one who can build a tower! Construct your skyscraper and build your business empire from a Tiny Tower to the Tallest Building one tap at a time!\\n\\n\\nPocket Tower is an easy to play game that puts you in charge of building a skyscraper a floor at a time, look after business management and take it to the top of the charts while taking care of all your cute residents.\\n\\nMeet the update with new VIP's, 20 more floors of addictive fun and daily gifts to unwrap. Let the Buil...</td>\n", " </tr>\n", " <tr>\n", " <th>6</th>\n", - " <td>Dr. Panda's Ice Cream Truck</td>\n", - " <td>Chocolate? Vanilla? Strawberry? All three!? You decide! In Dr. Panda’s Ice Cream Truck you can mix up all sorts of different flavors with cookies, chocolate, nuts and more to make the perfect ice cream—hundreds of combinations in all.\\n\\nScoop it!\\nThese animals love ice cream, and will eat as much (or little) as you want to serve them. You can make scoops big or small and pile them as high as you want—using any of the ice cream you’ve created!\\n\\nToppings galore!\\nUse chocolate syrup, cooki...</td>\n", + " <td>Pou</td>\n", + " <td>Do you have what it takes to take care of your very own alien pet?! Feed it, clean it, play with it and watch it grow up while leveling up and unlocking different wallpapers and outfits to satisfy your unique taste. How will YOU customize your POU? \\n\\n* Feed and take care of Pou, and watch it grow!\\n* Play Games in the Game Room and collect Coins!\\n* Experiment with Potions at the Lab!\\n* Customize Pou's appearance!\\n* Try out new Outfits, Hats and Eyeglasses!\\n* Customize each room's Wallp...</td>\n", " </tr>\n", " <tr>\n", " <th>7</th>\n", - " <td>Turbo Dismount™</td>\n", - " <td>The legendary crash simulator is now on Google Play!\\n\\nPerform death-defying motor stunts, crash into walls, create traffic pile-ups of epic scale - and share the fun!\\n\\nTurbo Dismount™ is a kinetic tragedy about Mr. Dismount and the cars who love him. It is the official sequel to the wildly popular and immensely successful personal impact simulator - Stair Dismount™. \\n\\nFEATURES:\\n* Flinch-inducing crash physics\\n* Crunchy sound effects\\n* Delicious slow-mo replay system\\n* Multiple vehi...</td>\n", + " <td>Pop Cat</td>\n", + " <td>Pop Cat (LinkDesks - Jewel Games Star.) is an addictive pop cats puzzle game!\\n\\n😍 More than 1000+ levels & new levels update regularly! Pop cats are designed not only to bring entertainment when bored but also for brain training!\\n\\nBlast cats blocks & have fun just in the world of Pop Cat!\\nDownload for free & enjoy our catoon blocks crush games - Pop Cats right now!\\n\\nCats are in a mess~~~~~\\nBlast them and win 🏆 !!!\\n\\n------------------------------------\\nFeatures of pop bubble puzzle ...</td>\n", " </tr>\n", " <tr>\n", " <th>8</th>\n", - " <td>UNO!™</td>\n", - " <td>Play the world’s number one card game like never before. UNO!™ has all-new rules, tournaments, adventures and so much more! At home or on the move, jump into games instantly. Whether an UNO!™ veteran or completely new, take on challenges and reap the rewards. UNO!™ is the ultimate competitive family-friendly card game.\\n- Play classic UNO!™ or use tons of popular house rules!\\n- Connect anytime, anywhere with friends from around the world! \\n- Two heads are better than one in 2v2 mode. Use t...</td>\n", + " <td>Plants vs. Zombies FREE</td>\n", + " <td>Get ready to soil your plants as a mob of fun-loving zombies is about to invade your home. Use your arsenal of 49 zombie-zapping plants — peashooters, wall-nuts, cherry bombs and more — to mulchify 26 types of zombies before they break down your door. \\n\\nThis app offers in-app purchases. You may disable in-app purchasing using your device settings\\n\\nWINNER OF OVER 30 GAME OF THE YEAR AWARDS*\\n\\n50 FUN-DEAD LEVELS\\nConquer all 50 levels of Adventure mode — through day, night, fog, in a swim...</td>\n", " </tr>\n", " <tr>\n", " <th>9</th>\n", - " <td>TO-FU Oh!SUSHI</td>\n", - " <td>You are the veritable sushi master! Prepare your own fun sushi with “Daizu” the skunk!\\n\\nThis app is designed to allow children to be creative by decorating their original sushi.\\n\\nServe your delicious, mysterious or impossible sushi to the people of “Tofu Island”! \\n\\nHow about creating sushi that is totally original and serve it to your beloved guests? Spice it up with tons of wasabi or even sprinkle chocolate and gummy bears for those sweet lovers.\\nFeel free to make any kind of sushi y...</td>\n", + " <td>Pooking - Billiards City</td>\n", + " <td>🎱Relaxed Game of 8 Ball🎱\\n\\nBilliards City is a modern arcade style pool game with single player, If you love a relaxed game of 8 ball, this is the game for you!\\n\\nWith Billiards City, gameplay is king! Billiards City uses the latest technology to create the most exciting and realistic billiards simulator. Experience pool like never before, thanks to the stunning HD graphics, fantastic playability and ultra realistic ball physics. Challenge a variety of stylish new level of different abilit...</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ - " name \\\n", - "0 Pancake Tower \n", - "1 Cooking School: Games for Girls \n", - "2 Hell’s Cooking — crazy chef burger, kitchen fever \n", - "3 Solitaire \n", - "4 Rummy - Free \n", - "5 Sago Mini Trucks and Diggers \n", - "6 Dr. Panda's Ice Cream Truck \n", - "7 Turbo Dismount™ \n", - "8 UNO!™ \n", - "9 TO-FU Oh!SUSHI \n", + " name \\\n", + "0 Pony Princess Academy \n", + "1 Pony Style Box \n", + "2 Pokémon Masters \n", + "3 Pokémon Quest \n", + "4 Polar Flow – Sync & Analyze \n", + "5 Pocket Tower: Building Game & Megapolis Kings \n", + "6 Pou \n", + "7 Pop Cat \n", + "8 Plants vs. Zombies FREE \n", + "9 Pooking - Billiards City \n", "\n", " description \n", - "0 Let's see how many pancakes you can pile up!! \n", - "1 Children like to help their parents. They especially like to help with cooking . When there is a cooking in the kitchen, it is no way to play. But cooking is a complicated process and often it ends up with a huge mess in the kitchen. But what if you are so eager to cook pancakes, cake or cupcakes? How to cook all that without doing a cleaning after? We have a solution! Home Cooking School with our curious Hippo has opened especially for parents and children! We do not only cook food here. We... \n", - "2 ⭐ ⭐ ⭐ ⭐ ⭐ New world of crazy cooking is here. Feel what it means to be a master chef who prepares fantastic fast food in a prominent king kitchen! If you haven't ever tried yourself as a hamburger chef cook, it's possibly the best time for making diner. Download and launch Hell's Cooking — crazy chef burger, kitchen fever HD game and get prepared to jump into a fever and adventurous perfect world of burgers.\\n\\nNew girls game Hell's Cooking gives you lots of opportunities for your crazy cafe... \n", - "3 Solitaire Free by Solitaire Card Games is the #1 klondike solitaire games on android. The solitaire Free is popular and classic card games you know and love.\\n\\nWe carefully designed a fresh solitaire free modern look, woven into the wonderful solitaire classic feel that everyone loves. \\n\\nExperience the crisp, clear, and easy to read cards, simple and quick animations, and subtle sounds, in either landscape or portrait views. \\n\\nYou can move cards with a single tap or drag them to their d... \n", - "4 Play the famous Rummy card game on your Android Smartphone or Tablet !! \\n\\nPlay rummy with 2, 3, or 4 players against simulated opponents playing with high-level artificial intelligence. \\nThere are a number of rules that can be modified, making this game very faithful to the original. \\n\\n*** MANY VARIATIONS INCLUDED *** \\n\\nMany rummy variations are included in the application: \\n\\n- From 2 to 4 players. \\n- Choose the AI level of opponents. \\n- Number of cards dealt to each player (from ... \n", - "5 Drive a dump truck with Rosie the hamster! Pile dirt high and dig deep in the ground with diggers, cranes and bulldozers. Build a home for a new friend! Choose a barn, a castle or even a cupcake-house. Don’t forget to add the finishing touches for the proud owner.\\n\\nOn this construction site, kids love being the boss. With six mighty machines and piles of dirt, you can build all day! Part of the award-winning suite of Sago Mini apps, this app puts kids in charge.\\n\\nSago Mini apps have no i... \n", - "6 Chocolate? Vanilla? Strawberry? All three!? You decide! In Dr. Panda’s Ice Cream Truck you can mix up all sorts of different flavors with cookies, chocolate, nuts and more to make the perfect ice cream—hundreds of combinations in all.\\n\\nScoop it!\\nThese animals love ice cream, and will eat as much (or little) as you want to serve them. You can make scoops big or small and pile them as high as you want—using any of the ice cream you’ve created!\\n\\nToppings galore!\\nUse chocolate syrup, cooki... \n", - "7 The legendary crash simulator is now on Google Play!\\n\\nPerform death-defying motor stunts, crash into walls, create traffic pile-ups of epic scale - and share the fun!\\n\\nTurbo Dismount™ is a kinetic tragedy about Mr. Dismount and the cars who love him. It is the official sequel to the wildly popular and immensely successful personal impact simulator - Stair Dismount™. \\n\\nFEATURES:\\n* Flinch-inducing crash physics\\n* Crunchy sound effects\\n* Delicious slow-mo replay system\\n* Multiple vehi... \n", - "8 Play the world’s number one card game like never before. UNO!™ has all-new rules, tournaments, adventures and so much more! At home or on the move, jump into games instantly. Whether an UNO!™ veteran or completely new, take on challenges and reap the rewards. UNO!™ is the ultimate competitive family-friendly card game.\\n- Play classic UNO!™ or use tons of popular house rules!\\n- Connect anytime, anywhere with friends from around the world! \\n- Two heads are better than one in 2v2 mode. Use t... \n", - "9 You are the veritable sushi master! Prepare your own fun sushi with “Daizu” the skunk!\\n\\nThis app is designed to allow children to be creative by decorating their original sushi.\\n\\nServe your delicious, mysterious or impossible sushi to the people of “Tofu Island”! \\n\\nHow about creating sushi that is totally original and serve it to your beloved guests? Spice it up with tons of wasabi or even sprinkle chocolate and gummy bears for those sweet lovers.\\nFeel free to make any kind of sushi y... " + "0 Join your favorite princess ponies in the most prestigious fashion & academy around! Get ready for a semester full of style & fun! Prance down the runway, show off your favorite new outfits, dress up in style, pose for your pony cover shoot & so much more! \\n\\nMake sure to sign up for the Pony Fashion Competition & vote for the most stylish princess pony! You can even attend a Pony Fashion Class - balance books to practice for the runway, practice your poses & more! Hurry up, Pony Princess A... \n", + "1 Pony Style Box is an incredibly fun and creative app to dress-up and style your very own pony in thousands of different ways! \\n\\nYou can choose between 5 different ponies, make crazy haircuts like in a hair salon, dress and saddle them up, take pictures and watch their amazing animations and special effects! Every pony has its own character, dance moves and surprises.\\n\\nLet your creativity blossom! Use different colors, add accessories, hairspray, nail varnish and stickers as well as hairp... \n", + "2 Start a new adventure in the Pokémon world! Explore the all-new island of Pasio!\\n\\nThere’s a tournament of 3-on-3 battles being held on Pasio called the Pokémon Masters League. Aim to become its champion as you battle with famous Trainers and make a dream team of friends on the way!\\n\\nForm a team with three Trainers and their Pokémon to target your opponents' weaknesses and deal big damage!\\n\\nEnjoy co-op play with friends all around the world! In co-op play, three players team up for fun,... \n", + "3 • The Pokémon you know and love have turned into...cubes?! Head out in search of treasure with your cube-shaped Pokémon buddies on Tumblecube Island—a land where everything is a cube! Your goal is to find the awesome goodies said to be hidden on the island ! The Pokémon you know and love from Pokémon Red and Pokémon Blue appear in this game.\\n\\n• Battle by tapping! The simple controls make for lively and fun battles! Danger is lurking, so you’ll need the help of your Pokémon buddies on your ... \n", + "4 Polar Flow is a sports, fitness, and activity analyzer to be used with Polar GPS sports watches, fitness trackers, and activity trackers.* Follow your training and activity and instantly see your achievements. You can see all of your training and activity data on your phone on the go, and sync them wirelessly to the Polar Flow.\\n\\n*Compatible devices: http://support.polar.com/en/support/polar_flow_app_and_compatible_devices\\n\\nREVIEWS OF POLAR FLOW\\n\"I found Polar Flow to be a terrific compl... \n", + "5 Trump isn't the only one who can build a tower! Construct your skyscraper and build your business empire from a Tiny Tower to the Tallest Building one tap at a time!\\n\\n\\nPocket Tower is an easy to play game that puts you in charge of building a skyscraper a floor at a time, look after business management and take it to the top of the charts while taking care of all your cute residents.\\n\\nMeet the update with new VIP's, 20 more floors of addictive fun and daily gifts to unwrap. Let the Buil... \n", + "6 Do you have what it takes to take care of your very own alien pet?! Feed it, clean it, play with it and watch it grow up while leveling up and unlocking different wallpapers and outfits to satisfy your unique taste. How will YOU customize your POU? \\n\\n* Feed and take care of Pou, and watch it grow!\\n* Play Games in the Game Room and collect Coins!\\n* Experiment with Potions at the Lab!\\n* Customize Pou's appearance!\\n* Try out new Outfits, Hats and Eyeglasses!\\n* Customize each room's Wallp... \n", + "7 Pop Cat (LinkDesks - Jewel Games Star.) is an addictive pop cats puzzle game!\\n\\n😍 More than 1000+ levels & new levels update regularly! Pop cats are designed not only to bring entertainment when bored but also for brain training!\\n\\nBlast cats blocks & have fun just in the world of Pop Cat!\\nDownload for free & enjoy our catoon blocks crush games - Pop Cats right now!\\n\\nCats are in a mess~~~~~\\nBlast them and win 🏆 !!!\\n\\n------------------------------------\\nFeatures of pop bubble puzzle ... \n", + "8 Get ready to soil your plants as a mob of fun-loving zombies is about to invade your home. Use your arsenal of 49 zombie-zapping plants — peashooters, wall-nuts, cherry bombs and more — to mulchify 26 types of zombies before they break down your door. \\n\\nThis app offers in-app purchases. You may disable in-app purchasing using your device settings\\n\\nWINNER OF OVER 30 GAME OF THE YEAR AWARDS*\\n\\n50 FUN-DEAD LEVELS\\nConquer all 50 levels of Adventure mode — through day, night, fog, in a swim... \n", + "9 🎱Relaxed Game of 8 Ball🎱\\n\\nBilliards City is a modern arcade style pool game with single player, If you love a relaxed game of 8 ball, this is the game for you!\\n\\nWith Billiards City, gameplay is king! Billiards City uses the latest technology to create the most exciting and realistic billiards simulator. Experience pool like never before, thanks to the stunning HD graphics, fantastic playability and ultra realistic ball physics. Challenge a variety of stylish new level of different abilit... " ] }, "metadata": {}, "output_type": "display_data" }, { - "data": { - "text/html": [ - "<div class=\"alert alert-success\"><strong>Checks have passed!</strong></div>" - ], - "text/plain": [ - "<IPython.core.display.HTML object>" - ] - }, - "metadata": {}, - "output_type": "display_data" + "ename": "AssertionError", + "evalue": "Top search result should be 'Pancake Tower'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[105], line 8\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, pd\u001b[38;5;241m.\u001b[39mDataFrame), \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msearch() function should return a Pandas DataFrame\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(result) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m10\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msearch() function should return 10 search results\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 8\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m result\u001b[38;5;241m.\u001b[39miloc[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPancake Tower\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mTop search result should be \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mPancake Tower\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 9\u001b[0m success()\n", + "\u001b[0;31mAssertionError\u001b[0m: Top search result should be 'Pancake Tower'" + ] } ], "source": [ @@ -1085,7 +1084,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 108, "id": "485d95fe-cfe3-4225-8c8e-2e9496c6eea2", "metadata": { "editable": true, @@ -1094,10 +1093,121 @@ }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>name</th>\n", + " <th>description</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>Incredible Jack: Jumping & Running</td>\n", + " <td>An incredible journey in the style of the best console games. Blow up everything around and prevail against 7 BIG bosses. Improve your hero by making him stronger in this awesome platformer.\\n\\n\"It is the best game I have ever played. If you are thinking of getting a game that is the one.\"\\n\\n\"It's an enjoyable jumping game with cute graphics and addictive gameplay.\"\\n\\n\"Would rate it ★★★★★★ six stars if I could! Very nice and challenging platform game.\"\\n\\n\"Very nice challenging adventure g...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Sago Mini Babies Dress Up</td>\n", + " <td>IT’S DRESS UP TIME! Get ready for hours of super cute dress up fun! Play with babies Jack, Jinja, Harvey and Robin in the most adorable dress up app for toddlers. Use your imagination to assemble outfits for each character. Try on dozens of funny costumes and accessories to create hundreds of combinations. Mix and match glasses, hats, moustaches and more to spark funny reactions! \\n\\nDress up your Sago Mini friends for a special occasion or just for fun! Snap a group photo to share once you’...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Spider Solitaire</td>\n", + " <td>Spider Solitaire is a popular classic card game. You need to move cards and drag them to their destination. Use your strategy and stack all cards of each suit in descending order from King down to Ace (King, Queen, Jack, 10, 9, 8, 7, 6, 5, 4, 3, 2, Ace) to solve the puzzle .Remove all cards from the table, Once the table is completely empty the game has been won. Try to remove the cards with fewest moves possible to make the best score . \\n\\nDo you like classic and fun games? Do you enjoy pl...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>PINKFONG Mother Goose</td>\n", + " <td>Remember all the delightful songs from your childhood? \\nNow, have fun with your children with the classic nursery rhymes at 'PINKFONG Mother Goose.' Sing along, read along, play learning games and color all the characters from your favorite songs. Old MacDonald, Humpty Dumpty, Jack and Jill and many more!\\n\\nFEATURES\\n\\n1. Sing Along Mother Goose Songs\\n- 20 All-time-favorite kids’ songs animated with PINKFONG’s original characters \\n- Arranged by educational kids’ songs experts with bouncy...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Word Cookies!®</td>\n", + " <td>🍪 Here comes lovely tasty Word Cookies! Chow down on it!\\nThe world's best word scramble puzzle game!🍪 \\n\\nDo you like to play crossword puzzles like Scrabble?\\nWord Cookies is a cross between all the aspects of word games you love to make you totally addicted and entertained! With so many brilliant challenges, you'll be obsessed with testing your spelling and vocabulary limits!\\n\\nHOW TO PLAY\\n🍰 Swipe the alphabet cookies on the baking pan to form a word.\\n🍭 Fill up Jack's cookie jar with e...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>Sago Mini World</td>\n", + " <td>Join Sago Mini World and get unlimited access to our complete collection of 30+ award-winning games, all in one kid-friendly app!\\n\\nTravel with Harvey, Jinja, Robin and Jack as you explore space, fly through a forest, build a robot, design a monster, drive a firetruck, deep-sea dive, become a superhero, visit your friends and more – all in one whimsical world.\\n\\nPerfect for preschoolers! \\n\\nFeatured in the New York Times, Guardian and USA Today\\n\\n“All of their apps are a treat for childr...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Dream League Soccer</td>\n", + " <td>Get ready for a new season of top-quality action – Dream League Soccer is here! Soccer as we know it has changed, and this is YOUR chance to build THE best team on the planet. Recruit real FIFPro™ licensed superstars, build your own stadium, and take on the World with Dream League Online as you march towards glory, on your road to Soccer Stardom!\\n\\nDownload Dream League Soccer for FREE now!\\n*****************************************\\nMANAGE YOUR DREAM TEAM\\nSign top superstar players such a...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Mobile Bus Simulator</td>\n", + " <td>Transport passengers from a city to another city terminal through amazing places and landscapes.\\nFollow traffic rules, transport passengers, telolet for children, and don't be afraid to travel farther because you will earn more money.\\nCustomize your bus with varieties of liveries, horns, telolets, bumpers, velgs, and many more!\\nMake your bus the center of attention by installing a STROBE Light!\\nRealistic places, Detailed bus vehicles, wonderful interiors will make you feel like driving a...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Tap Tap Dig - Idle Clicker Game</td>\n", + " <td>If you enjoy clicker games, Tap Tap Dig is perfect for you! Tap Tap Dig is an incremental idle clicker game that lets you take control of a miner and dig deep into the planet’s core! Just start clicking to mine. Bring along special mining helpers, collect coins, diamonds, and more! Upgrade your miner and helpers to increase your DPS and reach uncharted depths.\\n\\nDigging for gold has never been more exciting! Tap to start, then upgrade your helpers and hire benefactors to help you dig deeper...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Dude Theft Wars: Open World Sandbox Simulator BETA</td>\n", + " <td>Welcome to Dude-o-polis!\\nA beautiful city where all the awesome and perfect dudes live!\\n\\n\\nJack used to live a normal dude life when one day he found out that life can be so much more fun in Dude-o-polis. You can drive around the town in any car you want and drift your way while you freeroam around the towns, parks and fields and a 3D City full of bliss, buy any weapon you like with cash and become a Gangstar, tease, annoy or SLAP other dudes,\\nTroll People with grenades and watch them \"R...</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " name \\\n", + "0 Incredible Jack: Jumping & Running \n", + "1 Sago Mini Babies Dress Up \n", + "2 Spider Solitaire \n", + "3 PINKFONG Mother Goose \n", + "4 Word Cookies!® \n", + "5 Sago Mini World \n", + "6 Dream League Soccer \n", + "7 Mobile Bus Simulator \n", + "8 Tap Tap Dig - Idle Clicker Game \n", + "9 Dude Theft Wars: Open World Sandbox Simulator BETA \n", + "\n", + " description \n", + "0 An incredible journey in the style of the best console games. Blow up everything around and prevail against 7 BIG bosses. Improve your hero by making him stronger in this awesome platformer.\\n\\n\"It is the best game I have ever played. If you are thinking of getting a game that is the one.\"\\n\\n\"It's an enjoyable jumping game with cute graphics and addictive gameplay.\"\\n\\n\"Would rate it ★★★★★★ six stars if I could! Very nice and challenging platform game.\"\\n\\n\"Very nice challenging adventure g... \n", + "1 IT’S DRESS UP TIME! Get ready for hours of super cute dress up fun! Play with babies Jack, Jinja, Harvey and Robin in the most adorable dress up app for toddlers. Use your imagination to assemble outfits for each character. Try on dozens of funny costumes and accessories to create hundreds of combinations. Mix and match glasses, hats, moustaches and more to spark funny reactions! \\n\\nDress up your Sago Mini friends for a special occasion or just for fun! Snap a group photo to share once you’... \n", + "2 Spider Solitaire is a popular classic card game. You need to move cards and drag them to their destination. Use your strategy and stack all cards of each suit in descending order from King down to Ace (King, Queen, Jack, 10, 9, 8, 7, 6, 5, 4, 3, 2, Ace) to solve the puzzle .Remove all cards from the table, Once the table is completely empty the game has been won. Try to remove the cards with fewest moves possible to make the best score . \\n\\nDo you like classic and fun games? Do you enjoy pl... \n", + "3 Remember all the delightful songs from your childhood? \\nNow, have fun with your children with the classic nursery rhymes at 'PINKFONG Mother Goose.' Sing along, read along, play learning games and color all the characters from your favorite songs. Old MacDonald, Humpty Dumpty, Jack and Jill and many more!\\n\\nFEATURES\\n\\n1. Sing Along Mother Goose Songs\\n- 20 All-time-favorite kids’ songs animated with PINKFONG’s original characters \\n- Arranged by educational kids’ songs experts with bouncy... \n", + "4 🍪 Here comes lovely tasty Word Cookies! Chow down on it!\\nThe world's best word scramble puzzle game!🍪 \\n\\nDo you like to play crossword puzzles like Scrabble?\\nWord Cookies is a cross between all the aspects of word games you love to make you totally addicted and entertained! With so many brilliant challenges, you'll be obsessed with testing your spelling and vocabulary limits!\\n\\nHOW TO PLAY\\n🍰 Swipe the alphabet cookies on the baking pan to form a word.\\n🍭 Fill up Jack's cookie jar with e... \n", + "5 Join Sago Mini World and get unlimited access to our complete collection of 30+ award-winning games, all in one kid-friendly app!\\n\\nTravel with Harvey, Jinja, Robin and Jack as you explore space, fly through a forest, build a robot, design a monster, drive a firetruck, deep-sea dive, become a superhero, visit your friends and more – all in one whimsical world.\\n\\nPerfect for preschoolers! \\n\\nFeatured in the New York Times, Guardian and USA Today\\n\\n“All of their apps are a treat for childr... \n", + "6 Get ready for a new season of top-quality action – Dream League Soccer is here! Soccer as we know it has changed, and this is YOUR chance to build THE best team on the planet. Recruit real FIFPro™ licensed superstars, build your own stadium, and take on the World with Dream League Online as you march towards glory, on your road to Soccer Stardom!\\n\\nDownload Dream League Soccer for FREE now!\\n*****************************************\\nMANAGE YOUR DREAM TEAM\\nSign top superstar players such a... \n", + "7 Transport passengers from a city to another city terminal through amazing places and landscapes.\\nFollow traffic rules, transport passengers, telolet for children, and don't be afraid to travel farther because you will earn more money.\\nCustomize your bus with varieties of liveries, horns, telolets, bumpers, velgs, and many more!\\nMake your bus the center of attention by installing a STROBE Light!\\nRealistic places, Detailed bus vehicles, wonderful interiors will make you feel like driving a... \n", + "8 If you enjoy clicker games, Tap Tap Dig is perfect for you! Tap Tap Dig is an incremental idle clicker game that lets you take control of a miner and dig deep into the planet’s core! Just start clicking to mine. Bring along special mining helpers, collect coins, diamonds, and more! Upgrade your miner and helpers to increase your DPS and reach uncharted depths.\\n\\nDigging for gold has never been more exciting! Tap to start, then upgrade your helpers and hire benefactors to help you dig deeper... \n", + "9 Welcome to Dude-o-polis!\\nA beautiful city where all the awesome and perfect dudes live!\\n\\n\\nJack used to live a normal dude life when one day he found out that life can be so much more fun in Dude-o-polis. You can drive around the town in any car you want and drift your way while you freeroam around the towns, parks and fields and a 3D City full of bliss, buy any weapon you like with cash and become a Gangstar, tease, annoy or SLAP other dudes,\\nTroll People with grenades and watch them \"R... " + ] + }, + "execution_count": 108, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Example — try out your own queries!\n", - "search(\"dodge trains\")" + "search(\"jack\")" ] }, { @@ -1123,7 +1233,25 @@ "execution_count": null, "id": "23dadb46-66b7-4d53-a9db-48849c6cb9d8", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Apple\n", + "is\n", + "looking\n", + "at\n", + "buying\n", + "U.K.\n", + "startup\n", + "for\n", + "$\n", + "1\n", + "billion\n" + ] + } + ], "source": [ "import spacy\n", "# Load the small English model, disabling some components that we don't need right now\n", @@ -1132,6 +1260,7 @@ "# Take an example sentence and print every token from it separately\n", "doc = nlp(\"Apple is looking at buying U.K. startup for $1 billion\")\n", "for token in doc:\n", + " #oken.lemma\n", " print(token.text)" ] }, @@ -1154,6 +1283,14 @@ { "cell_type": "code", "execution_count": null, + "id": "0b7230e3", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 135, "id": "1a2a6fc6-dee8-4140-bf7a-1a245e60a1b3", "metadata": { "deletable": false, @@ -1182,7 +1319,13 @@ " The list of remaining lemmas after preprocessing (represented as strings).\n", " \"\"\"\n", " # YOUR CODE HERE\n", - " raise NotImplementedError()" + " correct_tokens = []\n", + " tokens = nlp(text)\n", + " for token in tokens:\n", + " if not token.is_stop and token.is_alpha:\n", + " correct_tokens.append(token.lemma_)\n", + " print(f'correct_tokens: {correct_tokens}')\n", + " return correct_tokens" ] }, { @@ -1197,7 +1340,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 137, "id": "e918affb-f8aa-4cbf-9cbe-b03b9251e941", "metadata": { "deletable": false, @@ -1214,7 +1357,28 @@ "task": false } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "correct_tokens: ['Apple', 'look', 'buy', 'startup', 'billion']\n", + "correct_tokens: ['Love', 'Story', 'country', 'pop', 'song', 'write', 'sing', 'Taylor', 'Swift']\n" + ] + }, + { + "data": { + "text/html": [ + "<div class=\"alert alert-success\"><strong>Checks have passed!</strong></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "\"\"\"Check that the preprocessing returns the correct output for a number of test cases.\"\"\"\n", "\n", @@ -1273,22 +1437,37 @@ }, "outputs": [], "source": [ + "from multiprocessing import Pool\n", "class AppSearcher:\n", " def fit(self, df):\n", " \"\"\"Instantiate and fit all the classes required for the search engine (cf. Problems 1 and 2).\"\"\"\n", " self.df = df\n", - " # YOUR CODE HERE\n", - " raise NotImplementedError()\n", + " self.nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner', 'textcat'])\n", + "\n", + " self.vectorizer = TfidfVectorizer(tokenizer=self.preprocess)\n", + " X = self.vectorizer.fit_transform(df['description'])\n", + " \n", + " self.nearest_neighbors = NearestNeighbors(n_neighbors=10, metric='cosine')\n", + " self.nearest_neighbors.fit(X)\n", "\n", " def preprocess(self, text):\n", " \"\"\"Preprocess the given text (cf. Problem 3).\"\"\"\n", - " # YOUR CODE HERE\n", - " raise NotImplementedError()\n", - "\n", + " tokens = self.nlp(text)\n", + " \n", + " return [token.lemma_ for token in tokens if not token.is_stop and token.is_alpha]\n", + " \n", " def search(self, query):\n", " \"\"\"Find the nearest neighbors in `df` for a query string (cf. Problem 2).\"\"\"\n", - " # YOUR CODE HERE\n", - " raise NotImplementedError()\n" + " query_tokens = self.vectorizer.transform([query])\n", + "\n", + " neighbors = self.nearest_neighbors.kneighbors(query_tokens, 10, return_distance=False)[0]\n", + "\n", + " data = {\n", + " \"name\": [df.loc[i, 'name'] for i in neighbors],\n", + " \"description\": [df.loc[i, 'description'] for i in neighbors]\n", + " }\n", + "\n", + " return pd.DataFrame(data)\n" ] }, { @@ -1303,16 +1482,143 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 179, "id": "d32d42be-4e31-44c7-b1e4-afe3dc77a506", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/jackkolm/Documents/TextMining/text-mining/.venv/lib/python3.11/site-packages/sklearn/feature_extraction/text.py:521: UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None'\n", + " warnings.warn(\n" + ] + }, + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>name</th>\n", + " <th>description</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>Pony Princess Academy</td>\n", + " <td>Join your favorite princess ponies in the most prestigious fashion & academy around! Get ready for a semester full of style & fun! Prance down the runway, show off your favorite new outfits, dress up in style, pose for your pony cover shoot & so much more! \\n\\nMake sure to sign up for the Pony Fashion Competition & vote for the most stylish princess pony! You can even attend a Pony Fashion Class - balance books to practice for the runway, practice your poses & more! Hurry up, Pony Princess A...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Pony Style Box</td>\n", + " <td>Pony Style Box is an incredibly fun and creative app to dress-up and style your very own pony in thousands of different ways! \\n\\nYou can choose between 5 different ponies, make crazy haircuts like in a hair salon, dress and saddle them up, take pictures and watch their amazing animations and special effects! Every pony has its own character, dance moves and surprises.\\n\\nLet your creativity blossom! Use different colors, add accessories, hairspray, nail varnish and stickers as well as hairp...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Pokémon Masters</td>\n", + " <td>Start a new adventure in the Pokémon world! Explore the all-new island of Pasio!\\n\\nThere’s a tournament of 3-on-3 battles being held on Pasio called the Pokémon Masters League. Aim to become its champion as you battle with famous Trainers and make a dream team of friends on the way!\\n\\nForm a team with three Trainers and their Pokémon to target your opponents' weaknesses and deal big damage!\\n\\nEnjoy co-op play with friends all around the world! In co-op play, three players team up for fun,...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Pokémon Quest</td>\n", + " <td>• The Pokémon you know and love have turned into...cubes?! Head out in search of treasure with your cube-shaped Pokémon buddies on Tumblecube Island—a land where everything is a cube! Your goal is to find the awesome goodies said to be hidden on the island ! The Pokémon you know and love from Pokémon Red and Pokémon Blue appear in this game.\\n\\n• Battle by tapping! The simple controls make for lively and fun battles! Danger is lurking, so you’ll need the help of your Pokémon buddies on your ...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Polar Flow – Sync & Analyze</td>\n", + " <td>Polar Flow is a sports, fitness, and activity analyzer to be used with Polar GPS sports watches, fitness trackers, and activity trackers.* Follow your training and activity and instantly see your achievements. You can see all of your training and activity data on your phone on the go, and sync them wirelessly to the Polar Flow.\\n\\n*Compatible devices: http://support.polar.com/en/support/polar_flow_app_and_compatible_devices\\n\\nREVIEWS OF POLAR FLOW\\n\"I found Polar Flow to be a terrific compl...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>Pocket Tower: Building Game & Megapolis Kings</td>\n", + " <td>Trump isn't the only one who can build a tower! Construct your skyscraper and build your business empire from a Tiny Tower to the Tallest Building one tap at a time!\\n\\n\\nPocket Tower is an easy to play game that puts you in charge of building a skyscraper a floor at a time, look after business management and take it to the top of the charts while taking care of all your cute residents.\\n\\nMeet the update with new VIP's, 20 more floors of addictive fun and daily gifts to unwrap. Let the Buil...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Pou</td>\n", + " <td>Do you have what it takes to take care of your very own alien pet?! Feed it, clean it, play with it and watch it grow up while leveling up and unlocking different wallpapers and outfits to satisfy your unique taste. How will YOU customize your POU? \\n\\n* Feed and take care of Pou, and watch it grow!\\n* Play Games in the Game Room and collect Coins!\\n* Experiment with Potions at the Lab!\\n* Customize Pou's appearance!\\n* Try out new Outfits, Hats and Eyeglasses!\\n* Customize each room's Wallp...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Pop Cat</td>\n", + " <td>Pop Cat (LinkDesks - Jewel Games Star.) is an addictive pop cats puzzle game!\\n\\n😍 More than 1000+ levels & new levels update regularly! Pop cats are designed not only to bring entertainment when bored but also for brain training!\\n\\nBlast cats blocks & have fun just in the world of Pop Cat!\\nDownload for free & enjoy our catoon blocks crush games - Pop Cats right now!\\n\\nCats are in a mess~~~~~\\nBlast them and win 🏆 !!!\\n\\n------------------------------------\\nFeatures of pop bubble puzzle ...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Plants vs. Zombies FREE</td>\n", + " <td>Get ready to soil your plants as a mob of fun-loving zombies is about to invade your home. Use your arsenal of 49 zombie-zapping plants — peashooters, wall-nuts, cherry bombs and more — to mulchify 26 types of zombies before they break down your door. \\n\\nThis app offers in-app purchases. You may disable in-app purchasing using your device settings\\n\\nWINNER OF OVER 30 GAME OF THE YEAR AWARDS*\\n\\n50 FUN-DEAD LEVELS\\nConquer all 50 levels of Adventure mode — through day, night, fog, in a swim...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Pooking - Billiards City</td>\n", + " <td>🎱Relaxed Game of 8 Ball🎱\\n\\nBilliards City is a modern arcade style pool game with single player, If you love a relaxed game of 8 ball, this is the game for you!\\n\\nWith Billiards City, gameplay is king! Billiards City uses the latest technology to create the most exciting and realistic billiards simulator. Experience pool like never before, thanks to the stunning HD graphics, fantastic playability and ultra realistic ball physics. Challenge a variety of stylish new level of different abilit...</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " name \\\n", + "0 Pony Princess Academy \n", + "1 Pony Style Box \n", + "2 Pokémon Masters \n", + "3 Pokémon Quest \n", + "4 Polar Flow – Sync & Analyze \n", + "5 Pocket Tower: Building Game & Megapolis Kings \n", + "6 Pou \n", + "7 Pop Cat \n", + "8 Plants vs. Zombies FREE \n", + "9 Pooking - Billiards City \n", + "\n", + " description \n", + "0 Join your favorite princess ponies in the most prestigious fashion & academy around! Get ready for a semester full of style & fun! Prance down the runway, show off your favorite new outfits, dress up in style, pose for your pony cover shoot & so much more! \\n\\nMake sure to sign up for the Pony Fashion Competition & vote for the most stylish princess pony! You can even attend a Pony Fashion Class - balance books to practice for the runway, practice your poses & more! Hurry up, Pony Princess A... \n", + "1 Pony Style Box is an incredibly fun and creative app to dress-up and style your very own pony in thousands of different ways! \\n\\nYou can choose between 5 different ponies, make crazy haircuts like in a hair salon, dress and saddle them up, take pictures and watch their amazing animations and special effects! Every pony has its own character, dance moves and surprises.\\n\\nLet your creativity blossom! Use different colors, add accessories, hairspray, nail varnish and stickers as well as hairp... \n", + "2 Start a new adventure in the Pokémon world! Explore the all-new island of Pasio!\\n\\nThere’s a tournament of 3-on-3 battles being held on Pasio called the Pokémon Masters League. Aim to become its champion as you battle with famous Trainers and make a dream team of friends on the way!\\n\\nForm a team with three Trainers and their Pokémon to target your opponents' weaknesses and deal big damage!\\n\\nEnjoy co-op play with friends all around the world! In co-op play, three players team up for fun,... \n", + "3 • The Pokémon you know and love have turned into...cubes?! Head out in search of treasure with your cube-shaped Pokémon buddies on Tumblecube Island—a land where everything is a cube! Your goal is to find the awesome goodies said to be hidden on the island ! The Pokémon you know and love from Pokémon Red and Pokémon Blue appear in this game.\\n\\n• Battle by tapping! The simple controls make for lively and fun battles! Danger is lurking, so you’ll need the help of your Pokémon buddies on your ... \n", + "4 Polar Flow is a sports, fitness, and activity analyzer to be used with Polar GPS sports watches, fitness trackers, and activity trackers.* Follow your training and activity and instantly see your achievements. You can see all of your training and activity data on your phone on the go, and sync them wirelessly to the Polar Flow.\\n\\n*Compatible devices: http://support.polar.com/en/support/polar_flow_app_and_compatible_devices\\n\\nREVIEWS OF POLAR FLOW\\n\"I found Polar Flow to be a terrific compl... \n", + "5 Trump isn't the only one who can build a tower! Construct your skyscraper and build your business empire from a Tiny Tower to the Tallest Building one tap at a time!\\n\\n\\nPocket Tower is an easy to play game that puts you in charge of building a skyscraper a floor at a time, look after business management and take it to the top of the charts while taking care of all your cute residents.\\n\\nMeet the update with new VIP's, 20 more floors of addictive fun and daily gifts to unwrap. Let the Buil... \n", + "6 Do you have what it takes to take care of your very own alien pet?! Feed it, clean it, play with it and watch it grow up while leveling up and unlocking different wallpapers and outfits to satisfy your unique taste. How will YOU customize your POU? \\n\\n* Feed and take care of Pou, and watch it grow!\\n* Play Games in the Game Room and collect Coins!\\n* Experiment with Potions at the Lab!\\n* Customize Pou's appearance!\\n* Try out new Outfits, Hats and Eyeglasses!\\n* Customize each room's Wallp... \n", + "7 Pop Cat (LinkDesks - Jewel Games Star.) is an addictive pop cats puzzle game!\\n\\n😍 More than 1000+ levels & new levels update regularly! Pop cats are designed not only to bring entertainment when bored but also for brain training!\\n\\nBlast cats blocks & have fun just in the world of Pop Cat!\\nDownload for free & enjoy our catoon blocks crush games - Pop Cats right now!\\n\\nCats are in a mess~~~~~\\nBlast them and win 🏆 !!!\\n\\n------------------------------------\\nFeatures of pop bubble puzzle ... \n", + "8 Get ready to soil your plants as a mob of fun-loving zombies is about to invade your home. Use your arsenal of 49 zombie-zapping plants — peashooters, wall-nuts, cherry bombs and more — to mulchify 26 types of zombies before they break down your door. \\n\\nThis app offers in-app purchases. You may disable in-app purchasing using your device settings\\n\\nWINNER OF OVER 30 GAME OF THE YEAR AWARDS*\\n\\n50 FUN-DEAD LEVELS\\nConquer all 50 levels of Adventure mode — through day, night, fog, in a swim... \n", + "9 🎱Relaxed Game of 8 Ball🎱\\n\\nBilliards City is a modern arcade style pool game with single player, If you love a relaxed game of 8 ball, this is the game for you!\\n\\nWith Billiards City, gameplay is king! Billiards City uses the latest technology to create the most exciting and realistic billiards simulator. Experience pool like never before, thanks to the stunning HD graphics, fantastic playability and ultra realistic ball physics. Challenge a variety of stylish new level of different abilit... " + ] + }, + "execution_count": 179, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "apps = AppSearcher()\n", "apps.fit(df)\n", - "apps.search(\"pile up pancakes\")" + "apps.search(\"filip\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "ecf6a78f", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "5adce322-80ee-44b9-bd7f-5c910a90330e", @@ -1331,11 +1637,207 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 281, "id": "5a59c86d-2c98-4d1b-a267-89aa13871cf3", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/jackkolm/Documents/TextMining/text-mining/.venv/lib/python3.11/site-packages/sklearn/feature_extraction/text.py:521: UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None'\n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "class AppSearcher2:\n", + " def fit(self, df):\n", + " \"\"\"Instantiate and fit all the classes required for the search engine (cf. Problems 1 and 2).\"\"\"\n", + " self.df = df\n", + " self.nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner', 'textcat'])\n", + "\n", + " self.vectorizer = TfidfVectorizer(tokenizer=self.preprocess)\n", + " X = self.vectorizer.fit_transform(df['description'])\n", + " \n", + " self.nearest_neighbors = NearestNeighbors(n_neighbors=10, metric='cosine')\n", + " self.nearest_neighbors.fit(X)\n", + "\n", + " def preprocess(self, text):\n", + " \"\"\"Preprocess the given text (cf. Problem 3).\"\"\"\n", + " tokens = self.nlp(text)\n", + " \n", + " return [token.lemma_ for token in tokens if token.is_alpha]\n", + "\n", + " def search(self, query):\n", + " \"\"\"Find the nearest neighbors in `df` for a query string (cf. Problem 2).\"\"\"\n", + " query_tokens = self.vectorizer.transform([query])\n", + "\n", + " neighbors = self.nearest_neighbors.kneighbors(query_tokens, 10, return_distance=False)[0]\n", + "\n", + " data = {\n", + " \"name\": [df.loc[i, 'name'] for i in neighbors],\n", + " \"description\": [df.loc[i, 'description'] for i in neighbors]\n", + " }\n", + "\n", + " return pd.DataFrame(data)\n", + "apps2 = AppSearcher2()\n", + "apps2.fit(df)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 283, + "id": "d58807c2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Not matched! At index: 1\n", + "Not matched! At index: 3\n", + "Not matched! At index: 4\n", + "Not matched! At index: 5\n", + "Not matched! At index: 6\n", + "Not matched! At index: 7\n", + "Not matched! At index: 8\n", + "Not matched! At index: 9\n" + ] + }, + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>name</th>\n", + " <th>description</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>War and Peace: Build an Army with Civil War Troops</td>\n", + " <td>Welcome to the year 1861, soldier! The Civil War is at its peak and we need a commander for our troops… Will you join us and become the hero who leads our army in this conquest?\\n\\nBuild an army and send your soldiers to the battlefield. Your strategy will determine which side wins and sets the course of American history. Use base building to create your camp and customize your army with soldiers of all kinds: infantry, cavalry or heavy artillery. \\n\\nThis Civil War battle was one of the mos...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>King of Avalon: Dragon War | Multiplayer Strategy</td>\n", + " <td>King Arthur fell in battle, a victim of the betrayal of his nephew Mordred. Now, his body lies in a fortress on the sacred Isle of Avalon next to his powerful sword, Excalibur. It is only when Excalibur is raised again that a new king again will be crowned and the kingdom will be unified. The whole empire has been split into cities fighting each other. Many desire the power and magic of Excalibur but there is only room for one in the king's throne...\\n\\nKing of Avalon is set in a fantasy med...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Vikings: War of Clans</td>\n", + " <td>The era of epic conquests and grand deeds has come. Only you have the right to decide the fate of the empire. Make your kingdom inviolable, become the leader of a powerful army, and write your name into the history of the North!\\n\\nPlunge into the harsh world of the Vikings: War of Clans MMO strategy game. Plan victorious attacks, lay traps, and form onslaughts. May the war of mighty jarls reveal who is strongest.\\n\\nThis epic strategy game uniting millions of people across the globe will re...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Word Search Games in english</td>\n", + " <td>Do you like word search? This letter puzzle game will surprise you. Edujoy’s word search game is easy to play, ideal for hours of fun entertainment while training your brain. It is suitable for both adults and children, resulting in an educational and enriching experience as you play. It has different levels of difficulty, making it perfect for anyone who is on the lookout for words on a board.\\n\\nEasy: Perfect for little kids. The board is 6x6 so it's easy to find the words and solve the pu...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Property Brothers Home Design</td>\n", + " <td>Drew and Jonathan Scott, famously known as the Property Brothers, need you to help clients achieve their home design dreams! With the brothers at your side, you’ll demo, renovate, customize, and design spaces with the same charm and style the twins have become known for. Play along to go behind the scenes with the brothers, learn their design tips and tricks, and discover fun facts about TV’s favorite design duo. Relaxing, fun puzzles let you earn coins to spend on décor. Exclusive voice-ove...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>This War of Mine</td>\n", + " <td>The Little Ones expansion is available now as an in-app purchase!\\n\\n\"If you've not already played this brilliant, heart-wrenching game, then mobile is as good a place as any to let it completely destroy you.\" - , 9/10, Pocket Gamer UK\\n\\n\"This War of Mine isn’t exactly “fun,” but it’s definitely a game worth playing.\" , 9/10, 148apps\\n\\nIn This War Of Mine you do not play as an elite soldier, rather a group of civilians trying to survive in a besieged city; struggling with lack of food, med...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Art of War 3: PvP RTS modern warfare strategy game</td>\n", + " <td>А unique classic real-time strategy game with direct control - for true commanders who are not afraid to face the enemy in real-time PvP battles! For those who want to feel the thrill of victory over a real opponent! For those who can think like a strategist and act decisively in any battlefield situation! For those who just want to fight and blow stuff up! It’s no place for the timid!\\nAre you ready for the challenge, Commander?\\nArt of War 3: Global Conflict (AOW) - is a real-time strategy...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Rise of Empires: Ice and Fire</td>\n", + " <td>One World, One Server\\n\\nReal Time Nation vs. Nation medieval strategy war game. Join now! Train your troops and go to war!\\n\\nRise of Empires is a Massive Multi-Player, Real-Time strategy war game. The player will take on the role of a leader in a small town devastated by the invasion of the Eastern Dynasty and the mysterious appearance of the legendary Death Harbingers who now has corrupted and have full control of the ancient powers of the dragons. Build your empire once again from the ru...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Battle of Warships: Naval Blitz</td>\n", + " <td>Battle of Warships is one of the legendary battle app, ship simulator mobile game about battle 1942 and naval warfare, sea battles online and offline. Navigate your unique ships that used in the WW1 and WW2. Improve on your own ship, increase health points, engine speed and turns. Customize navy army with the flag of your country. Get daily rewards, level up your skills and ship's characteristics. Become the God of War and war thunder with warship craft, battle with enemy for war and order. ...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Dating for 50 plus Mature Singles – FINALLY</td>\n", + " <td>The New Love of Your Lifetime. Finally.\\nIf you documented every up and down you’ve had over the course of your lifetime, you’d probably be an acclaimed author with several best-selling books. Actually, it still isn’t too late. Perhaps the one thing missing from your memoir is the story of how you finally found the true love of your life. But in an instant, that could all change. That’s the power of FINALLY: the #1 mature dating app amongst mature adults and 50+ singles all over the world. S...</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " name \\\n", + "0 War and Peace: Build an Army with Civil War Troops \n", + "1 King of Avalon: Dragon War | Multiplayer Strategy \n", + "2 Vikings: War of Clans \n", + "3 Word Search Games in english \n", + "4 Property Brothers Home Design \n", + "5 This War of Mine \n", + "6 Art of War 3: PvP RTS modern warfare strategy game \n", + "7 Rise of Empires: Ice and Fire \n", + "8 Battle of Warships: Naval Blitz \n", + "9 Dating for 50 plus Mature Singles – FINALLY \n", + "\n", + " description \n", + "0 Welcome to the year 1861, soldier! The Civil War is at its peak and we need a commander for our troops… Will you join us and become the hero who leads our army in this conquest?\\n\\nBuild an army and send your soldiers to the battlefield. Your strategy will determine which side wins and sets the course of American history. Use base building to create your camp and customize your army with soldiers of all kinds: infantry, cavalry or heavy artillery. \\n\\nThis Civil War battle was one of the mos... \n", + "1 King Arthur fell in battle, a victim of the betrayal of his nephew Mordred. Now, his body lies in a fortress on the sacred Isle of Avalon next to his powerful sword, Excalibur. It is only when Excalibur is raised again that a new king again will be crowned and the kingdom will be unified. The whole empire has been split into cities fighting each other. Many desire the power and magic of Excalibur but there is only room for one in the king's throne...\\n\\nKing of Avalon is set in a fantasy med... \n", + "2 The era of epic conquests and grand deeds has come. Only you have the right to decide the fate of the empire. Make your kingdom inviolable, become the leader of a powerful army, and write your name into the history of the North!\\n\\nPlunge into the harsh world of the Vikings: War of Clans MMO strategy game. Plan victorious attacks, lay traps, and form onslaughts. May the war of mighty jarls reveal who is strongest.\\n\\nThis epic strategy game uniting millions of people across the globe will re... \n", + "3 Do you like word search? This letter puzzle game will surprise you. Edujoy’s word search game is easy to play, ideal for hours of fun entertainment while training your brain. It is suitable for both adults and children, resulting in an educational and enriching experience as you play. It has different levels of difficulty, making it perfect for anyone who is on the lookout for words on a board.\\n\\nEasy: Perfect for little kids. The board is 6x6 so it's easy to find the words and solve the pu... \n", + "4 Drew and Jonathan Scott, famously known as the Property Brothers, need you to help clients achieve their home design dreams! With the brothers at your side, you’ll demo, renovate, customize, and design spaces with the same charm and style the twins have become known for. Play along to go behind the scenes with the brothers, learn their design tips and tricks, and discover fun facts about TV’s favorite design duo. Relaxing, fun puzzles let you earn coins to spend on décor. Exclusive voice-ove... \n", + "5 The Little Ones expansion is available now as an in-app purchase!\\n\\n\"If you've not already played this brilliant, heart-wrenching game, then mobile is as good a place as any to let it completely destroy you.\" - , 9/10, Pocket Gamer UK\\n\\n\"This War of Mine isn’t exactly “fun,” but it’s definitely a game worth playing.\" , 9/10, 148apps\\n\\nIn This War Of Mine you do not play as an elite soldier, rather a group of civilians trying to survive in a besieged city; struggling with lack of food, med... \n", + "6 А unique classic real-time strategy game with direct control - for true commanders who are not afraid to face the enemy in real-time PvP battles! For those who want to feel the thrill of victory over a real opponent! For those who can think like a strategist and act decisively in any battlefield situation! For those who just want to fight and blow stuff up! It’s no place for the timid!\\nAre you ready for the challenge, Commander?\\nArt of War 3: Global Conflict (AOW) - is a real-time strategy... \n", + "7 One World, One Server\\n\\nReal Time Nation vs. Nation medieval strategy war game. Join now! Train your troops and go to war!\\n\\nRise of Empires is a Massive Multi-Player, Real-Time strategy war game. The player will take on the role of a leader in a small town devastated by the invasion of the Eastern Dynasty and the mysterious appearance of the legendary Death Harbingers who now has corrupted and have full control of the ancient powers of the dragons. Build your empire once again from the ru... \n", + "8 Battle of Warships is one of the legendary battle app, ship simulator mobile game about battle 1942 and naval warfare, sea battles online and offline. Navigate your unique ships that used in the WW1 and WW2. Improve on your own ship, increase health points, engine speed and turns. Customize navy army with the flag of your country. Get daily rewards, level up your skills and ship's characteristics. Become the God of War and war thunder with warship craft, battle with enemy for war and order. ... \n", + "9 The New Love of Your Lifetime. Finally.\\nIf you documented every up and down you’ve had over the course of your lifetime, you’d probably be an acclaimed author with several best-selling books. Actually, it still isn’t too late. Perhaps the one thing missing from your memoir is the story of how you finally found the true love of your life. But in an instant, that could all change. That’s the power of FINALLY: the #1 mature dating app amongst mature adults and 50+ singles all over the world. S... " + ] + }, + "execution_count": 283, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "search_string = \"it when that thus if it is that when all of the with the thus we are that when if that is became back backward before briefly but beyond clearly causes doesn't during downards due to each following follows forever furthermore my brother is a war veteran in all of the wars and to\"\n", + "frame1 = apps.search(search_string)\n", + "frame2 = apps2.search(search_string)\n", + "for i in range(0, 10):\n", + " if frame1.iloc[i][\"name\"] != frame2.iloc[i][\"name\"]:\n", + " print(f'Not matched! At index: {i}')\n", + "frame2" + ] + }, + { + "cell_type": "markdown", + "id": "3405a013", + "metadata": {}, + "source": [ + "### (Jack and Filip) Modified preprocessing notes\n", + "First testing with and without lemmatization: lemmatization makes the searches more reliable, for instance \"recipe\" and \"recipes\" will turn up the same results (otherwise it won't). Results seemed better overall when we tested with longer strings of words, but it varied a bit from case to case. \"Pile of pancakes\" is another example, where \"Piles of pancake\" won't find the most fitting result (i.e. the app Pancake Tower) without lemmatization.\n", + "\n", + "Second testing with and without stop words: It will reliably make the same first results, but the rest will be more and more varied depending on the length of the sentence (with stop words in the sentence, that is). When the sentence gets even more complex (more stop words) the first guesses becomes a bit more butchered as well, but still pretty pretty good.\n", + "\n", + "\n" + ] }, { "cell_type": "markdown", -- GitLab