Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NEED ASAP PLEASE. Deliverables: 1. For each programming question, you must hand in: 1. A cpp source file named A2Q#[stno].cpp, properly documented. So if your
NEED ASAP PLEASE.
Deliverables: 1. For each programming question, you must hand in: 1. A cpp source file named A2Q\#[stno].cpp, properly documented. So if your student number is 201234566 and this is question number 1, that would be A2Q1_201234566.cpp. 2. An output screenshot named A2Q# [stno].jpg or A2Q# [stno].png 2. For any non-programming questions, you must hand in a pdf containing your solutions, named A2Ce [stno].pdf. Question 1: Mad Libs form. For example: // anything like [this] is entered by the user I/ anything like is your program using the user's input. Please enter a noun: [noun] Please enter a verbs [verb] Please enter an adjective: [adjective] snouns, and you will do fine.. Context for remaining questions called a term in this context - is to the document it appears in. If = (number of times the term appeared in the document)/(total word count for the document) or "and" many times. That doesn't mean that the document is about those words. Document frequency is calculated like sa: df = (number of documents the term appears in at least once]/itotal number of documents in the collection) Context for remaining questions called a term in this context - is to the document it appears in. If = (number of times the term appeared in the document),/(total word count for the document) or "and" many times. That doesn't mean that the document is about those words. Document frequency is calculated like so: df = (number of documents the term appears in at least once)/(total mumber of documents in the collection) To get imverse document frequency, you just divide one by the document frequency like so: idf =1/dt= itotal number of documents in the collection)/(number ot documents the term appears in at least once) Finally, to calculate tf-idf, you multiply tf by idf. This is mathematically identical to dividing tf by df. Question 2 a) Write code that opens the file "term_datatut' and loads dato into the followng varables in this order: termCount = number of times the term appeared in the document length = total ward count for the document. docCount = number of documents the term appears in at least ance totalDocs = total number of documents in the collection Hint: You will need to include the right header file to complete this question. b) Continus by odding code that colculates tf idf and if-idf ond orints ail three to the consale. Question 3 Base 2,10 , or e are all used. like this: idf=log(totalDocs/(docCount+1)) Duplicate your program from question 2 , and then modify it to calculote idf, and therefore tf-ide using this new formula. Hint: You may need to include a new header file to make this work! 4. Bonus question: Flowchart Make a flowchart for the program from question 1 or 3 ; your choice which oneStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started