Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JavaScript /* Implement a proximity search method. Given text as input, two keywords and a numeric range, return the number of times both keyword 1

JavaScript

 /* Implement a proximity search method. Given text as input, two keywords and a numeric range, return the number of times both keyword 1 and keyword 2 are found within the given range throughout the text, or 0 if your search is not successful. The keywords themselves are considered to be part of the range. This makes 2 the minimum valid range for keyword proximity. For simplicity, assume all words are separated with a whitespace. input text(text) : The early bird gets the worm keyword1(text): bird keyword2(text): worm range(number) : 4 k1= bird k2 = worm text: the early bird bird worm worm gets the worm the early bird bird - 0 early bird bird worm - 2 bird = 2, worm = 1 -> 2 bird bird worm worm - 2 bird = 2, worm = 1 (as new word is same as old - neglect one word) -> 2 bird worm worm gets -0 bird = 0, worm = 0 as all are already processed worm worm gets the - 0 worm gets the worm - 0 */

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions