Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Search engine like Google helps a user to efficiently find web page containing information relevant to their queries. One of the basic operations to
Search engine like Google helps a user to efficiently find web page containing information relevant to their queries. One of the basic operations to find relevant information is string comparison which requires some basic text preprocessing. Given the following query text: "Python install for MAC" and three web pages with the following information: 1. Looking for Python with a different OS? Python for Windows, Linux/UNIX, Mac OS X, Other Want to help test development versions of Python? Prereleases, Docker images Looking for Python 2.7? See below for specific releases. 2. Python on a Macintosh running Mac OS X is in principle very similar to Python on any other Unix platform, but there are a number of additional features such as the IDE and the Package Manager that are worth pointing out. 3. Mac OS X 10.8 comes with Python 2.7 pre-installed by Apple. If you wish, you are invited to install the most recent version of Python 3 from the Python website. A current "universal binary" build of Python, which runs natively on the Mac's new Intel and legacy PPC CPU's, is available there. Write a program as instructed below to implement a simple search engine application. Convert the query text and web page texts to lower case Remove the punctuations (?, .) from the web page texts Convert the query text and web page texts to word lists and remove stop words from them stopwords = ['for', 'with', 'and', 'a', 'other', 'to', 'of, 'below', 'on', 'is', 'in', 'are', 'as', 'the', 'that', 'out', 'by', 'if', 'from', 'there'] Compare the query text with three web page texts and rank the webpages by their similarity to the query text. (similarity can be measured by the total number of times the words in the query text used in each webpage text) Sample output: Query text before comparisont python alty web page texts before comparison: [[looking", "python, airferent on", "python, windows, 11nux/unix" "ma", "x", want', 'help', 'test', 'development, 'versiona", "python", "prereleases" "docker", "images", looking, 'python' '27', 'a', 'specific', 'releases'), ('python", "macintosh, running", "mac", "o", "x", "principle", ry', 'similar', 'python","any', unix, platform, but', 'number', "additional', 'features', 'auch, ide", "packa ge', manager', 'worth', 'pointing'1, I'mac', 'on', 'x, 100', 'comes, "python, 27, "pre-installed', 'apple', 'y ou wish, you", invited', "install', 'nostrecent version", "python', '3", "python', website', 'current", niversal, binary", "build, python, which', 'runs, 'natively, mac's', 'new', 'intel', 'legacy', 'ppo', 'op uta, available 11 similarity of three web page texts to the query text: (5, 3, 61 Most similar web page to the query text: 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres a Python program to implement a simple search engine application following the instructions you provided import string Define the stopwords list ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started