You need to calculate how many times each word appears in thelist of words. Create a Dictionary
Question:
You need to calculate how many times each word appears in thelist of words. Create a Dictionary to store those counts. The keyof the dictionary will be the words and the value will be thecounts. Loop over the list of words and put or update the word inthe dictionary. • Make it case-insensitive meaning that if theword is upper-case and lower-case in the data, only 1will appear in the dictionary. For example, ‘The’ and ‘the’are the same word so only one should be in the dictionary. •You need to check if the word is in the dictionary to decide if itshould be added or if it should be updated. Use ContainsKey orTryGetValue.
Add logic to the menu for the "Show Histogram" option. For eachword in the dictionary, print the dictionary, print the word, thecount, and a bar representing the count as a horizontal bar chart(see screenshot). Format your chart to make it look nice! UseConsole.CursorLeft to align the bars.
Ex output
I =====8
today ===================19
Now you have the information you need to add logic to the menufor the “Search for Word” option. Ask the user for a word to searchfor (“What word do you want to find? “). Use ReadString to get theword from the user! If the word is in the Dictionary, print theword, bar, and count. Show the sentences that the word appears in.HINT: you can split the original speech text on differentdelimiters to get the sentences. If the word is NOT in thedictionary, print “ is not found.”. (replace with what the userentered). Using C#
Ex. 1. Show Histogram
2. Search for Word
3. Exit
Choice?
Database Processing Fundamentals, Design, and Implementation
ISBN: 978-0133876703
14th edition
Authors: David M. Kroenke, David J. Auer