Question
Please code should be written in python . Question 2. (35 points) . Write a program to tokenize a text file into sentences. The input
Please code should be written in python.
Question 2. (35 points). Write a program to tokenize a text file into sentences. The input file Assign2q2.txt is included below.
Specifically, your program should open an input text file (Assign2q2.txt), read the whole file or each character to look for end of a sentence, output that sentence to a collection data type till the whole texts are processed, and write the sentences into an output file called Assign2q2-out.txt, each line with one sentence. An example is given below:
Sample input from file:
But though the picture lies thus tranced, and though this pine-tree shakes down its sighs like leaves upon this shepherds head, yet all were vain, unless the shepherds eye were fixed upon the magic stream before him. Go visit the Prairies in June, when for scores on scores of miles you wade knee-deep among Tiger-lilieswhat is the one charm wanting? Waterthere is not a drop of water there! Were Niagara but a cataract of sand, would you travel your thousand miles to see it? Why did the poor poet of Tennessee, upon suddenly receiving two handfuls of silver, deliberate whether to buy him a coat, which he sadly needed, or invest his money in a pedestrian trip to Rockaway Beach? Why is almost every robust healthy boy with a robust healthy soul in him, at some time or other crazy to go to sea?
Sample output:
But though the picture lies thus tranced, and though this pine-tree shakes down its sighs like leaves upon this shepherds head, yet all were vain, unless the shepherds eye were fixed upon the magic stream before him.
Go visit the Prairies in June, when for scores on scores of miles you wade knee-deep among Tiger-lilieswhat is the one charm wanting?
Waterthere is not a drop of water there!
Were Niagara but a cataract of sand, would you travel your thousand miles to see it?
Why did the poor poet of Tennessee, upon suddenly receiving two handfuls of silver, deliberate whether to buy him a coat, which he sadly needed, or invest his money in a pedestrian trip to Rockaway Beach?
Why is almost every robust healthy boy with a robust healthy soul in him, at some time or other crazy to go to sea?
below is the text file to read in
Assign2q2.txt
Haruki Murakami. Men without Women . Trans. Philip Gabriel &Ted Goossen. New York. Knopf. 2017. 227 pages.
Men without Women comprises seven short stories, four of which have appeared in other publications. All display elements of Haruki Murakami's fiction that readers have come to expect: magical realism, the Beatles, cats and jazz, and abrupt endings without easy resolution. We come to realize this last element is entirely appropriate precisely because there is no pat answer, no comfortable place, no way to tie up loose ends for the protagonists of these tales who, as the title notes, are missing an important woman. The parameters of this lack differ, of course, and the degree to which we can sympathize will likewise vary, but the emotional complications of that lack are something most readers will understand and appreciate at a visceral level, even if the tale seems beyond comfortable comprehension.
Three of the stories are particularly effective. "Samsa in Love" is a playful reversal of Franz Kafka's "The Metamorphosis." Here, Gregor the cockroach wakes up to find he is human, and his first interaction is with a hunchbacked woman who is convinced he is slow and only interested in her for kinky sex. Like Gregor, we know nothing but the realities of the moment. "Scheherazade" is the most unsettling work in the collection. Here, Murakami is at his best, probing the seemingly unfathomable reasons for connection while asking of the reader a degree of indulgence and understanding of what it means to be needy and the lengths one might go to satisfy those desires. Finally, "Kino" raises far more narrative questions than it answers before sinking almost languidly into a surrealistic pool of self-questioning that also appears to offer an answer only to pull it away at the last moment. This instability powerfully conveys the force of the protagonist's loss.
Despite the generally engaging nature of these seven vignettes, however, it was with some disappointment that I put the book down, for I could not help feeling that Murakami had been unable to go beyond his previous work. The specific contexts are new, and a different problem is the focus, but the stories feel overly familiar, as if we have read them before. Die-hard Murakami fans will welcome them, and readers new to Murakami will discover why he is internationally renowned. Those hoping for something truly fresh may very well experience a sense of emptiness ... as do the men without women.
Erik R. Lofgren
Bucknell University
Step 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