Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer in python please solve in python Every project on Thumbtack belongs to a category. Each set of two categories has a relevance score

please answer in python image text in transcribed
image text in transcribed
image text in transcribed
please solve in python image text in transcribed
image text in transcribed
image text in transcribed
Every project on Thumbtack belongs to a category. Each set of two categories has a relevance score from 0 to 1, which represents how relevant they are to each other. A category has a relevance score of 1.0 to itself 2 3 3 3 QWERTYUIOP ASDFGHJKL + ZXCVBNM icolay the most Every time a project that belongs to a user is completed, the Thumbtack search bar updates to lay the k most relevant category suggestions for that user. These top categories are chosen by first sorting all the categories that are relevant to at least one of the already created projects by relevance. Then, in the case that their relevance is equal, they should be sorted by category name. If the same category is relevant to 2 or more projects, it should be included only once with the maximum relevance score. If there are fewer thank total relevant projects, the suggestions list will be shorter than k. You have a relevance graph of all the Thumbtack categories, represented as an array of strings of comma-separated words. For each string in categories, the first two elements are the categories being compared and the third is their relevance score. You are also given an array of the categories of the projects that a particular user wants to create For example: "House Painting, Interior Painting, 0.8" means that House Painting and Interior Painting have a relevance score of 0.8 (.e. highly relevant) and "Handyman, Massage Therapy,0.1" means that Handyman and Massage Therapy have a relevance score of 0.1 (.. barely relevant). Note that if there is no entry for particular pair of categories, it means that their relevance is o. o i.e. they aren't relevant at all and they shouldn't be included in the list of suggestions). Given the relevance graph categories, the list of the user's projects, and the number of category suggestions the user should see in the Thumbtack search bar k, return an array of arrays that represents the state of the search bar suggestions list after each of the projects in projects is created. Example of 0.8 6.0. highly relevant) Example For categories = [ "House Painting, Interior Painting, o. "Handyman, Massage Therapy, 0.1", "Handyman, House Painting,0.5", "House Painting, House Cleaning, 0.6", "Furniture Assembly, Handyman, 0.8", "Furniture Assembly, Massage Therapy, 0.1" "Plumbing Drain Repair, Junk Removal,0.3" projects = ["House Painting", "Handyman"), and k = 3, the output should be terior Painting", "House categorySuggestions(categories, projects, k) = [["House Painting", "In Cleaning"], ("Handyman", "House Painting", "Interior Painting"]] order of their relevance): After the first project House Painting is completed, the most relevant suggestions are Category Relevance House Painting Interior Painting House Cleaning 0.5 Handyman After the second project is completed, the most relevant suggestions are: Category Relevance Handyman House Painting 10 0.9 Interior Painting Furniture Assembly House Cleaning 0.1 Massage Therapy Input/Output vance inputarray.string categories Category relevancies given in the format "category1 name>, , , , with will be distinct). Category names can only consists of spaces and English letters. Guaranteed constraints: o s categories.lengths 1000, 5 s categories[1]. length s 50 (input) array.string projects The categories to which the user's projects belong. Guaranteed constraints: Os projects.length = 1000, is projects[i]. length 30. Jinput] integer k The number of category suggestions that should be shown in the user's search bar. Guaranteed constraints: esk 50. (output) array array.string Return the state of the search bar suggestions list after each of the projects in projects is created. Every project on Thumbtack belongs to a category. Each set of two categories has a relevance score from 0 to 1, which represents how relevant they are to each other. A category has a relevance score of 1.0 to itself QWERTYUIOD AS ORGHUKO 2XCVBNM Every time a project that belongs to a user is completed, the Thumbtack search bar updates to display the k most relevant category suggestions for that user. These top categories are chosen by first sorting all the categories that are relevant to at least one of the already created projects by relevance. Then, in the case that their relevance is equal, they should be sorted by Category name of the same category is relevant to 2 or more projects, it should be included only once with the maximum relevance score. If there are fewer than k total relevant projects, the suggestions list will be shorter than k. You have a relevance graph of all the Thumbtack categories, represented as an array of strings of comma-separated words. For each string in categories, the first two elements are the categories being compared and the third is their relevance score. You are also given an array of the categories of the projects that a particular user wants to create For example: "House Painting, Interior Painting,0.8" means that House Painting and Interior Painting have a relevance score of 6.8 6.e. highly relevant) and "Handyman, Massage Therapy,0.1" means that Handyman and Massage Therapy have a relevance score of 0.1 6.e. barely relevant). Note that if there is no entry for particular pair of categories, it means that their relevance is 0.0 .e. they aren't relevant at all and they shouldn't be included in the list of suggestions). Given the relevance graph categories, the list of the user's projects, and the number of category suggestions the user should see in the Thumbtack search bar k, return an array of arrays that represents the state of the search bar suggestions list after each of the projects in projects is created. Example For Example For categories "House Painting, Interior Painting, .9", "Handyman, Massage Therapy, 0.1", "Handyman, House Painting, 0.5", "House Painting, House Cleaning,0.6", "Furniture Assembly, Handyman, 0.8", "Furniture Assembly, Massage Therapy, 0.1", "Plumbing Drain Repair, Junk Removal,0.3" projects = ["House Painting", "Handyman"), and k = 3, the output should be categorySuggestions (categories, projects, K) = [["House Painting". "Interior Painting", "House Cleaning". ("Handyman". "House Painting", "Interior Painting")). After the first project House Painting is completed, the most relevant suggestions are in order of their relevance): Category Relevance House Painting Interior Painting 0.9 House Cleaning 0.6 Handyman 0.5 After the second project is completed, the most relevant suggestions are: Category Relevance Handyman House Painting 1.0 1.0 0.9 Interior Painting Furniture Assembly 0.8 House Cleaning 0.6 0.1 Massage Therapy Input/Output (input) array.string categories Category relevancies given in the format "categoryl name>, , , , . relevance is a float number in the range (8,1] and has no more than 6 decimal places after the point It is guaranteed that there are no duplicate entries with the same category pairs (ie. with will be distinct). Category names can only consists of spaces and English letters. Guaranteed constraints: os categories.lengths 1000, 5 s categories [1] .lengths 50 (input) array.string projects The categories to which the user's projects belong. Guaranteed constraints: Os projects.lengths 1000, is projects[i]. length 30. (input) integerk The number of category suggestions that should be shown in the user's search bar, Guaranteed constraints: Osks 50 . (output) array array.string Return the state of the search bar suggestions list after each of the projects in projects is created Every project on Thumbtack belongs to a category. Each set of two categories has a relevance score from 0 to 1, which represents how relevant they are to each other. A category has a relevance score of 1.0 to itself 2 3 3 3 QWERTYUIOP ASDFGHJKL + ZXCVBNM icolay the most Every time a project that belongs to a user is completed, the Thumbtack search bar updates to lay the k most relevant category suggestions for that user. These top categories are chosen by first sorting all the categories that are relevant to at least one of the already created projects by relevance. Then, in the case that their relevance is equal, they should be sorted by category name. If the same category is relevant to 2 or more projects, it should be included only once with the maximum relevance score. If there are fewer thank total relevant projects, the suggestions list will be shorter than k. You have a relevance graph of all the Thumbtack categories, represented as an array of strings of comma-separated words. For each string in categories, the first two elements are the categories being compared and the third is their relevance score. You are also given an array of the categories of the projects that a particular user wants to create For example: "House Painting, Interior Painting, 0.8" means that House Painting and Interior Painting have a relevance score of 0.8 (.e. highly relevant) and "Handyman, Massage Therapy,0.1" means that Handyman and Massage Therapy have a relevance score of 0.1 (.. barely relevant). Note that if there is no entry for particular pair of categories, it means that their relevance is o. o i.e. they aren't relevant at all and they shouldn't be included in the list of suggestions). Given the relevance graph categories, the list of the user's projects, and the number of category suggestions the user should see in the Thumbtack search bar k, return an array of arrays that represents the state of the search bar suggestions list after each of the projects in projects is created. Example of 0.8 6.0. highly relevant) Example For categories = [ "House Painting, Interior Painting, o. "Handyman, Massage Therapy, 0.1", "Handyman, House Painting,0.5", "House Painting, House Cleaning, 0.6", "Furniture Assembly, Handyman, 0.8", "Furniture Assembly, Massage Therapy, 0.1" "Plumbing Drain Repair, Junk Removal,0.3" projects = ["House Painting", "Handyman"), and k = 3, the output should be terior Painting", "House categorySuggestions(categories, projects, k) = [["House Painting", "In Cleaning"], ("Handyman", "House Painting", "Interior Painting"]] order of their relevance): After the first project House Painting is completed, the most relevant suggestions are Category Relevance House Painting Interior Painting House Cleaning 0.5 Handyman After the second project is completed, the most relevant suggestions are: Category Relevance Handyman House Painting 10 0.9 Interior Painting Furniture Assembly House Cleaning 0.1 Massage Therapy Input/Output vance inputarray.string categories Category relevancies given in the format "category1 name>, , , , with will be distinct). Category names can only consists of spaces and English letters. Guaranteed constraints: o s categories.lengths 1000, 5 s categories[1]. length s 50 (input) array.string projects The categories to which the user's projects belong. Guaranteed constraints: Os projects.length = 1000, is projects[i]. length 30. Jinput] integer k The number of category suggestions that should be shown in the user's search bar. Guaranteed constraints: esk 50. (output) array array.string Return the state of the search bar suggestions list after each of the projects in projects is created. Every project on Thumbtack belongs to a category. Each set of two categories has a relevance score from 0 to 1, which represents how relevant they are to each other. A category has a relevance score of 1.0 to itself QWERTYUIOD AS ORGHUKO 2XCVBNM Every time a project that belongs to a user is completed, the Thumbtack search bar updates to display the k most relevant category suggestions for that user. These top categories are chosen by first sorting all the categories that are relevant to at least one of the already created projects by relevance. Then, in the case that their relevance is equal, they should be sorted by Category name of the same category is relevant to 2 or more projects, it should be included only once with the maximum relevance score. If there are fewer than k total relevant projects, the suggestions list will be shorter than k. You have a relevance graph of all the Thumbtack categories, represented as an array of strings of comma-separated words. For each string in categories, the first two elements are the categories being compared and the third is their relevance score. You are also given an array of the categories of the projects that a particular user wants to create For example: "House Painting, Interior Painting,0.8" means that House Painting and Interior Painting have a relevance score of 6.8 6.e. highly relevant) and "Handyman, Massage Therapy,0.1" means that Handyman and Massage Therapy have a relevance score of 0.1 6.e. barely relevant). Note that if there is no entry for particular pair of categories, it means that their relevance is 0.0 .e. they aren't relevant at all and they shouldn't be included in the list of suggestions). Given the relevance graph categories, the list of the user's projects, and the number of category suggestions the user should see in the Thumbtack search bar k, return an array of arrays that represents the state of the search bar suggestions list after each of the projects in projects is created. Example For Example For categories "House Painting, Interior Painting, .9", "Handyman, Massage Therapy, 0.1", "Handyman, House Painting, 0.5", "House Painting, House Cleaning,0.6", "Furniture Assembly, Handyman, 0.8", "Furniture Assembly, Massage Therapy, 0.1", "Plumbing Drain Repair, Junk Removal,0.3" projects = ["House Painting", "Handyman"), and k = 3, the output should be categorySuggestions (categories, projects, K) = [["House Painting". "Interior Painting", "House Cleaning". ("Handyman". "House Painting", "Interior Painting")). After the first project House Painting is completed, the most relevant suggestions are in order of their relevance): Category Relevance House Painting Interior Painting 0.9 House Cleaning 0.6 Handyman 0.5 After the second project is completed, the most relevant suggestions are: Category Relevance Handyman House Painting 1.0 1.0 0.9 Interior Painting Furniture Assembly 0.8 House Cleaning 0.6 0.1 Massage Therapy Input/Output (input) array.string categories Category relevancies given in the format "categoryl name>, , , , . relevance is a float number in the range (8,1] and has no more than 6 decimal places after the point It is guaranteed that there are no duplicate entries with the same category pairs (ie. with will be distinct). Category names can only consists of spaces and English letters. Guaranteed constraints: os categories.lengths 1000, 5 s categories [1] .lengths 50 (input) array.string projects The categories to which the user's projects belong. Guaranteed constraints: Os projects.lengths 1000, is projects[i]. length 30. (input) integerk The number of category suggestions that should be shown in the user's search bar, Guaranteed constraints: Osks 50 . (output) array array.string Return the state of the search bar suggestions list after each of the projects in projects is created

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions