Question

Objective The objective of this assignment is to get you familiar with regular expression, word tokenization...

Objective

The objective of this assignment is to get you familiar with regular expression, word tokenization and sentence segmentation. Given a text document, your goal is to segment the document into separate sentences. An example input/output pair is provided below.

Input

It also means that we've got to make sure that young people like yourself are able to afford a college education. Earlier, Governor Romney talked about—he wants to make Pell grants and other education accessible for young people. Well, the truth of the matter is, is that that's exactly what we've done. We've expanded Pell grants for millions of people, including millions of young women all across the country. We did it by taking $60 billion that was going to banks and lenders as middlemen for the student loan program, and we said, let's just cut out the middleman. Let's give the money directly to students. And as a consequence, we've seen millions of young people be able to afford college, and that's going to make sure that young women are going to be able to compete in that marketplace.

Output

1. It also means that we've got to make sure that young people like yourself are able to afford a college education.

2. Earlier, Gov. Romney talked about—he wants to make Pell grants and other education accessible for young people.

3. Well, the truth of the matter is, is that that's exactly what we've done.

4. We've expanded Pell grants for millions of people, including millions of young women all across the country.

5. We did it by taking $60.3 billion that was going to banks and lenders as middlemen for the student loan program, and we said, let's just cut out the middleman.

6. Let's give the money directly to students.

7. And as a consequence, we've seen millions of young people be able to afford college, and that's going to make sure that young women are going to be able to compete in that marketplace.

Your program should process the input.txt file and generate an output.txt file. Each line of the output file should start with the sentence number followed by the sentence as shown in the above example.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<fstream>
#include<iostream>

using namespace std;
int main()

{

ifstream fin;

ofstream fout;

fin.open("input.txt",ios::in);

fout.open("output.txt",ios::out);

int i=1;

char ch;
fout<<"1.";

while(fin)

{ fin.get(ch);
fout<<ch;
if(ch=='.')
fout<<"\n"<<++i<<".";

}

fin.close();

fout.close();

return 0;}

Note:PLEASE REMOVE THE LAST FULL STOP OF THE INPUT TEXT.YOU WILL GET THE DESIRED OUTPUT.

Add a comment
Know the answer?
Add Answer to:
Objective The objective of this assignment is to get you familiar with regular expression, word tokenization...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can I get help with this queshtion. Heres the article i was not sure in what...

    Can I get help with this queshtion. Heres the article i was not sure in what category they will have to be in. This was the only way to post it and it starts where it says THE QUESHTION STARTS FROM HERE. The Economics of Immigration Paul Krugman In 1970, only 5% of U.S. workers had been born abroad. By 2016, however, 17% of American workers had immigrated to the United States, both legally and illegally. (1) Figure 1: Percentage...

  • Assignment 3: Introduction & Environmental Analysis, SWOT, Marketing Objectives (Goals) Marketing 4100 Directions Total Point Value:...

    Assignment 3: Introduction & Environmental Analysis, SWOT, Marketing Objectives (Goals) Marketing 4100 Directions Total Point Value: 75 points Anticipated Time to Complete: 12 hours Type of Assignment: Individual or Team Audience for Assignment: The CMO and your boss, a director-level person who relies on your evidence-supported reports to make the best decisions in a minimum amount of time. Assignment Objective: To write the marketing plan introduction as well as to collect and analyze data about the environment in which the...

  • I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter T...

    I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter Two, “Keys to Successful IT Governance,” from Roger Kroft and Guy Scalzi’s book entitled, IT Governance in Hospitals and Health Systems, please refer to the following assignment instructions below. This chapter consists of interviews with executives identifying mistakes that are made when governing healthcare information technology (IT). The chapter is broken down into subheadings listing areas of importance to understand...

  • Overview Title Manager's Hot Seat: Listening Skills: Yeah, Whatever Pilar Grimault has scheduled a meeting with...

    Overview Title Manager's Hot Seat: Listening Skills: Yeah, Whatever Pilar Grimault has scheduled a meeting with her department’s young Creative Director, Miguel Valentino. He has recently completed a campaign for a longstanding client, Jezebel. Although the campaign was a huge success, the client has complained to Pilar about Miguel’s project management skills. Here's the video transcript -Hello. Hey, I just came down the street, and I was stopped by three different people. We're a hit. We're a huge hit. i...

  • Hi there! I need to compare two essay into 1 essay, and make it interesting and...

    Hi there! I need to compare two essay into 1 essay, and make it interesting and choose couple topics which im going to talk about in my essay FIRST ESSAY “Teaching New Worlds/New Words” bell hooks Like desire, language disrupts, refuses to be contained within boundaries. It speaks itself against our will, in words and thoughts that intrude, even violate the most private spaces of mind and body. It was in my first year of college that I read Adrienne...

  • Putting Your Best Cyberface Forward By STEPHANIE ROSENBLOOMJAN. 3, 2008 your nails? Have you pierced your...

    Putting Your Best Cyberface Forward By STEPHANIE ROSENBLOOMJAN. 3, 2008 your nails? Have you pierced your tongue? Is your tote bag emblazoned with the words "I'm not a plastic bag"? at the way they do for reasons too numerous to fit into any therapist's notebook. Yet we commonly shape People look and act the way they do for reasons too ir behavior or tweak our appearance in an attempt to control how others perceive us i m mon sense. Social...

  • Evaluate the arical writ the response in which you state your agreement or disagreement with writer...

    Evaluate the arical writ the response in which you state your agreement or disagreement with writer up un these questions guidelines 1) can empathy lead us astrary? how 2) our heart will always go out to the baby in the well, its a measure of our humanity. but empathy will have to yield to reason if humanity is to have a future can empathy yield to reason? how? thank you The Baby in the Well: The Case against Empathy* -Paul...

  • ABC International: Solving the Rural Barrier

         Compensation sessionABC International:   Solving the Rural BarrierSource: Thunderbird School of Global Management, A unit of the Arizona State University Knowledge Enterprise. 2015. This case was prepared by Erin Bell under the guidance and supervision of Dr. Amanda Bullough, and revised and updated by Drew Helm for the purpose of classroom discussion only, and not to indicate either effective or ineffective managementSiham sat with her family and childhood friend, Leila, in their rural village of Qabatiya, Palestine. Leila had recently returned from...

  • Question 1: Comment on each of the three source attributes that contribute to a celebrity's potential...

    Question 1: Comment on each of the three source attributes that contribute to a celebrity's potential effectiveness as an endorser (credibility, attractiveness, and power) and how the proposed Chinese celebrity measures up in each of those attributes. Wei Song noticed the fashion models first, preening in their chiffon- and-lace gowns. STEPHEN MASON and JOSEPH SAIVACRUZ are professors of business practice at HKUST Business School. LP. STEVENSON is a manager of competitive intelligence at the Fung Group. This fictionalized case study...

  • While reading the story, consider the culture (or sub culture) and related communication styles the story...

    While reading the story, consider the culture (or sub culture) and related communication styles the story reveals. Consider too, possibly, the values, behavioral norms, social practices, social artifacts, etc. After reading the story through the lens of this idea, please compose a full academic length (evidence-based 7 to 11 sentence long) paragraph which addresses the following prompt: What does the story reveal about the culture it portrays and/OR the communication styles the culture shares? In other words, what does the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT