Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please only use the specified libraries!! You are required to write a C++ program that would serve as a word count. Word count is used

image text in transcribedimage text in transcribedPlease only use the specified libraries!!

You are required to write a C++ program that would serve as a word count. Word count is used quite a lot in Natural Language Processing (NLP) and is a pretty interesting concept that is used in various applications today like spam detection, sentiment analysis, etc. You are provided a text file (data.txt) with this lab which is an excerpt from Ontario Tech University's history. All the punctuation except the apostrophes and hyphens are intentionally removed from the text. You are required to perform the following tasks: - Read the text file word by word. - Create a class called that Has 2 data members, i.e., Has appropriate getters and setters At least one constructor Uses the keyword to help distinguish between data members and local variables - Create a collection of words in such a way that your program can distinguish between different words, i.e., store each different word in an object of WordCounter class. - Every time a word appears your program is required to count the occurrence of that word in the file. - Finally print a report with each word and number of times it occurred in the text file provided. - You can only use \#include, \#include, \#include, \#include libraries. Your program should at least have the following methods: - which takes a vector of WordCounter objects and a word to make a search of that word in that vector. If the word is found, return true else false. - function that counts the occurrence of a word. It is your responsibility to find out which arguments should be provided to this function. - which should simply use cout to tell how many times each word has appeared in the file. Below is the expected output of the program: and: 18 Please note that the output shown above is not the complete output but should at least give you an idea of what your program should produce

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions

Question

Describe three other types of visual aids.

Answered: 1 week ago