Question: We are doing the first step of Natural Language Processing which is data cleaning and tokenization. 1. Write a program that reads all text files

 We are doing the first step of Natural Language Processing which

We are doing the first step of Natural Language Processing which is data cleaning and tokenization. 1. Write a program that reads all text files from a folder and writes the following information in another file named out.txt: 1st Line of out.txt-> Sources :file1.txtotalUniqueWordsfile2.txtotalUniqueWords. .. 2nd line and onward-> Each word and its count from all files in alphabetical order Eg: Hello: 150 Process: 100 Hint: 1. Write a program that gets the job done for just one text file initially 2. Loop over all files of a directory and use the code from 1 3. Use HashMapeString, Integer> to count the occurences of each word. 1. HashMap counts-new HashMap) For eachWord in tokens: If (isnotalpha(eachword) continue; If counts.hasKey(eachWord) Int c = counts.get(eachWord) counts.put(eachWord,c+1) Else: counts.put(eachWord, 1)

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!