Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the code in C++ 1. Project Definition You are expected to write a c++ console application that reads and counts unique words used

Please write the code in C++

1. Project Definition

You are expected to write a c++ console application that reads and counts unique words used in documents: articles, chapters, books about Applied sciences, Mathematics, Information science published from 1900 to 2021 and find Top 10 frequent words used in these documents.

ArticlesDataset.txt file contains all the metadata information of documents. unigramCount contains all unique words and their number of occurrences for each document. There are 1500 publications recorded in the txt file. Find total frequency of all the unigrams used in all publications and print top 10 frequent words in these documents.

Here is an example entry for a document:

{"creator":["Romain Allais","Julie Gobert"], "datePublished":"2018-05-30", "docType":"article", "doi":"10.1051\/mattech\/2018010", "id":"ark:\/\/27927\/phz10hn2bh3", "isPartOf":"Mat\u00e9riaux & Techniques", "issueNumber":"5-6","language":["eng"], "outputFormat":["unigram","bigram","trigram"], "pageCount":7, "pagination":"pp. null-null", "provider":"portico", "publicationYear":2018, "publisher":"EDP Sciences", "sequence":3.0, "tdmCategory":["Applied sciences - Engineering"], "title":"Environmental assessment of PSS", "url":"http:\/\/doi.org\/10.1051\/mattech\/2018010", "volumeNumber":"105", "wordCount":4446, "unigramCount":{"others":1,"air":1,"networks,":1,"conventional":1,"IEEE":1} }

Your program must pull out the unigram counts for each document and store them in a suitable data structure. Stop words

A list of stop words is supplied in stopwords.txt file to remove function words (e.g., the, and I, to, of, a) and other common words. You should not count these words.

Definition of a word:

For simplicity assume that any contiguous block of alphabetic characters (letters from a to z, both upper and lower case) which includes at most one single quotation mark between these letters is a word. According to this definition the following sentence in an article:

" if we don't have local agreements settled by Thursday", has the words: if, we, dont, have, local, agreements, settled, by, Thursday.

Also note that; to combine the counts of each unigram, you must lowercase all the characters in each string. That means the string "the" and "The" are same.

Main Requirements:

After reading and processing is over, your program must print top 10 most frequent words used in these documents in descending order.

Additionally, the total time elapsed from the beginning of your code to the end of printing top 10 must be calculated and printed at the end of the execution.

Here is an example output:

. . . . . . . Total Elapsed Time: X seconds

Whole application can be implemented with console facilities (you do not need advanced GUI elements).

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_2

Step: 3

blur-text-image_3

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

What factors help determine the market value of stock?

Answered: 1 week ago

Question

KEY QUESTION Refer to columns 1 and 6 in the table for question

Answered: 1 week ago