logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Peck KellerTechnical writing
(5/5)

708 Answers

Hire Me
expert
Martha BagemihlStatistics
(5/5)

519 Answers

Hire Me
expert
Bill BattershillPhilosophy
(5/5)

526 Answers

Hire Me
expert
Ashton HamiltonEnglish
(5/5)

533 Answers

Hire Me
C Programming

In this assignment you are going to learn two things: how to process text (the first step in understanding language) and how to write code in small, bite-size portions: functions

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Assignment 2: Text Processing

Introduction

Text is a very important part of the data that computers deal with. In this assignment you are going to learn two things: how to process text (the first step in understanding language) and how to write code in small, bite-size portions: functions!

Functionality

Once again you will write your programs in increasingly more powerful pieces. But unlike the first assignment you will only produce two main programs and a number of functions. The number of functions that you write correctly will determine your grade.


Remember the wcount.c program in the textbook and in class. You will find a related program in the file textRW.c. In the original program, the text was read in a character at a time. The program textRW.c reads in text, one line at a time. The program assumes that no line contains more than 500 characters. Your code will not be tested on text that violates this constraint.

To test out textRW do the following:

$ make textRW

$ cat verneTest.txt | ./textRW

Produce the following functions that will work on a single line of text:

int chop ( char *line )

  • Remove the ‘\n’ from the end of the line.

  • Returns 0 if successful and -1 on


int convertLowerCase ( char *line )

  • Convert all alphabetic characters to lower case (do not use the tolower()

function in the string library for C or your grade will be zero for this function).

  • Returns the number of characters converted from upper case to lower


int replaceDigits ( char *line )

  • Replace the all numbers/digits (0-9) with

  • Returns the number of digits replaced with


int replacePunc ( char *line )

  • Replace all punctuation and symbols with blanks. A list of all punctuation and symbols appears in the Information section of this

  • Returns the number of punctuation and symbols replaced with


int reduceSpace ( char *line )

  • Reduce all white space (blank characters and tabs to a single blank space).

  • Returns the number of white spaces


int trim ( char *line )

  • Trim all white space from the beginning and from the end of each

  • Returns 0 on success and -1 on


Now compile the program findWords.c with your functions using Makefile and run this against the test file called verneTest.txt.


$ make findWords

$ cat verneTest.txt | ./findWords


Your output should look like the output in file resultsVerne.txt.


The findWords program has found all the words in the file that are greater than 5 characters in length.


Now run the following pipeline:


$ cat verneTest.txt | ./findWords | sort


The output should look like the output in file sortedResultsVerne.txt.

Your last task is to write a program called wordBag.c that prints out all the unique words produced by the previous pipeline with their counts (number of times that they occur). The output will look like the output in file countsResultsVerne.txt.


Now run the following pipelines:

$ cat verneTest.txt | ./findWords | sort | ./wordBag

$ cat verneTest.txt | ./findWords | sort | ./wordBag | sort - gk1,1r -gk2,2

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

361 Experts Online