Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function named lineStats. The function lineStats takes three parameters inFile, a string that is the name of an input file 2. 1. outFile,

image text in transcribed
image text in transcribed
Write a function named lineStats. The function lineStats takes three parameters inFile, a string that is the name of an input file 2. 1. outFile, a string that is the name of an output file 3. threshold, an int that is the length above which a word is considered significant The function lineStats should read and analyze each line of the input file and write two statistics, separated by a space, about the line to a corresponding line of the output file. The two statistics for each line are the number of words the number of distinct significant words (that is, words longer than threshold) 1. 2. Hint if word occurs more than once on a line i counts as a single word. Upper and lower case characters are considered the same ('Word' and 'word' are the same word). The input file contains only upper and lower case letters and white space. For example, if the file fish.txt contains the following lines: Yes some are red and some are blue Some are old and some are new Then the function call lineStats ('fish.txt', 'fishOut.txt', 3) should produce an output file fishOut.txt with the following content 8 2 7 1

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions