Question: I need help building this isDup Function. We are using VBA as the programming language. Here is the task. Task 3: Remove Duplicates Step 3.1:

I need help building this "isDup" Function. We are using VBA as the programming language. Here is the task.

Task 3: Remove Duplicates

Step 3.1: isDup Function

While Excels built in remove duplicates feature was able to remove identical tweets, we would also like to remove similar but not identical tweets like: $1 USD is currently worth 0.00010627 BTC! and $1 USD is currently worth 0.00010692 BTC! To do this we will create a VBA function named isDup that will detect if two tweets are sufficiently similar to be considered a duplicate. isDup will return True if two tweets given to it are duplicates and False otherwise. This function must have the following function header:

Function isDup(tweet1 As String, tweet2 As String, threshold As Double) As Boolean

where tweet1 and tweet2 are the text of two different tweets and threshold is a percentage of the number of words that they must have in common to be considered a duplicate. It is based on the total number of words in the first tweet. If we are using a threshold of 0.7 and the first tweet has 100 words, at least 70 of those words must be in common with the second tweet for isDup to be True. If it is less than 70 words like 56 or 34 then the tweet is not deemed a duplicate and False should be returned. Note that threshold is passed as an argument to the function with a value between 0 and 1 and should not be hard coded as 0.7 in your function.

Example:

If tweet1 is: Hours of planning can save weeks of coding and

tweet2 is: Weeks of programming can save you hours of planning

The correct count for words in common should be 7 out of 8 as the only difference is coding v.s. planning and isDup should return True if the threshold is less than 0.875. Note that the total number of words is based on the length of tweet1 and each word in tweet1 is matched at most once. of occurs twice so it is matched twice in tweet1 (and not four times). Capitalization should be ignored.

Some Hints: You will need to use the string functions StrComp and Split. Use Split to break the strings into individual words and StrComp to compare them while ignoring capitalization. You will need to use nested loops. One to go through each word of tweet1 and one to go through each word of tweet2

Thank you in advance.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!