Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python - please help make the fuzzy wuzzy output works PROBLEM: A useful computer utility is to report the differences between two files. In this

Python - please help make the fuzzy wuzzy output works image text in transcribed
image text in transcribed
PROBLEM: A useful computer utility is to report the differences between two files. In this program, you will compare two strings to find common strings. For this program, a string consists of "words"; words are letters which are separated by a single space. The following algorithm will be used first: Consider each word in turn from left to right in the first string. If that word appears as a word or part of a word in the second string, add the word to the resulting common string and delete the entire first occurrence of the word where it was found in the second string. For example, if "add" is in the first string and "addition" is in the second string, the "add" is deleted from "addition" leaving "ition" in the second string. Words are separated by one space in the common string. Upper and lower case letters are considered different letters. Then use this second algorithm: Consider each character in turn in the first resulting common string. If it appears in the second resulting common string, add it to a new resulting common string and delete all characters in the second resulting common string up to and including that character. Ignore blanks. Consider the following 2 strings: A. The quick brown fox did jump over a log B. The brown rabbit quickly did outjump the fox Diff ing A to B gives a result of "The quick brown fox did jump a" Diff ing B to A give a results of "The brown did fox" Using the second algorithm produces: Theiox INPUT: 5 sets of data, where each set consists of 2 strings, each on a separate line. Each strin will be at most 100 characters. Blank lines are shown for readability ONLY! OUTPUT: For each pair of strings (call them A and B), find the common string by diff in B and diff ing B to A using the first algorithm. Then using the resulting 2 common strings ap the second algorithm. Print the resulting common string. If it is empty, print "NONE". The quick brown fox did jump over a log The brown rabbit quickly did outjump the fox How many pickled peppers did Peter Piper pick Peter Piper picked a peck of pickled peppers The Allstar Contest is in Wayne Hills NJ Hills are where there are contestants from NJ Fuzzy Wuzzy was a bear Fuzzy Wuzzy had no hair Fuzzy Wuzzy was not fuzzy was he Super cali frigi listic expi alli docious frigid call superman allies expired list SAMPLE OUTPUT 1. Theiox 2. pickledpeppers 3. HillsNJ 4. FuzzyWuzzywas 5

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

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions

Question

Create a workflow analysis.

Answered: 1 week ago