Write a Java program that uses the file EnglishWordList.txt which contains a collection of words in...

80.2K

Verified Solution

Question

Programming

Write a Java program that uses the file EnglishWordList.txtwhich contains a collection of words in English (dictionary), tofind the number of misspelled words in a story file calledAlcott-little-261.txt. Please note that the dictionary words areall lower-cased and there are no punctuation symbols or numbers.Hence it is important that you eliminate anything other than a-zand A-Z and then lower case story words for valid comparisonsagainst the WordList file. When you read each line of the storyfile as a String, use split() method to store the words per line ina String array. Then go through each word in the array to lowercaseit and to eliminate all but a-z A-Z using Java regex - somethinglike

String word = word.replaceAll(“[^a-zA-Z]”,””).toLowerCase();

Neither file can be linked, but one can use two random textfiles to complete this. the Alcott text file is a story, whileEnglishWordList is all the words in the English dictionary.Basically this is spell check.

Answer & Explanation Solved by verified expert
3.8 Ratings (563 Votes)
import javautil import javaio public class Main public static void mainStringargs throws Exception input files File dictionaryFile new FileEnglishWordListtxt File storyFile    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students