Write an Erlang program that counts the word frequencies in the file assign3-part2.txt. Erlang uses a list of tuples as a hash table. Write four Erlang functions.
file:open. The file lab3-part2.txt was written in a text editor as one line, so
io:get_linewill read the whole file.
string:tokenswill separate it into words. Its second argument specifies all the delimiters.
L1= io:get_line(S, '').
lists:keyfindmethod will find a tuple if it exists and return false if it does not. If the word is not found use
lists:appendto add a tuple with the word as key and
1as the frequency. If the word is found use
lists:replaceto replace the tuple with a new tuple with frequency increased by one.
string:to_lowermethod will make a word lower case to provided the desired case insensitivity. Use the
lists:foldlmethod to build the answer using the function
lists:sortfunction. Its one parameter is the file name. It uses functions
The aim of our service is to provide you with top-class essay help when you ask us to write my paper; we do not collect or share any of your personal data. We use the email you provide us to send you drafts, final papers, and the occasional promotion and discount code, but that’s it!Order Now