subject

The program 4 should first tell users that this is a word analysis file. For any user-given text file, the program will read, analyze, and write each word with the line numbers where the word is found in an output file. A word may appear in multiple lines. A word shows more than once at a line, the line number will be only recorded one time. Ask a user to enter the name of a text file. Using try/except for invalid user input. Then the program reads the contents of the text file and create a dictionary in which the key-value pairs are described as follows:" Key. The key are the individual words found in the file. "Value. Each value is a list that contains the line numbers in the file where the word (the key) is found. Be aware that a list may have only one element. Once the dictionary has been built, the program should create another text file, named "word_index. txt". Next, write the contents of the dictionary to the file as an alphabetical listing of the words that are stored as keys in the dictionary (sorting the keys), along with the line numbers where the words appear in the original file. Please see the sample file for reference. Looking to seeing everyone to submit a well-done program! Here are some tips: "Documents/Comments of your program (Never more) "Testing your program by the given two files, Kennedy. txt and romeo. txt. The output file of the Kennedy. txt, "Kennedy_index. txt" and the output file for romeo. txt, "romeo_index. txt,. Please compare your program files with them. "Text File to be analyzed: romeo. txtArise: 5But: 1It: 3Juliet: 3Who: 7already: 7and: 3, 5, 7breaks: 1east: 3envious: 5fair: 5grief: 7is: 3, 7kill: 5light: 1moon: 5pale: 7sick: 7soft: 1sun: 3, 5the: 3, 5through: 1what: 1window: 1with: 7yonder: 1Text File to be analyzed: Kennedy. txtWe: 1a: 1, 2, 4an: 3as: 4, 5, 6beginning: 4but: 2celebration: 2change: 6end: 3freedom: 3not: 1observe: 1of: 2, 3party: 2renewal: 5signifying: 5symbolizing: 3today: 1victory: 1well: 4, 5romeo. txt But soft what light through yonder window breaks It is the east and Juliet is the sun Arise fair sun and kill the envious moon Who is already sick and pale with griefKennedy. txt We observe today not a victory of party but a celebration of freedom symbolizing an end as well as a beginning signifying renewal as well as change

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
Write a method so that the main() code below can be replaced by the simpler code that calls method original main(): public class calcmiles { public static void main(string [] args) { double milesperhour; double minutestraveled; double hourstraveled; double milestraveled; milesprhour = scnr.nextdouble(); minutestraveled = scnr.nextdouble(); hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; system.out.println("miles: " + milestraveled); } }
Answers: 2
question
Computers and Technology, 23.06.2019 20:30
Column a of irma’s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
question
Computers and Technology, 24.06.2019 17:00
Aman travel 200m towards east< br /> from his house then takes left< br /> to turn and moves 200 m north< br /> find the displacement & distance.< br />
Answers: 3
question
Computers and Technology, 24.06.2019 22:00
Is the process of organizing data to reduce redundancy. a. normalization b. primary keying c. specifying relationships d. duplication
Answers: 1
You know the right answer?
The program 4 should first tell users that this is a word analysis file. For any user-given text fil...
Questions
Questions on the website: 13722359