Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that does the following, please follow the detailed instructions throughly, it is only one question, and the instructions make it very

Write a C program that does the following, please follow the detailed instructions throughly, it is only one question, and the instructions make it very clear for you :

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Overview This assignment covers strings, structures (potentially, depending on your solution method), file I/O and problem solving techniques. The goal of the assignment is to write C programs which can parse and analyze English text, and the three parts of the assignment represent different milestones in producing a program to analyze the word distribution in a passage of text. Definition of a word Since this assignment requires reading words from a passage of text, it is important to have a rigorous defintion of what constitutes a word. For this assignment, a word is more of the following any sequence of 1 or Alphabetical characters (either uppercase or lowercase) The hyphen character - The apostrophe character ' For extra clarity, the function is word_character below returns 1 if the provided character meet:s the definition of a word character above and returns 0 otherwise. You don't have to use this function in your code; it is only provided as a source of context. int is word_character(char c)f if (isalpha(c) return 1; c'-' llc- ' else return 0; Words in a passage of tex Your code will need to extract words from a consecutive set of word characters (as defined above) as a word and use any non-word characters (like spaces, newlines, digits or symbols other than hyphens or apostrophes) as a separator of text. To do this, you should take any For example, the string "Raspberry Pineapple" contains two words: "Raspberry" and "Pineapple". The string "Rasp###berry Pine123apple and "apple". Notice that any non-word character can be used to break up words, and that repeated sequences of non-word characters are all ignored while finding words. "contains four words: "Rasp", "berry", "Pine" For each of the three parts of this assignment, you will write a program which reads a text file input text.txt and extracts all of the words from the file. If you complete the parts in order, you should find that the solution for each part helps you complete the next part. Since our definition of a word is slightly different than usual (in particular, words do not include characters like digits and certain symbols), you cannot directly read words from the input file using fscanf. You will likely find that the easiest way to read words is to read the file character by character with fgetc and build word works. s as you go, but you are free to use any input method that

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago