In the above question, What if we want to find the most common PHRASE in his writings.

Question:

In the above question, What if we want to find the most common PHRASE in his writings.

We can keep Hash-Table and do the same process of the 2nd and 3rd problems.

Question 3

In the above question, What if you are given whole work of OSCAR WILDE, most popular playwrights in the early 1890s.

a. Who knows how many books are there, let us assume there is a lot and we cannot put everything in memory. First, we need a Streaming Library so that we can read section by section in each document. Then we need a tokenizer that will give words to our program. In addition, we need some sort of dictionary let us say we will use HashTable.

b. What you need is - 1. A streaming library tokenizer, 2. A tokenizer 3. A hashmap Method: 1. Use streamers to find a stream of the given words 2. Tokenize the input text 3. If the stemmed word is in hash map, increment its frequency count else add a word to hash map with frequency 1

c. We can improve the performance by looking into parallel computing. We can use the map-reduce to solve this problem.

Multiple nodes will read and process multiple documents. Once they are done with their processing, then we can do the reduce operation by merging them.

Question 2

In given large string, find the most occurring words in the string. What is the Time Complexity of the above solution?

a. Create a Hashtable which will keep track of

b. Iterate through the string and keep track of word frequency by inserting into Hash-Table.

c. When we have a new word, we will insert it into the Hashtable with frequency 1. For all repetition of the word, we will increase the frequency.

d. We can keep track of the most occurring words whenever we are increasing the frequency we can see if this is the most occurring word or not.

e. Time Complexity is O(n) where n is the number of words in the string and Space Complexity is the O(m) where m is the unique words in the string.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: