CSE2/CSE5ALG: Algorithms and Data Structures - Building the Lexicon - IT Assessment Answer

Download Solution Order New Solution

CSE2/CSE5ALG: IT Assessment Answer

Task: 1 For this task, you are to design and implement the program LexiconTester.java. This program will
  1. Read two text files, sample1-pp.txt and sample2-zoo.txt, and construct a lexicon that contains words from the two files;
  2. Write the words from the lexicon to the text file sample3-wordlist.txt.
Further information about the task is given below. Building the lexicon The first text file to be read in is the file sample1-pp.txt shown below: Pride and Prejudice by Jane Austen Chapter 1 It is a truth universally acknowledged that a single man in possession of a good fortune must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families, that he is considered the rightful property of some one or other of their daughters. "My dear Mr. Bennet," said his lady to him one day, "have you heard that Netherfield Park is let at last?" Mr. Bennet replied that he had not. "But it is," returned she; "for Mrs. Long has just been here, and she told me all about it." Mr. Bennet made no answer. "Do you not want to know who has taken it?" cried his wife impatiently. "YOU want to tell me, and I have no objection to hearing it." This was invitation enough. The second text file to be read in (and its words added to the lexicon) is the file sample2-zoo.txt below: You can see zebras and yaks at the zoo. Yes, zebras and yaks and wombats too. You will also meet a fat cat, wearing a hat, sitting on a mat, reading a map while drinking from a cup. Task 2 For this task, you are to write the program WordMatchTester.java. This program will
  1. Read two text files, sample1-pp.txt and sample2-zoo.txt, and construct a lexicon that contains words from the two files (as in Task 1);
  2. Find the words that match a number of patterns, and display the results (both the patterns and matching words) on the screen and write them to the file sample4-results.txt.
The test cases (patterns) should be carefully chosen, and the reasons for including them must be documented in the program. Further information about the task is given below. Finding matching words The patterns to match the words in the lexicon are to be included (hard-coded) as strings in the test program. A pattern consists of a sequence of letters, with no spaces within the sequence. In addition, there are two wildcard characters allowed. A ’?’ symbol in the pattern can match with any one character in a word, while a ’*’ symbol can match with any number of characters in a word (zero or more) For each pattern, the pattern and the words that match the pattern are to be displayed on the screen and write to the text file. Each matching word, together with its frequen cy, appears on a separate line. The words are in alphabetical order. For example, the pattern: ma? may result in the words below being displayed to the screen man 2 map 1 mat 1 may 1 The pattern: ?o? may result in the following words being displayed. Note the words are displayed in lexicographic order. for 1 not 2 too 1 you 5 zoo 1 The pattern: Mr* may result in the output: mr 3 mrs 1 The pattern: may result in the output
  • 1 impatiently 1 in 3 invitation 1 is 5
The pattern ?ear* may result in the output: dear 1 heard 1 hearing 1 wearing 1 Any pattern that has no matches will result in the message No words in the lexicon match the pattern output to the screen and written to the file. The patterns should be designed for a comprehensive testing of the correctness of what you have implemented. As a suggestion, you should include at least 10 test cases (i.e. patterns). They must be hardcoded into the program, and the reasons for including them must be documented in the program.
This CSE2/CSE5ALG: Algorithms and Data Structures Assignment has been solved by our IT experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.