minhahwang commited on
Commit
ed5026f
·
1 Parent(s): 550031e

Add story downloader, cleaner, and 10 TTS-ready children's stories

Browse files

- gutenberg_downloader.py: reusable Project Gutenberg downloader/parser
- download_stories.py: downloads 10 public domain children's stories
- clean_stories.py: strips Gutenberg boilerplate for clean TTS input
- 10 cleaned stories (691-2912 words each): Beatrix Potter, fairy tales
- .gitignore: exclude __pycache__

.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__/
stories/The_Adventures_of_Puss_in_Boots.txt ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Adventures of Puss in Boots
2
+
3
+ There once liv'd a young man who was very poor.
4
+ For all that he had was a Cat;
5
+ His food being gone, he could get no more,
6
+ And so he resolv'd to kill that.
7
+
8
+ Now Puss from the cupboard came out and thus spoke,
9
+ "Grieve not my good master, I pray,
10
+ Provide me with boots, and a bag--'tis no joke--
11
+ Your fortune I'll make then straightway."
12
+
13
+
14
+ Puss baited his bag with parsley and bread,
15
+ And away to a warren he hied,
16
+ Where he laid himself down as if he was dead,
17
+ Until some young rabbits he spied.
18
+
19
+ One entered the bag, puss pull'd at the string,
20
+ The rabbit was kill'd in a trice,
21
+ Puss said this fine game I'll take to the king,
22
+ I'm sure he will say it is nice.
23
+
24
+
25
+ Next day to a wheat-field Grimalkin repair'd,
26
+ And there two fine partridges caught,
27
+ These he took to the king who kindly enquired,
28
+ From whence the fine present was brought.
29
+
30
+ "From the Marquis Carabas, great Monarch," said he,
31
+ "These birds and the rabbit I bring,"
32
+ They both were accepted, and puss in high glee
33
+ Receiv'd a reward from the king.
34
+
35
+
36
+ This king took a journey, his kingdom to view,
37
+ With his daughter so fine and so gay,
38
+ What happen'd then, I will now tell unto you,
39
+ To my tale therefore listen I pray.
40
+
41
+ Puss ran to a cornfield, to the reapers he said,
42
+ "When the king comes these words you repeat,
43
+ 'To the Marquis Carabas these fields all belong,
44
+ Or I'll chop you as small as minced meat.'"
45
+
46
+
47
+ To an Ogre's grand castle grimalkin now went,
48
+ Which was opened by servants so gay,
49
+ 'Is his highness the Ogre at home sir,' said he,
50
+ 'For my bus'ness is urgent to-day.'
51
+
52
+ The Ogre received him with kindness, and now,
53
+ Puss entr'd the castle so gay,
54
+ When making a low and reverend bow,
55
+ He march'd to the parlour straightway.
56
+
57
+
58
+ 'Tis thought mighty Ogre by all in the nation,
59
+ That miraculous power you possess,
60
+ The power, when you please, of complete transformation,
61
+ This a miracle is and no less.
62
+
63
+ To convince you 'tis true, the Ogre replied,
64
+ I will change myself now in your sight:
65
+ He did so--a lion he now roars by his side,
66
+ Which put the poor cat in a fright.
67
+
68
+
69
+ "Mighty sir," said the Cat, "such a change I must say,
70
+ I never expected to view:
71
+ Yet I venture to doubt--your pardon I pray,
72
+ If a mouse you could change yourself to."
73
+
74
+ Doubt not, said the Ogre, my power to do so,
75
+ When a mouse he directly became,
76
+ On his victim Grimalkin immediately flew,
77
+ And sealed in an instant his doom.
78
+
79
+
80
+ The king and princess now arriv'd at the place,
81
+ But Puss who had travell'd much faster,
82
+ Came out and invited them in with much grace,
83
+ In the name of the Marquis, his master.
84
+
85
+ In a spacious saloon, they sat themselves down,
86
+ Where a banquet was already spread,
87
+ And that day, "PUSS IN BOOTS" gain'd greater renown,
88
+ For the marquis and princess were wed.
stories/The_History_of_Tom_Thumb.txt ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The History of Tom Thumb
2
+
3
+ It is said that in the days of the famed Prince Arthur, who was king of
4
+ Britain, in the year 516, there lived a great magician, called Merlin,
5
+ the most learned and skilful enchanter in the world at that time.
6
+
7
+ This great magician, who could assume any form he pleased, was
8
+ travelling in the disguise of a poor beggar, and being very much
9
+ fatigued, he stopped at the cottage of an honest ploughman to rest
10
+ himself, and asked for some refreshment.
11
+
12
+ The countryman gave him a hearty welcome, and his wife, who was a very
13
+ good-hearted, hospital woman, soon brought him some milk in a wooden
14
+ bowl, an some coarse brown bread on a platter.
15
+
16
+ Merlin was much pleased with this homely repast and the kindness of
17
+ the ploughman and his wife; but he could not help seeing that though
18
+ everything was neat and comfortable in the cottage, they seemed both
19
+ be sad and much cast down. He therefore questioned them on the cause
20
+ of their sadness, and learned they were miserable because they had no
21
+ children.
22
+
23
+ The poor woman declared, with tears in her eyes, that she should be the
24
+ happiest creature in the world if she had a son; and although he was no
25
+ bigger than her husband's thumb, she would be satisfied.
26
+
27
+ Merlin was so much amused with the idea of a boy no bigger than a man's
28
+ thumb, that he made up his mind to pay a visit to the queen of the
29
+ fairies, and ask her to grant the poor woman's wish. The droll fancy of
30
+ such a little person among the human race pleased the fairy queen
31
+ too, greatly, and she promised Merlin that the wish should be granted.
32
+ Accordingly, a short time after, the ploughman's wife had a son, who,
33
+ wonderful to relate! was not bigger than his father's thumb.
34
+
35
+ The fairy queen, wishing to see the little fellow thus born into the
36
+ world, came in at the window while the mother was sitting up in bed
37
+ admiring him. The queen kissed the child, and, giving it the name of Tom
38
+ Thumb, sent for some of the fairies, who dressed her little favorite as
39
+ she bade them.
40
+
41
+ "An oak-leaf hat he had for his crown;
42
+ His shirt of web by spiders spun;
43
+ With jacket wove of thistle's down;
44
+ His trowsers were of feathers done.
45
+
46
+ His stockings, of apple-rind they tie
47
+ With eyelash from his mother's eye:
48
+ His shoes were made of mouse's skin
49
+ Tann'd with the downy hair within."
50
+
51
+ It is remarkable that Tom never grew any larger than his father's thumb,
52
+ which was only of an ordinary size; but as he got older he became very
53
+ cunning and full of tricks. When he was old enough to play with the
54
+ boys, and had lost all his own cherry-stones, he used to creep into
55
+ the bags of his playfellows, fill his pockets, and, getting out unseen,
56
+ would again join in the game.
57
+
58
+ One day, however, as he was coming out of a bag of cherrystones, where
59
+ he had been pilfering as usual, the boy to whom it belonged chanced to
60
+ see him. "Ah, ha! my little Tommy," said the boy, "so I have caught you
61
+ stealing my cherrystones at last, and you shall be rewarded for your
62
+ thievish tricks." On saying this, he drew the string tight around his
63
+ neck, and gave the bag such a hearty shake, that poor little Tom's legs,
64
+ thighs, and body were sadly bruised. He roared out in pain, and begged
65
+ to be let out, promising never to be guilty of such bad practices again.
66
+
67
+ A short time afterwards his mother was making a batter-pudding, and Tom
68
+ being very anxious to see how it was made, climbed up to the edge of the
69
+ bowl; but unfortunately his foot slipped and he plumped over head and
70
+ ears into the batter, unseen by his mother, who stirred him into the
71
+ pudding-bag, and put him in the pot to boil.
72
+
73
+ The batter had filled Tom's mouth, and prevented him from crying; but,
74
+ on feeling the hot water, he kicked and struggled so much in the pot,
75
+ that his mother thought that the pudding was bewitched, and, instantly
76
+ pulling it out of the pot, she threw it to the door. A poor tinker, who
77
+ was passing by, lifted up the pudding, and, putting it into his budget,
78
+ he then walked off. As Tom had now got his mouth cleared of the batter,
79
+ he then began to cry aloud, which so frightened the tinker that he flung
80
+ down the pudding and ran away. The pudding being broke to pieces by the
81
+ fall, Tom crept out covered over with the batter, and with difficulty
82
+ walked home. His mother, who was very sorry to see her darling in such
83
+ a woeful state, put him into a tea-cup, and soon washed off the batter;
84
+ after which she kissed him, and laid him in bed.
85
+
86
+ Soon after the adventure of the pudding, Tom's mother went to milk her
87
+ cow in the meadow, and she took him along with her. As the wind was very
88
+ high, fearing lest he should be blown away, she tied him to a thistle
89
+ with a piece of fine thread. The cow soon saw the oak-leaf hat, and,
90
+ liking the look of it, took poor Tom and the thistle at one mouthful.
91
+ While the cow was chewing the thistle Tom was afraid of her great teeth,
92
+ which threatened to crush him in pieces, and he roared out as loud as he
93
+ could:
94
+
95
+ "Mother, mother!"
96
+
97
+ "Where are you, Tommy, my dear Tommy?" said his mother.
98
+
99
+ "Here, mother," replied he, "in the red cow's mouth."
100
+
101
+ His mother began to cry and wring her hands; but the cow, surprised
102
+ at the odd noise in her throat, opened her mouth and let Tom drop out.
103
+ Fortunately his mother caught him in her apron as he was falling to the
104
+ ground, or he would have been dreadfully hurt. She then put Tom in her
105
+ bosom and ran home with him.
106
+
107
+ Tom's father made him a whip of barley straw to drive the cattle with,
108
+ and having one day gone into the fields, he slipped a foot and rolled
109
+ into the furrow. A raven, which was flying over, picked him up and flew
110
+ with him to the top of a giant's castle that was near the seaside, and
111
+ there left him.
112
+
113
+ Tom was in a dreadful state, and did not know what to do; but he was
114
+ soon more dreadfully frightened; for old Grumbo, the giant, came up to
115
+ walk on the terrace, and seeing Tom, he took him up and swallowed him
116
+ like a pill.
117
+
118
+ The giant had no sooner swallowed Tom than he began to repent what he
119
+ had done; for Tom began to kick and jump about so much that he felt very
120
+ uncomfortable, and at last threw him up again into the sea. A large
121
+ fish swallowed Tom the moment he fell into the sea, which was soon after
122
+ caught, and bought for the table of King Arthur. When they opened the
123
+ fish in order to cook it, every on was astonished at finding such a
124
+ little boy, and Tom was quite delighted to be out again. They carried
125
+ him to the king, who made Tom his dwarf, and he soon grew a great
126
+ favorite at court: for by his tricks and gambols he not only amused the
127
+ king and queen, but also all the knights of the Round Table.
128
+
129
+ It is said that when the kind rode out on horseback he often took
130
+ Tom along with him, and if a shower came on he used to creep into his
131
+ majesty's waistcoat pocket, where he slept till the rain was over.
132
+
133
+ King Arthur one day asked Tom about his parents, wishing to know if they
134
+ were as small as he was, and whether rich or poor. Tom told the king
135
+ that his father and mother were as tall as any of the persons about
136
+ the court, but rather poor. On hearing this the king carried Tom to the
137
+ treasure, the place where he kept all his money, and told him to take
138
+ as much money as he could carry home to his parents, which made the poor
139
+ little fellow caper with joy. Tom went immediately to fetch a purse,
140
+ which was made of a water-bubble, and then returned to the treasury,
141
+ where he got a silver three-penny-piece to put into it.
142
+
143
+ Our little hero had some trouble in lifting the burden upon his back;
144
+ but he at last succeeded in getting it placed to his mind, and set
145
+ forward on his journey. However, without meeting with any accidents, and
146
+ after resting himself more than a hundred times by the way, in two days
147
+ and two nights he reached his father's house in safety.
148
+
149
+ Tom had travelled forty-eight hours with a huge silver-piece on his
150
+ back, and was almost tired to death, when his mother ran out to meet
151
+ him, and carried him into the house.
152
+
153
+ Tom's parents were both happy to see him, and the more so as he had
154
+ brought such an amazing sum of money with him; but the poor little
155
+ fellow was excessively wearied, having travelled half a mile in
156
+ forty-eight hours, with a huge silver three-penny-piece on his back.
157
+ His mother, in order to recover him, placed him in a walnut shell by the
158
+ fireside, and feasted him for three days on a hazel nut, which made him
159
+ very sick; for a whole nut used to serve him a month.
160
+
161
+ Tom was soon well again; but as there had been a fall of rain, and the
162
+ ground was very wet, he could not travel back to King Arthur's court;
163
+ therefore his mother, one day when the wind was blowing in that
164
+ direction, made a little parasol of cambric paper, and tying Tom to it,
165
+ she gave him a puff into the air with her mouth, which soon carried him
166
+ to the king's palace.
167
+
168
+ Just at the time when Tom came flying across the courtyard, the cook
169
+ happened to be passing with the king's great bowl of furmenty, which was
170
+ a dish his majesty was very fond of; but unfortunately the poor little
171
+ fellow fell plump into the middle of it, and splashed the hot furmenty
172
+ about the cook's face.
173
+
174
+ The cook, who was an ill-natured fellow, being in a terrible rage at Tom
175
+ for frightening and scalding him with the furmenty, went straight to the
176
+ king, and said that Tom had jumped into the royal furmenty, and thrown
177
+ it down out of mere mischief. The king was so enraged when he heard
178
+ this, that he ordered Tom to be seized and tried for high treason; and
179
+ there being no person who dared to plead for him, he was condemned to be
180
+ beheaded immediately.
181
+
182
+ On hearing this dreadful sentence pronounced, poor Tom fell a-trembling
183
+ with fear, but, seeing no means of escape, and observing a miller close
184
+ to him gaping with his great mouth, as country boobies do at a far, he
185
+ took a leap, and fairly jumped down his throat. This exploit was done
186
+ with such activity that not one person present saw it, and even the
187
+ miller did not know the trick which Tom had played upon him. Now, as
188
+ Tom had disappeared, the court broke up, and the miller went home to his
189
+ mill.
190
+
191
+ When Tom heard the mill at work he knew he was clear of the court, and
192
+ therefore he began to tumble and roll about, so that the poor miller
193
+ could get no rest, thinking he was bewitched; so he sent for a doctor.
194
+ When the doctor came, Tom began to dance and sing; and the doctor, being
195
+ as much frightened as the miller, sent in haste for five other doctors
196
+ and twenty learned men.
197
+
198
+ When they were debating about this extraordinary case, the miller
199
+ happened to yawn, when Tom, seizing the chance, made another jump, and
200
+ alighted safely upon his feet in the middle of the table.
201
+
202
+ The miller, who was very much provoked at being tormented by such a
203
+ little pygmy creature, fell into a terrible rage, and, laying hold of
204
+ Tom, ran to the king with him; but his majesty, being engaged with state
205
+ affairs, ordered him to be taken away and kept in custody till he sent
206
+ for him.
207
+
208
+ The cook was determined that Tom should not slip out of his hands this
209
+ time, so he put him into a mouse-trap, and left him to peep through the
210
+ wires. Tom had remained in the trap a whole week, when he was sent for
211
+ by King Arthur, who pardoned him for throwing down the furmenty,
212
+ and took him again into favor. On account of his wonderful feats of
213
+ activity, Tom was knighted by the king, and went under the name of the
214
+ renowned Sir Thomas Thumb. As Tom's clothes had suffered much in the
215
+ batter-pudding, the furmenty, and the insides of the giant, miller, and
216
+ fishes, his majesty ordered him a new suit of clothes, and to be mounted
217
+ as a knight.
218
+
219
+ "Of Butterfly's wings his shirt was made,
220
+ His boots of chicken's hide;
221
+ And by a nimble fairy blade,
222
+ Well learned in the tailoring trade,
223
+
224
+ His clothing was supplied.--
225
+ A needle dangled by his side;
226
+ A dapper mouse he used to ride,
227
+ Thus strutted Tom in stately pride!"
228
+
229
+ It was certainly very diverting to see Tom in this dress, and
230
+ mounted on the mouse, as he rode out a-hunting with the king and
231
+ nobility, who were all ready to expire with laughter at Tom and his fine
232
+ prancing charger.
233
+
234
+ One day, as they were riding by a farmhouse, a large cat, which was
235
+ lurking about the door, made a spring, and seized both Tom and his
236
+ mouse. She then ran up a tree with them, and was beginning to devour the
237
+ mouse; but Tom boldly drew his sword, and attacked the cat so fiercely
238
+ that she let them both fall, when one of the nobles caught him in his
239
+ hat, and laid him on a bed of down, in a little ivory cabinet.
240
+
241
+ The queen of fairies came soon after to pay Tom a visit, and carried him
242
+ back to Fairy-land, where he lived several years. During his residence
243
+ there, King Arthur, and all the persons who knew Tom, had died; and as
244
+ he was desirous of being again at court, the fairy queen, after dressing
245
+ him in a suit of clothes, sent him flying through the air to the palace,
246
+ in the days of king Thunstone, the successor of Arthur. Every one
247
+ flocked round to see him, and being carried to the king, he was asked
248
+ who he was--whence he came--and where he lived? Tom answered:
249
+
250
+ "My name is Tom Thumb,
251
+ From the fairies I've come.
252
+ When King Arthur shone,
253
+ His court was my home.
254
+ In me he delighted,
255
+ By him I was knighted;
256
+ Did you never hear of Sir Thomas Thumb?"
257
+
258
+ The king was so charmed with this address that he ordered a little
259
+ chair to be made, in order that Tom might sit upon his table, and also
260
+ a palace of gold, a span high, with a door an inch wide, to live in. He
261
+ also gave him a coach, drawn by six small mice.
262
+
263
+ The queen was so enraged at the honor paid to Sir Thomas that she
264
+ resolved to ruin him, and told the king that the little knight had been
265
+ saucy to her.
266
+
267
+ The king sent for Tom in great haste, but being fully aware of the
268
+ danger of royal anger, he crept into an empty snail-shell, where he lay
269
+ for a long time, until he was almost starved with hunger; but at last he
270
+ ventured to peep out, and seeing a fine large butterfly on the ground,
271
+ near his hiding-place, he approached very cautiously, and getting
272
+ himself placed astride on it, was immediately carried up into the air.
273
+ The butterfly flew with him from tree to tree and from field to field,
274
+ and at last returned to the court, where the king and nobility all
275
+ strove to catch him; but at last poor Tom fell from his seat into a
276
+ watering-pot, in which he was almost drowned.
277
+
278
+ When the queen saw him she was in a rage, and said he should be
279
+ beheaded; and he was again put into a mouse-trap until the time of his
280
+ execution.
281
+
282
+ However, a cat, observing something alive in the trap, patted it about
283
+ till the wires broke, and set Thomas at liberty.
284
+
285
+ The king received Tom again into favor, which he did not live to enjoy,
286
+ for a large spider one day attacked him; and although he drew his sword
287
+ and fought well, yet the spider's poisonous breath at last overcame him;
288
+
289
+ "He fell dead on the ground where he stood,
290
+ and the spider suck'd every drop of his blood."
291
+
292
+ King Thunstone and his whole court were so sorry at the loss of their
293
+ little favorite, that they went into mourning, and raised a fine white
294
+ marble monument over his grave, with the following epitaph:
295
+
296
+ "Here lyes Tom Thumb, King Arthur's knight,
297
+ Who died by a spider's cruel bite.
298
+ He was well known in Arthur's court,
299
+ Where he afforded gallant sport;
300
+ He rode at tilt and tournament,
301
+ And on a mouse a-hunting went.
302
+ Alive he filled the court with mirth;
303
+ His death to sorrow soon gave birth.
304
+ Wipe, wipe your eyes, and shake your head,
305
+ And cry,--Alas! Tom Thumb is dead!"
stories/The_Little_Gingerbread_Man.txt ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Little Gingerbread Man
2
+
3
+ One day, the cook went into the kitchen to make some gingerbread.
4
+ She took some flour and water, and treacle and ginger, and mixed
5
+ them all well together, and she put in some more water to make it
6
+ thin, and then some more flour to make it thick, and a little salt
7
+ and some spice, and then she rolled it out into a beautiful,
8
+ smooth, dark-yellow dough.
9
+
10
+ Then she took the square tins and cut out some square cakes for the
11
+ little boys, and with some round tins she cut out some round cakes
12
+ for the little girls, and then she said, "I'm going to make a
13
+ little gingerbread man for little Bobby." So she took a nice round
14
+ lump of dough for his body, and a smaller lump for his head, which
15
+ she pulled out a little for the neck. Two other lumps were stuck on
16
+ beneath for the legs, and were pulled out into proper shape, with
17
+ feet and toes all complete, and two still smaller pieces were made
18
+ into arms, with dear little hands and fingers.
19
+
20
+
21
+ But the nicest work was done on the head, for the top was frizzed
22
+ up into a pretty sugary hat; on either side was made a dear little
23
+ ear, and in front, after the nose had been carefully moulded, a
24
+ beautiful mouth was made out of a big raisin, and two bright little
25
+ eyes with burnt almonds and caraway seeds.
26
+
27
+ Then the gingerbread man was finished ready for baking, and a very
28
+ jolly little man he was. In fact, he looked so sly that the cook
29
+ was afraid he was plotting some mischief, and when the batter was
30
+ ready for the oven, she put in the square cakes and she put in the
31
+ round cakes; and then she put in the little gingerbread man in a
32
+ far back corner, where he couldn't get away in a hurry.
33
+
34
+
35
+ Then she went up to sweep the parlor, and she swept and she swept
36
+ till the clock struck twelve, when she dropped her broom in a
37
+ hurry, and exclaiming, "Lawks! the gingerbread will be all baked to
38
+ a cinder," she ran down into the kitchen, and threw open the oven
39
+ door. And the square cakes were all done, nice and hard and brown,
40
+ and the round cakes were all done, nice and hard and brown, and the
41
+ gingerbread man was all done too, nice and hard and brown; and he
42
+ was standing up in his corner, with his little caraway-seed eyes
43
+ sparkling, and his raisin mouth bubbling over with mischief, while
44
+ he waited for the oven door to be opened. The instant the door was
45
+ opened, with a hop, skip, and a jump, he went right over the square
46
+ cakes and the round cakes, and over the cook's arm, and before she
47
+ could say "Jack Robinson" he was running across the kitchen floor,
48
+ as fast as his little legs would carry him, towards the back door,
49
+ which was standing wide open, and through which he could see the
50
+ garden path.
51
+
52
+
53
+ The old cook turned round as fast as she could, which wasn't very
54
+ fast, for she was rather a heavy woman and she had been quite taken
55
+ by surprise, and she saw lying right across the door-way, fast
56
+ asleep in the sun, old Mouser, the cat.
57
+
58
+
59
+ "Mouser, Mouser," she cried, "stop the gingerbread man! I want him
60
+ for little Bobby." When the cook first called, Mouser thought it
61
+ was only some one calling in her dreams, and simply rolled over
62
+ lazily; and the cook called again, "Mouser, Mouser!" The old cat
63
+ sprang up with a jump, but just as she turned round to ask the cook
64
+ what all the noise was about, the little gingerbread man cleverly
65
+ jumped under her tail, and in an instant was trotting down the
66
+ garden walk. Mouser turned in a hurry and ran after, although she
67
+ was still rather too sleepy to know what it was she was trying to
68
+ catch, and after the cat came the cook, lumbering along rather
69
+ heavily, but also making pretty good speed.
70
+
71
+
72
+ Now at the bottom of the walk, lying fast asleep in the sun against
73
+ the warm stones of the garden wall, was Towser, the dog.
74
+
75
+ And the cook called out: "Towser, Towser, stop the gingerbread man!
76
+ I want him for little Bobby."
77
+
78
+ And when Towser first heard her calling he thought it was some one
79
+ speaking in his dreams, and he only turned over on his side, with
80
+ another snore, and then the cook called again, "Towser, Towser,
81
+ stop him, stop him!"
82
+
83
+ Then the dog woke up in good earnest, and jumped up on his feet to
84
+ see what it was that he should stop. But just as the dog jumped up,
85
+ the little gingerbread man, who had been watching for the chance,
86
+ quietly slipped between his legs, and climbed up on the top of the
87
+ stone wall, so that Towser saw nothing but the cat running towards
88
+ him down the walk, and behind the cat the cook, now quite out of
89
+ breath.
90
+
91
+
92
+ He thought at once that the cat must have stolen something, and
93
+ that it was the cat the cook wanted him to stop. Now, if there was
94
+ anything that Towser liked, it was going after the cat, and he
95
+ jumped up the walk so fiercely that the poor cat did not have time
96
+ to stop herself or to get out of his way, and they came together
97
+ with a great fizzing, and barking, and meowing, and howling, and
98
+ scratching, and biting, as if a couple of Catherine-wheels had gone
99
+ off in the wrong way and had got mixed up with one another.
100
+
101
+
102
+ But the old cook had been running so hard that she was not able to
103
+ stop herself any better than the cat had done, and she fell right
104
+ on top of the mixed up dog and cat, so that all three rolled over
105
+ on the walk in a heap together.
106
+
107
+ And the cat scratched whichever came nearest, whether it was a
108
+ piece of the dog or of the cook, and the dog bit at whatever came
109
+ nearest, whether it was a piece of the cat or of the cook, so that
110
+ the poor cook was badly pummelled on both sides.
111
+
112
+
113
+ Meanwhile, the gingerbread man had climbed up on the garden wall,
114
+ and stood on the top with his hands in his pockets, looking at the
115
+ scrimmage, and laughing till the tears ran down from his little
116
+ caraway-seed eyes and his raisin mouth was bubbling all over with
117
+ fun.
118
+
119
+
120
+ After a little while, the cat managed to pull herself out
121
+ from under the cook and the dog, and a very cast-down and
122
+ crumpled-up-looking cat she was. She had had enough of hunting
123
+ gingerbread men, and she crept back to the kitchen to repair
124
+ damages.
125
+
126
+
127
+ The dog, who was very cross because his face had been badly
128
+ scratched, let go of the cook, and at last, catching sight of the
129
+ gingerbread man, made a bolt for the garden wall. The cook picked
130
+ herself up, and although her face was also badly scratched and her
131
+ dress was torn, she was determined to see the end of the chase, and
132
+ she followed after the dog, though this time more slowly.
133
+
134
+
135
+ When the gingerbread man saw the dog coming, he jumped down on the
136
+ farther side of the wall, and began running across the field. Now
137
+ in the middle of the field was a tree, and at the foot of the tree
138
+ was lying Jocko, the monkey. He wasn't asleep--monkeys never
139
+ are--and when he saw the little man running across the field and
140
+ heard the cook calling, "Jocko, Jocko, stop the gingerbread man,"
141
+ he at once gave one big jump. But he jumped so fast and so far that
142
+ he went right over the gingerbread man, and as luck would have it,
143
+ he came down on the back of Towser, the dog, who had just scrambled
144
+ over the wall, and whom he had not before noticed. Towser was
145
+ naturally taken by surprise, but he turned his head around and
146
+ promptly bit off the end of the monkey's tail, and Jocko quickly
147
+ jumped off again, chattering his indignation.
148
+
149
+
150
+ Meanwhile, the gingerbread man had got to the bottom of the tree,
151
+ and was saying to himself: "Now, I know the dog can't climb a tree,
152
+ and I don't believe the old cook can climb a tree; and as for the
153
+ monkey I'm not sure, for I've never seen a monkey before, but I am
154
+ going up."
155
+
156
+ So he pulled himself up hand over hand until he had got to the
157
+ topmost branch.
158
+
159
+ But the monkey had jumped with one spring onto the lowest branch,
160
+ and in an instant he also was at the top of the tree.
161
+
162
+ The gingerbread man crawled out to the furthermost end of the
163
+ branch, and hung by one hand, but the monkey swung himself under
164
+ the branch, and stretching out his long arm, he pulled the
165
+ gingerbread man in. Then he held him up and looked at him so
166
+ hungrily that the little raisin mouth began to pucker down at the
167
+ corners, and the caraway-seed eyes filled with tears.
168
+
169
+
170
+ And then what do you think happened? Why, little Bobby himself came
171
+ running up. He had been taking his noon-day nap upstairs, and in
172
+ his dreams it seemed as if he kept hearing people call "Little
173
+ Bobby, little Bobby!" until finally he jumped up with a start, and
174
+ was so sure that some one was calling him that he ran down-stairs,
175
+ without even waiting to put on his shoes.
176
+
177
+
178
+ As he came down, he could see through the window in the field
179
+ beyond the garden the cook, and the dog, and the monkey, and could
180
+ even hear the barking of Towser and the chattering of Jocko. He
181
+ scampered down the walk, with his little bare feet pattering
182
+ against the warm gravel, climbed over the wall, and in a few
183
+ seconds arrived under the tree, just as Jocko was holding up the
184
+ poor little gingerbread man.
185
+
186
+
187
+ "Drop it, Jocko!" cried Bobby, and drop it Jocko did, for he always
188
+ had to mind Bobby. He dropped it so straight that the gingerbread
189
+ man fell right into Bobby's uplifted pinafore.
190
+
191
+ Then Bobby held him up and looked at him, and the little raisin
192
+ mouth puckered down lower than ever, and the tears ran right out of
193
+ the caraway-seed eyes.
194
+
195
+ But Bobby was too hungry to mind gingerbread tears, and he gave one
196
+ big bite, and swallowed down both legs and a piece of the body.
197
+
198
+
199
+ "OH!" said the gingerbread man, "I'M ONE-THIRD GONE!"
200
+
201
+ Bobby gave a second bite, and swallowed the rest of the body and
202
+ the arms.
203
+
204
+
205
+ "OH!" said the gingerbread man, "I'M TWO-THIRDS GONE!"
206
+
207
+ Bobby gave a third bite, and gulped down the head.
208
+
209
+ "Oh!" said the gingerbread man, "I'm all gone!"
210
+
211
+ And so he was--and that is the end of the story.
stories/The_Little_Red_Hen.txt ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Little Red Hen
2
+
3
+ A Little Red Hen lived in a barnyard. She spent almost all of her time
4
+ walking about the barnyard in her picketty-pecketty fashion,
5
+ scratching everywhere for worms.
6
+
7
+
8
+ She dearly loved fat, delicious worms and felt they were absolutely
9
+ necessary to the health of her children. As often as she found a worm
10
+ she would call "Chuck-chuck-chuck!" to her chickies.
11
+
12
+
13
+ When they were gathered about her, she would distribute choice morsels
14
+ of her tid-bit. A busy little body was she!
15
+
16
+
17
+ A cat usually napped lazily in the barn door, not even bothering
18
+ herself to scare the rat who ran here and there as he pleased. And as
19
+ for the pig who lived in the sty--he did not care what happened so
20
+ long as he could eat and grow fat.
21
+
22
+
23
+ One day the Little Red Hen found a Seed. It was a Wheat Seed, but the
24
+ Little Red Hen was so accustomed to bugs and worms that she supposed
25
+ this to be some new and perhaps very delicious kind of meat. She bit
26
+ it gently and found that it resembled a worm in no way whatsoever as
27
+ to taste although because it was long and slender, a Little Red Hen
28
+ might easily be fooled by its appearance.
29
+
30
+
31
+ Carrying it about, she made many inquiries as to what it might be. She
32
+ found it was a Wheat Seed and that, if planted, it would grow up and
33
+ when ripe it could be made into flour and then into bread.
34
+
35
+
36
+ When she discovered that, she knew it ought to be planted. She was so
37
+ busy hunting food for herself and her family that, naturally, she
38
+ thought she ought not to take time to plant it.
39
+
40
+
41
+ So she thought of the Pig--upon whom time must hang heavily and of the
42
+ Cat who had nothing to do, and of the great fat Rat with his idle
43
+ hours, and she called loudly:
44
+
45
+
46
+ "Who will plant the Seed?"
47
+
48
+
49
+ But the Pig said, "Not I," and the Cat said, "Not I," and the Rat
50
+ said, "Not I."
51
+
52
+
53
+ "Well, then," said the Little Red Hen, "I will."
54
+
55
+ And she did.
56
+
57
+
58
+ Then she went on with her daily duties through the long summer days,
59
+ scratching for worms and feeding her chicks, while the Pig grew fat,
60
+ and the Cat grew fat, and the Rat grew fat, and the Wheat grew tall
61
+ and ready for harvest.
62
+
63
+
64
+ So one day the Little Red Hen chanced to notice how large the Wheat
65
+ was and that the grain was ripe, so she ran about calling briskly:
66
+ "Who will cut the Wheat?"
67
+
68
+ The Pig said, "Not I," the Cat said, "Not I," and the Rat said, "Not
69
+ I."
70
+
71
+
72
+ "Well, then," said the Little Red Hen, "I will."
73
+
74
+ And she did.
75
+
76
+
77
+ She got the sickle from among the farmer's tools in the barn and
78
+ proceeded to cut off all of the big plant of Wheat.
79
+
80
+ On the ground lay the nicely cut Wheat, ready to be gathered and
81
+ threshed, but the newest and yellowest and downiest of Mrs. Hen's
82
+ chicks set up a "peep-peep-peeping" in their most vigorous fashion,
83
+ proclaiming to the world at large, but most particularly to their
84
+ mother, that she was neglecting them.
85
+
86
+
87
+ Poor Little Red Hen! She felt quite bewildered and hardly knew where
88
+ to turn.
89
+
90
+ Her attention was sorely divided between her duty to her children and
91
+ her duty to the Wheat, for which she felt responsible.
92
+
93
+ So, again, in a very hopeful tone, she called out, "Who will thresh
94
+ the Wheat?"
95
+
96
+ But the Pig, with a grunt, said, "Not I,"
97
+ and the Cat, with a meow, said, "Not I," and
98
+ the Rat, with a squeak, said, "Not I."
99
+
100
+ So the Little Red Hen, looking, it must be admitted, rather
101
+ discouraged, said, "Well, I will, then."
102
+
103
+ And she did.
104
+
105
+ Of course, she had to feed her babies first, though, and when she had
106
+ gotten them all to sleep for their afternoon nap, she went out and
107
+ threshed the Wheat. Then she called out: "Who will carry the Wheat to
108
+ the mill to be ground?"
109
+
110
+
111
+ Turning their backs with snippy glee,
112
+ that Pig said, "Not I,"
113
+
114
+
115
+ and that Cat said, "Not I," and that Rat said, "Not I."
116
+
117
+
118
+ So the good Little Red Hen could do nothing but say, "I will then."
119
+ And she did.
120
+
121
+ Carrying the sack of Wheat, she trudged off to the distant mill. There
122
+ she ordered the Wheat ground into beautiful white flour. When the
123
+ miller brought her the flour she walked slowly back all the way to her
124
+ own barnyard in her own picketty-pecketty fashion.
125
+
126
+
127
+ She even managed, in spite of her load, to catch a nice juicy worm now
128
+ and then and had one left for the babies when she reached them. Those
129
+ cunning little fluff-balls were so glad to see their mother. For the
130
+ first time, they really appreciated her.
131
+
132
+
133
+ After this really strenuous day Mrs. Hen retired to her slumbers
134
+ earlier than usual--indeed, before the colors came into the sky to
135
+ herald the setting of the sun, her usual bedtime hour.
136
+
137
+ She would have liked to sleep late in the morning, but her chicks,
138
+ joining in the morning chorus of the hen yard, drove away all hopes of
139
+ such a luxury.
140
+
141
+ Even as she sleepily half opened one eye, the thought came to her that
142
+ to-day that Wheat must, somehow, be made into bread.
143
+
144
+
145
+ She was not in the habit of making bread, although, of course, anyone
146
+ can make it if he or she follows the recipe with care, and she knew
147
+ perfectly well that she could do it if necessary.
148
+
149
+ So after her children were fed and made sweet and fresh for the day,
150
+ she hunted up the Pig, the Cat and the Rat.
151
+
152
+
153
+ Still confident that they would surely help her some day she sang out,
154
+ "Who will make the bread?"
155
+
156
+
157
+ Alas for the Little Red Hen! Once more her hopes were dashed! For the
158
+ Pig said, "Not I,"
159
+
160
+
161
+ the Cat said, "Not I," and the Rat said, "Not I."
162
+
163
+
164
+ So the Little Red Hen said once more, "I will then," and she did.
165
+
166
+ Feeling that she might have known all the time that she would have to
167
+ do it all herself, she went and put on a fresh apron and spotless
168
+ cook's cap. First of all she set the dough, as was proper. When it was
169
+ time she brought out the moulding board and the baking tins, moulded
170
+ the bread, divided it into loaves, and put them into the oven to bake.
171
+ All the while the Cat sat lazily by, giggling and chuckling.
172
+
173
+
174
+ And close at hand the vain Rat powdered his nose and admired himself
175
+ in a mirror.
176
+
177
+
178
+ In the distance could be heard the long-drawn snores of the dozing
179
+ Pig.
180
+
181
+
182
+ At last the great moment arrived. A delicious odor was wafted upon the
183
+ autumn breeze. Everywhere the barnyard citizens sniffed the air with
184
+ delight.
185
+
186
+
187
+ The Red Hen ambled in her picketty-pecketty way toward the source of
188
+ all this excitement.
189
+
190
+
191
+ Although she appeared to be perfectly calm, in reality she could only
192
+ with difficulty restrain an impulse to dance and sing, for had she not
193
+ done all the work on this wonderful bread?
194
+
195
+
196
+ Small wonder that she was the most excited person in the barnyard!
197
+
198
+ She did not know whether the bread would be fit to eat, but--joy of
199
+ joys!--when the lovely brown loaves came out of the oven, they were
200
+ done to perfection.
201
+
202
+
203
+ Then, probably because she had acquired the habit, the Red Hen called:
204
+ "Who will eat the Bread?"
205
+
206
+
207
+ All the animals in the barnyard were watching hungrily and smacking
208
+ their lips in anticipation, and the Pig said, "I will," the Cat said,
209
+ "I will," the Rat said, "I will."
210
+
211
+ But the Little Red Hen said,
212
+
213
+
214
+ "No, you won't. I will."
215
+
216
+ And she did.
stories/The_Sleeping_Beauty.txt ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Sleeping Beauty Picture Book
2
+
3
+ Long, long ago, in ancient times, there lived a King and Queen,
4
+ And for the blessing of a child their longing sore had been:
5
+ At last, a little daughter fair, to their great joy, was given,
6
+ And to the christening feast they made, they bade the Fairies seven--
7
+
8
+
9
+ The Fairies seven, who loved the land--that they the child
10
+ might bless.
11
+ Yet one old Fairy they left out, in pure forgetfulness.
12
+ And at the feast, the dishes fair were of the reddest gold;
13
+ But when the Fairy came, not one for her, so bad and old,
14
+ Angry was she, because her place and dish had been forgot,
15
+ And angry things she muttered long, and kept her anger hot.
16
+
17
+
18
+ Until the Fairy godmothers their gifts and wishes gave:
19
+ She waited long to spoil the gifts, and her revenge to have.
20
+ One gave the Princess goodness, and one gave her beauty rare;
21
+ One gave her sweetest singing voice; one, gracious mien and air;
22
+ One, skill in dancing; one, all cleverness; and then the crone
23
+ Came forth, and muttered, angry still, and good gift gave she none;
24
+
25
+
26
+ But said, that in the future years the Princess young should die,
27
+ By pricking of a spindle-point--ah, woeful prophecy!
28
+ But now, a kind young Fairy, who had waited to the last,
29
+ Stepped forth, and said, "No, she shall sleep till a hundred years
30
+ are past;
31
+ And then she shall be wakened by a King's son--truth I tell--
32
+ And he will take her for his wife, and all will yet be well."
33
+
34
+ In vain in all her father's Court the spinning-wheel's forbid
35
+ In vain in all the country-side the spindles sharp are hid;
36
+ For in a lonely turret high, and up a winding stair,
37
+ There lives an ancient woman who still turns her wheel with care.
38
+ The Princess found her out one day, and tried to learn to spin;
39
+ Alas! the spindle pricked her hand--the charm had entered in!
40
+
41
+ And down she falls in death-like sleep: they lay her on her bed,
42
+ And all around her sink to rest--a palace of the dead!
43
+ A hundred years pass--still they sleep, and all around the place
44
+ A wood of thorns has risen up--no path a man can trace.
45
+ At last, a King's son, in the hunt, asked how long it had stood,
46
+ And what old towers were those he saw above the ancient wood.
47
+
48
+
49
+ An aged peasant told of an enchanted palace, where
50
+ A sleeping King and Court lay hid, and sleeping Princess fair.
51
+ Through the thick wood, that gave him way, and past the thorns that drew
52
+ Their sharpest points another way, the King's son presses through.
53
+ He reached the guard, the court, the hall,--and there, where'er he
54
+ stept,
55
+ He saw the sentinels, and grooms, and courtiers as they slept.
56
+
57
+
58
+ Ladies in act to smile, and pages in attendance wait;
59
+ The horses slept within their stalls, the dogs about the gate.
60
+ The King's son presses on, into an inner chamber fair,
61
+ And sees, laid on a silken bed, a lovely lady there;
62
+ So sweet a face, so fair--was never beauty such as this;
63
+ He stands--he stoops to gaze--he kneels--he wakes her with a kiss.
64
+
65
+
66
+ He leads her forth: the magic sleep of all the Court is o'er,--
67
+ They wake, they move, they talk, they laugh, just as they did of yore
68
+ A hundred years ago. The King and Queen awake, and tell
69
+ How all has happed, rejoicing much that all has ended well.
70
+ They hold the wedding that same day, with mirth and feasting good--
71
+ The wedding of the Prince and Sleeping Beauty in the Wood.
72
+
73
+
74
+ Aa
75
+
76
+
77
+ As I was going up Pippin Hill
78
+ Pippin hill was dirty.
79
+ There I met a pretty miss,
80
+ And she dropped me a curtsy.
81
+
82
+ Bb
83
+
84
+
85
+ Boys and girls come out to play.
86
+ The moon doth shine as bright as day:
87
+ Come with a whoop, come with a call,
88
+ Come with a good will, or not at all.
89
+
90
+ Cc
91
+
92
+
93
+ Cuckoo, cherry tree
94
+ Come down & tell me
95
+ How many years
96
+ I have to live!
97
+
98
+ Dd
99
+
100
+
101
+ Ding, dong, bell,
102
+ Pussy's in the well.
103
+ Who put her in?
104
+ Naughty Johnny Green.
105
+ Who pulled her out?
106
+ Little Tommy Trout.
107
+
108
+ Ee
109
+
110
+
111
+ Early to bed, and early to rise,
112
+ Is the way to be healthy, wealthy, and wise.
113
+
114
+ Ff
115
+
116
+
117
+ For every evil under the sun
118
+ There is a remedy, or there is none.
119
+ If there be one, try and find it;
120
+ If there be none, never mind it.
121
+
122
+ Gg
123
+
124
+
125
+ Great A, little A; Bouncing B;
126
+ The cat's in the cupboard.
127
+ And she can't see me.
128
+
129
+ Hh
130
+
131
+
132
+ Hark! hark! the dogs do bark,
133
+ The Beggars are coming to town.
134
+ Some in rags & some in jag's
135
+ And some in velvet gowns.
136
+
137
+ Ii
138
+
139
+
140
+ I had a little pony
141
+ They called it Dapple Gray,
142
+ I lent it to a lady
143
+ To ride a mile away.
144
+ She whipped it, she slashed it,
145
+ She drove it through the mire.
146
+ I will not lend my pony more,
147
+ For all the ladies' hire.
148
+
149
+ Jj
150
+
151
+
152
+ John Smith, fellow fine,
153
+ Can you shoe this horse o' mine?
154
+ Yes, indeed, and that I can
155
+ As well as any man!
156
+ There's a nail upon the tae, &c
157
+ To make the powny speel the brae;
158
+ There's a nail and there's a brod
159
+ --a horse weel shod.
160
+
161
+ Kk
162
+
163
+
164
+ King o' Katchem met a king
165
+ In a narrow lane;
166
+ Says this king to that king
167
+ "Where have you been?"
168
+
169
+ Oh, I've been a hunting
170
+ With my dog & my doe
171
+ Pray lend him to me,
172
+ That I may do so.
173
+
174
+ "There's the dog, TAKE the dog."
175
+ "What's the dog's name?"
176
+ "I've told you already."
177
+ "Pray tell me again."
178
+
179
+ Ll
180
+
181
+
182
+ Ladybird, ladybird, fly away home,
183
+ Your house is a-fire, your children all gone,
184
+ All but one that lies under a stone;
185
+ Fly the home, ladybird, ere it be gone!
186
+
187
+ Mm
188
+
189
+
190
+ Multiplication is vexation,
191
+ Division is twice as bad;
192
+ The Rule of Three it puzzles me
193
+ And Fractions drive me mad!
194
+
195
+ Nn
196
+
197
+
198
+ Nievie, nievie, nicknack,
199
+ Which hand will ye tak'?
200
+ Tak' the right, or tak' the wrong,
201
+ I'll beguile ye, if I can.
202
+
203
+ Oo
204
+
205
+
206
+ Oh, Mother, I'm to be married
207
+ To Mr. Punchinello,
208
+ To Mr. Pun,
209
+ To Mr. Chin,
210
+ To Mr. Nel,
211
+ To Mr. Lo,
212
+ Mr. Pun, Mr. Chin, Mr. Nel, Mr. Lo
213
+ To Mr. Punchinello.
214
+
215
+ Pp
216
+
217
+
218
+ Pat a cake, pat a cake, baker's man,
219
+ Prick it and bake it as fast as you can.
220
+ Prick it, and bake it, and mark it with B,
221
+ And put it in the oven for baby and me.
222
+
223
+ Qq
224
+
225
+
226
+ Queen of Hearts,
227
+ She made some tarts,
228
+ All on a summer's day.
229
+ The Knave of Hearts,
230
+ He stole the tarts,
231
+ And took them all away.
232
+
233
+ Rr
234
+
235
+
236
+ Rain, rain,
237
+ Go to Spain,
238
+ And never come back again.
239
+
240
+ Ss
241
+
242
+
243
+ See, Saw, Margery Daw,
244
+ Sold her bed, and lay upon straw.
245
+
246
+ Tt
247
+
248
+
249
+ Three children sliding on the ice,
250
+ Upon a summer's day;
251
+ As it fell out they all fell in:
252
+ The rest they ran away.
253
+
254
+ Uu
255
+
256
+
257
+ Uphill spare me,
258
+ Downhill 'ware me,
259
+ On level ground spare me not,
260
+ And in the stable forget me not.
261
+
262
+ Vv
263
+
264
+
265
+ VALENTINE
266
+
267
+ The rose is red; the Violet's blue
268
+ The pink is sweet; & so are you.
269
+
270
+ Ww
271
+
272
+
273
+ "We'll go a-shooting," says Robin to Bobbin;
274
+ "We'll go a-shooting," says Richard to John.
275
+ "We'll go a-shooting," says John all alone;
276
+ "We'll go a-shooting," says every one.
277
+
278
+ Xx
279
+
280
+
281
+ XMAS GIFTS.
282
+
283
+ The first day of Xmas
284
+ My mother sent to me
285
+ A partridge in a pear tree.
286
+
287
+ Yy
288
+
289
+
290
+ YULE DAYS.
291
+
292
+ The king sent his lady on the first Yule day,
293
+ A papingo-aye
294
+ Who learns my carol & carries it away?
295
+
296
+ Zz
297
+
298
+
299
+ ZOOLOGICAL GARDENS.
300
+
301
+ Where you shall go, too;
302
+ But it's through A B C that we get to the Zoo.
303
+
304
+
305
+ BLUEBEARD.
306
+
307
+
308
+ Once on a time there lived a man hated by all he knew,
309
+ Both that his ways were very bad, and that his beard was blue;
310
+ But as he was so rich and grand, and led a merry life,
311
+ A lady he contrived at last to induce to be his wife.
312
+
313
+
314
+ For a month after the wedding they lived and had good cheer,
315
+ And then said Bluebeard to his wife, "I'll say good-bye, my dear;
316
+ Indeed, it is but for six weeks that I shall be away,
317
+ I beg that you'll invite your friends, and feast and dance and play;
318
+ And all my property I'll leave confided to your care.
319
+ Here are the keys of all my chests, there's plenty and to spare."
320
+
321
+ "But this small key belongs to one small room on the ground-floor,--
322
+ And this you must not open, or you will repent it sore."
323
+ And so he went; and all the friends came there from far and wide,
324
+ And in her wealth the lady took much happiness and pride;
325
+ But in a while this kind of joy grew nearly satisfied.
326
+
327
+
328
+ And oft she saw the closet door, and longed to look inside.
329
+ At last she could no more refrain, and turned the little key,
330
+ And looked within, and fainted straight the horrid sight to see;
331
+ For there upon the floor was blood, and on the walls were wives,
332
+ For Bluebeard first had married them, then cut their throats
333
+ with knives.
334
+
335
+ And this poor wife, distracted, picked the key up from the floor,
336
+ All stained with blood; and with much fear she shut and locked the door.
337
+ She tried in vain to clean the key and wash the stain away
338
+ With sand and soap,--it was no use. Bluebeard came back that day;
339
+ At once he asked her for the key,--he saw the bloody stain.--
340
+
341
+
342
+ "You have been in the closet once, and you shall go again!"
343
+ "O spare me, spare me! give me time, nor kill me hastily!"
344
+ "You have a quarter of an hour,--then, madam, you must die!"
345
+ "O sister Anne, go up, go up, and look out from the tower;"
346
+ "I'm dead unless my brothers come in a quarter of an hour!"
347
+ And Anne looked once, and Anne looked twice, and nothing saw abroad,
348
+ But shining sun and growing grass, and dust upon the road.
349
+
350
+
351
+ "Come down!" cried Bluebeard, "time is up!" With many a sigh and moan,
352
+ She prayed him for a minute more; he shouted still, "Come down!"
353
+ "O sister Anne, look out, look out! and do you nothing see?"
354
+ "At last I see our brothers two come riding hastily."
355
+ "Now spare me, Bluebeard,--spare thy wife!" but as the words were said,
356
+
357
+
358
+ And just as Bluebeard's cruel blade was descending on her head,
359
+ In rushed the brothers with their swords,--they cut the murderer down,
360
+ And saved their sister's life, and gained much glory and renown;
361
+ And then they all with gold and plate and jewels rare made free,
362
+ And ever after lived content on Bluebeard's property.
stories/The_Story_of_the_Three_Little_Pigs.txt ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Story of the Three Little Pigs
2
+
3
+ Once upon a time there was an old Sow with three little Pigs,
4
+ and as she had not enough to keep them, she sent them out to seek their
5
+ fortune.
6
+
7
+
8
+ The first that went off met a Man with a bundle of straw, and said to
9
+ him, "Please, Man, give me that straw to build me a house"; which the
10
+ Man did, and the little Pig built a house with it. Presently came along
11
+ a Wolf, and knocked at the door, and said, "Little Pig, little Pig, let
12
+ me come in."
13
+
14
+ To which the Pig answered, "No, no, by the hair of my chinny chin chin."
15
+
16
+
17
+ "Then I'll huff and I'll puff, and I'll blow your house
18
+ in!" said the Wolf. So he huffed and he puffed, and he blew his house
19
+ in, and ate up the little Pig.
20
+
21
+ The second Pig met a Man with a bundle of furze, and said, "Please, Man,
22
+ give me that furze to build a house"; which the Man did, and the Pig
23
+ built his house.
24
+
25
+
26
+ Then along came the Wolf and said, "Little Pig, little Pig, let me come
27
+ in."
28
+
29
+ "No, no, by the hair of my chinny chin chin."
30
+
31
+ "Then I'll puff and I'll huff, and I'll blow your house in!" So he
32
+ huffed and he puffed, and he puffed and he huffed, and at last he blew
33
+ the house down, and ate up the second little Pig.
34
+
35
+
36
+ The third little Pig met a Man with a load of bricks, and said, "Please,
37
+ Man, give me those bricks to build a house with"; so the Man gave him
38
+ the bricks, and he built his house with them. So the Wolf came, as he
39
+ did to the other little Pigs, and said, "Little Pig, little Pig, let me
40
+ come in."
41
+
42
+ "No, no, by the hair of my chinny chin chin."
43
+
44
+ "Then I'll huff and I'll puff, and I'll blow your house in."
45
+
46
+ Well, he huffed and he puffed, and he huffed and he puffed, and he
47
+ puffed and he huffed; but he could not get the house down. When he
48
+ found that he could not, with all his huffing and puffing, blow the
49
+ house down, he said, "Little Pig, I know where there is a nice field of
50
+ turnips."
51
+
52
+
53
+ "Where?" said the little Pig.
54
+
55
+ "Oh, in Mr. Smith's home-field; and if you will be ready to-morrow
56
+ morning, I will call for you, and we will go together and get some for
57
+ dinner."
58
+
59
+ "Very well," said the little Pig, "I will be ready. What time do you
60
+ mean to go?"
61
+
62
+ "Oh, at six o'clock."
63
+
64
+
65
+ Well, the little Pig got up at five, and got the turnips and was home
66
+ again before six. When the Wolf came he said, "Little Pig, are you
67
+ ready?"
68
+
69
+ "Ready!" said the little Pig, "I have been and come back again, and got
70
+ a nice pot-full for dinner."
71
+
72
+
73
+ The Wolf felt very angry at this, but thought that he would be up to
74
+ the little Pig somehow or other; so he said, "Little Pig, I know where
75
+ there is a nice apple-tree."
76
+
77
+ "Where?" said the Pig.
78
+
79
+ "Down at Merry-garden," replied the Wolf; "and if you will not deceive
80
+ me I will come for you, at five o'clock to-morrow, and we will go
81
+ together and get some apples."
82
+
83
+
84
+ Well, the little Pig woke at four the next morning, and bustled up, and
85
+ went off for the apples, hoping to get back before the Wolf came; but
86
+ he had farther to go, and had to climb the tree, so that just as he was
87
+ coming down from it, he saw the Wolf coming, which, as you may suppose,
88
+ frightened him very much. When the Wolf came up he said, "Little Pig,
89
+ what! are you here before me? Are they nice apples?"
90
+
91
+
92
+ "Yes, very," said the little Pig; "I will throw you down one." And he
93
+ threw it so far that, while the Wolf was gone to pick it up, the
94
+ little Pig jumped down and ran home.
95
+
96
+
97
+ The next day the Wolf came again, and said to the little Pig, "Little
98
+ Pig, there is a Fair in the Town this afternoon: will you go?"
99
+
100
+ "Oh, yes," said the Pig, "I will go; what time shall you be ready?"
101
+
102
+ "At three," said the Wolf.
103
+
104
+
105
+ So the little Pig went off before the time, as usual, and got to the
106
+ Fair, and bought a butter churn, and was on his way home with it when he
107
+ saw the Wolf coming. Then he could not tell what to do. So he got into
108
+ the churn to hide, and in doing so turned it round, and it began to
109
+ roll, and rolled down the hill with the Pig inside it, which frightened
110
+ the Wolf so much that he ran home without going to the Fair.
111
+
112
+
113
+ He went to the little Pig's house, and told him how frightened he had
114
+ been by a great round thing which came down the hill past him.
115
+
116
+ Then the little Pig said, "Hah! I frightened you, did I? I had been to
117
+ the Fair and bought a butter churn, and when I saw you I got into it,
118
+ and rolled down the hill."
119
+
120
+
121
+ Then the Wolf was very angry indeed, and declared he would eat up the
122
+ little Pig, and that he would get down the chimney after him.
123
+
124
+
125
+ When the little Pig saw what he was about, he hung on the pot full of
126
+ water, and made up a blazing fire, and, just as the Wolf was coming
127
+ down, took off the cover of the pot, and in fell the Wolf. And the
128
+ little Pig put on the cover again in an instant, boiled him up, and ate
129
+ him for supper, and lived happy ever after.
stories/The_Tale_of_Benjamin_Bunny.txt ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Tale of Benjamin Bunny
2
+
3
+ One morning a little rabbit sat on a bank.
4
+
5
+ He pricked his ears and listened to the trit-trot, trit-trot of a pony.
6
+
7
+ A gig was coming along the road; it was driven by Mr. McGregor, and beside
8
+ him sat Mrs. McGregor in her best bonnet.
9
+
10
+ As soon as they had passed, little Benjamin Bunny slid down into the road,
11
+ and set off--with a hop, skip, and a jump--to call upon his relations, who
12
+ lived in the wood at the back of Mr. McGregor's garden.
13
+
14
+
15
+ That wood was full of rabbit holes; and in the neatest, sandiest hole of
16
+ all lived Benjamin's aunt and his cousins--Flopsy, Mopsy, Cotton-tail, and
17
+ Peter.
18
+
19
+ Old Mrs. Rabbit was a widow; she earned her living by knitting rabbit-wool
20
+ mittens and muffatees (I once bought a pair at a bazaar). She also sold
21
+ herbs, and rosemary tea, and rabbit-tobacco (which is what we call
22
+ lavender).
23
+
24
+ Little Benjamin did not very much want to see his Aunt.
25
+
26
+ He came round the back of the fir-tree, and nearly tumbled upon the top of
27
+ his Cousin Peter.
28
+
29
+
30
+ Peter was sitting by himself. He looked poorly, and was dressed in a red
31
+ cotton pocket-handkerchief.
32
+
33
+ "Peter," said little Benjamin, in a whisper, "who has got your clothes?"
34
+
35
+ Peter replied, "The scarecrow in Mr. McGregor's garden," and described how
36
+ he had been chased about the garden, and had dropped his shoes and coat.
37
+
38
+ Little Benjamin sat down beside his cousin and assured him that Mr.
39
+ McGregor had gone out in a gig, and Mrs. McGregor also; and certainly for
40
+ the day, because she was wearing her best bonnet.
41
+
42
+
43
+ Peter said he hoped that it would rain.
44
+
45
+ At this point old Mrs. Rabbit's voice was heard inside the rabbit hole,
46
+ calling: "Cotton-tail! Cotton-tail! fetch some more camomile!"
47
+
48
+ Peter said he thought he might feel better if he went for a walk.
49
+
50
+ They went away hand in hand, and got upon the flat top of the wall at the
51
+ bottom of the wood. From here they looked down into Mr. McGregor's garden.
52
+ Peter's coat and shoes were plainly to be seen upon the scarecrow, topped
53
+ with an old tam-o'-shanter of Mr. McGregor's.
54
+
55
+
56
+ Little Benjamin said: "It spoils people's clothes to squeeze under a gate;
57
+ the proper way to get in is to climb down a pear-tree."
58
+
59
+ Peter fell down head first; but it was of no consequence, as the bed below
60
+ was newly raked and quite soft.
61
+
62
+ It had been sown with lettuces.
63
+
64
+ They left a great many odd little footmarks all over the bed, especially
65
+ little Benjamin, who was wearing clogs.
66
+
67
+
68
+ Little Benjamin said that the first thing to be done was to get back
69
+ Peter's clothes, in order that they might be able to use the
70
+ pocket-handkerchief.
71
+
72
+ They took them off the scarecrow. There had been rain during the night;
73
+ there was water in the shoes, and the coat was somewhat shrunk.
74
+
75
+ Benjamin tried on the tam-o'-shanter, but it was too big for him.
76
+
77
+ Then he suggested that they should fill the pocket-handkerchief with
78
+ onions, as a little present for his Aunt.
79
+
80
+ Peter did not seem to be enjoying himself; he kept hearing noises.
81
+
82
+
83
+ Benjamin, on the contrary, was perfectly at home, and ate a lettuce leaf.
84
+ He said that he was in the habit of coming to the garden with his father
85
+ to get lettuces for their Sunday dinner.
86
+
87
+ (The name of little Benjamin's papa was old Mr. Benjamin Bunny.)
88
+
89
+ The lettuces certainly were very fine.
90
+
91
+ Peter did not eat anything; he said he should like to go home. Presently
92
+ he dropped half the onions.
93
+
94
+
95
+ Little Benjamin said that it was not possible to get back up the pear-tree
96
+ with a load of vegetables. He led the way boldly towards the other end of
97
+ the garden. They went along a little walk on planks, under a sunny, red
98
+ brick wall.
99
+
100
+ The mice sat on their doorsteps cracking cherry-stones; they winked at
101
+ Peter Rabbit and little Benjamin Bunny.
102
+
103
+ Presently Peter let the pocket-handkerchief go again.
104
+
105
+
106
+ They got amongst flower-pots, and frames, and tubs. Peter heard noises
107
+ worse than ever; his eyes were as big as lolly-pops!
108
+
109
+ He was a step or two in front of his cousin when he suddenly stopped.
110
+
111
+ This is what those little rabbits saw round that corner!
112
+
113
+ Little Benjamin took one look, and then, in half a minute less than no
114
+ time, he hid himself and Peter and the onions underneath a large
115
+ basket....
116
+
117
+
118
+ The cat got up and stretched herself, and came and sniffed at the basket.
119
+
120
+ Perhaps she liked the smell of onions!
121
+
122
+ Anyway, she sat down upon the top of the basket.
123
+
124
+ She sat there for five hours.
125
+
126
+
127
+ I cannot draw you a picture of Peter and Benjamin underneath the basket,
128
+ because it was quite dark, and because the smell of onions was fearful; it
129
+ made Peter Rabbit and little Benjamin cry.
130
+
131
+ The sun got round behind the wood, and it was quite late in the afternoon;
132
+ but still the cat sat upon the basket.
133
+
134
+
135
+ At length there was a pitter-patter, pitter-patter, and some bits of
136
+ mortar fell from the wall above.
137
+
138
+ The cat looked up and saw old Mr. Benjamin Bunny prancing along the top of
139
+ the wall of the upper terrace.
140
+
141
+ He was smoking a pipe of rabbit-tobacco, and had a little switch in his
142
+ hand.
143
+
144
+ He was looking for his son.
145
+
146
+ Old Mr. Bunny had no opinion whatever of cats.
147
+
148
+ He took a tremendous jump off the top of the wall on to the top of the
149
+ cat, and cuffed it off the basket, and kicked it into the greenhouse,
150
+ scratching off a handful of fur.
151
+
152
+ The cat was too much surprised to scratch back.
153
+
154
+
155
+ When old Mr. Bunny had driven the cat into the greenhouse, he locked the
156
+ door.
157
+
158
+ Then he came back to the basket and took out his son Benjamin by the ears,
159
+ and whipped him with the little switch.
160
+
161
+ Then he took out his nephew Peter.
162
+
163
+ Then he took out the handkerchief of onions, and marched out of the
164
+ garden.
165
+
166
+
167
+ When Mr. McGregor returned about half an hour later he observed several
168
+ things which perplexed him.
169
+
170
+ It looked as though some person had been walking all over the garden in a
171
+ pair of clogs--only the footmarks were too ridiculously little!
172
+
173
+ Also he could not understand how the cat could have managed to shut
174
+ herself up inside the greenhouse, locking the door upon the outside.
175
+
176
+
177
+ When Peter got home his mother forgave him, because she was so glad to see
178
+ that he had found his shoes and coat. Cotton-tail and Peter folded up the
179
+ pocket-handkerchief, and old Mrs. Rabbit strung up the onions and hung
180
+ them from the kitchen ceiling, with the bunches of herbs and the
181
+ rabbit-tobacco.
stories/The_Tale_of_Jemima_Puddle_Duck.txt ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Tale of Jemima Puddle-Duck
2
+
3
+ What a funny sight it is to see a brood of ducklings with a hen!
4
+
5
+ --Listen to the story of Jemima Puddle-duck, who was annoyed because the
6
+ farmer's wife would not let her hatch her own eggs.
7
+
8
+
9
+ Her sister-in-law, Mrs. Rebeccah Puddle-duck, was perfectly willing to
10
+ leave the hatching to some one else--"I have not the patience to sit on a
11
+ nest for twenty-eight days; and no more have you, Jemima. You would let
12
+ them go cold; you know you would!"
13
+
14
+ "I wish to hatch my own eggs; I will hatch them all by myself," quacked
15
+ Jemima Puddle-duck.
16
+
17
+
18
+ She tried to hide her eggs; but they were always found and carried off.
19
+
20
+ Jemima Puddle-duck became quite desperate. She determined to make a nest
21
+ right away from the farm.
22
+
23
+
24
+ She set off on a fine spring afternoon along the cart-road that leads over
25
+ the hill.
26
+
27
+ She was wearing a shawl and a poke bonnet.
28
+
29
+
30
+ When she reached the top of the hill, she saw a wood in the distance.
31
+
32
+ She thought that it looked a safe quiet spot.
33
+
34
+
35
+ Jemima Puddle-duck was not much in the habit of flying. She ran downhill a
36
+ few yards flapping her shawl, and then she jumped off into the air.
37
+
38
+
39
+ She flew beautifully when she had got a good start.
40
+
41
+ She skimmed along over the tree-tops until she saw an open place in the
42
+ middle of the wood, where the trees and brushwood had been cleared.
43
+
44
+
45
+ Jemima alighted rather heavily, and began to waddle about in search of a
46
+ convenient dry nesting-place. She rather fancied a tree-stump amongst some
47
+ tall fox-gloves.
48
+
49
+ But--seated upon the stump, she was startled to find an elegantly dressed
50
+ gentleman reading a newspaper.
51
+
52
+ He had black prick ears and sandy coloured whiskers.
53
+
54
+ "Quack?" said Jemima Puddle-duck, with her head and her bonnet on one
55
+ side--"Quack?"
56
+
57
+
58
+ The gentleman raised his eyes above his newspaper and looked curiously at
59
+ Jemima--
60
+
61
+ "Madam, have you lost your way?" said he. He had a long bushy tail which
62
+ he was sitting upon, as the stump was somewhat damp.
63
+
64
+ Jemima thought him mighty civil and handsome. She explained that she had
65
+ not lost her way, but that she was trying to find a convenient dry
66
+ nesting-place.
67
+
68
+
69
+ "Ah! is that so? indeed!" said the gentleman with sandy whiskers, looking
70
+ curiously at Jemima. He folded up the newspaper, and put it in his
71
+ coat-tail pocket.
72
+
73
+ Jemima complained of the superfluous hen.
74
+
75
+ "Indeed! how interesting! I wish I could meet with that fowl. I would
76
+ teach it to mind its own business!"
77
+
78
+
79
+ "But as to a nest--there is no difficulty: I have a sackful of feathers in
80
+ my wood-shed. No, my dear madam, you will be in nobody's way. You may sit
81
+ there as long as you like," said the bushy long-tailed gentleman.
82
+
83
+ He led the way to a very retired, dismal-looking house amongst the
84
+ fox-gloves.
85
+
86
+ It was built of faggots and turf, and there were two broken pails, one on
87
+ top of another, by way of a chimney.
88
+
89
+
90
+ "This is my summer residence; you would not find my earth--my winter
91
+ house--so convenient," said the hospitable gentleman.
92
+
93
+ There was a tumble-down shed at the back of the house, made of old
94
+ soap-boxes. The gentleman opened the door, and showed Jemima in.
95
+
96
+
97
+ The shed was almost quite full of feathers--it was almost suffocating; but
98
+ it was comfortable and very soft.
99
+
100
+ Jemima Puddle-duck was rather surprised to find such a vast quantity of
101
+ feathers. But it was very comfortable; and she made a nest without any
102
+ trouble at all.
103
+
104
+
105
+ When she came out, the sandy whiskered gentleman was sitting on a log
106
+ reading the newspaper--at least he had it spread out, but he was looking
107
+ over the top of it.
108
+
109
+ He was so polite, that he seemed almost sorry to let Jemima go home for
110
+ the night. He promised to take great care of her nest until she came back
111
+ again next day.
112
+
113
+ He said he loved eggs and ducklings; he should be proud to see a fine
114
+ nestful in his wood-shed.
115
+
116
+
117
+ Jemima Puddle-duck came every afternoon; she laid nine eggs in the nest.
118
+ They were greeny white and very large. The foxy gentleman admired them
119
+ immensely. He used to turn them over and count them when Jemima was not
120
+ there.
121
+
122
+ At last Jemima told him that she intended to begin to sit next day--"and I
123
+ will bring a bag of corn with me, so that I need never leave my nest until
124
+ the eggs are hatched. They might catch cold," said the conscientious
125
+ Jemima.
126
+
127
+
128
+ "Madam, I beg you not to trouble yourself with a bag; I will provide oats.
129
+ But before you commence your tedious sitting, I intend to give you a
130
+ treat. Let us have a dinner-party all to ourselves!
131
+
132
+ "May I ask you to bring up some herbs from the farm-garden to make a
133
+ savoury omelette? Sage and thyme, and mint and two onions, and some
134
+ parsley. I will provide lard for the stuff--lard for the omelette," said
135
+ the hospitable gentleman with sandy whiskers.
136
+
137
+
138
+ Jemima Puddle-duck was a simpleton: not even the mention of sage and
139
+ onions made her suspicious.
140
+
141
+ She went round the farm-garden, nibbling off snippets of all the different
142
+ sorts of herbs that are used for stuffing roast duck.
143
+
144
+
145
+ And she waddled into the kitchen, and got two onions out of a basket.
146
+
147
+ The collie-dog Kep met her coming out, "What are you doing with those
148
+ onions? Where do you go every afternoon by yourself, Jemima Puddle-duck?"
149
+
150
+ Jemima was rather in awe of the collie; she told him the whole story.
151
+
152
+ The collie listened, with his wise head on one side; he grinned when she
153
+ described the polite gentleman with sandy whiskers.
154
+
155
+
156
+ He asked several questions about the wood, and about the exact position of
157
+ the house and shed.
158
+
159
+ Then he went out, and trotted down the village. He went to look for two
160
+ fox-hound puppies who were out at walk with the butcher.
161
+
162
+
163
+ Jemima Puddle-duck went up the cart-road for the last time, on a sunny
164
+ afternoon. She was rather burdened with bunches of herbs and two onions in
165
+ a bag.
166
+
167
+ She flew over the wood, and alighted opposite the house of the bushy
168
+ long-tailed gentleman.
169
+
170
+
171
+ He was sitting on a log; he sniffed the air, and kept glancing uneasily
172
+ round the wood. When Jemima alighted he quite jumped.
173
+
174
+ "Come into the house as soon as you have looked at your eggs. Give me the
175
+ herbs for the omelette. Be sharp!"
176
+
177
+ He was rather abrupt. Jemima Puddle-duck had never heard him speak like
178
+ that.
179
+
180
+ She felt surprised, and uncomfortable.
181
+
182
+
183
+ While she was inside she heard pattering feet round the back of the shed.
184
+ Some one with a black nose sniffed at the bottom of the door, and then
185
+ locked it.
186
+
187
+ Jemima became much alarmed.
188
+
189
+
190
+ A moment afterwards there were most awful noises--barking, baying, growls
191
+ and howls, squealing and groans.
192
+
193
+ And nothing more was ever seen of that foxy-whiskered gentleman.
194
+
195
+ Presently Kep opened the door of the shed, and let out Jemima Puddle-duck.
196
+
197
+
198
+ Unfortunately the puppies rushed in and gobbled up all the eggs before he
199
+ could stop them.
200
+
201
+ He had a bite on his ear and both the puppies were limping.
202
+
203
+
204
+ Jemima Puddle-duck was escorted home in tears on account of those eggs.
205
+
206
+
207
+ She laid some more in June, and she was permitted to keep them herself:
208
+ but only four of them hatched.
209
+
210
+ Jemima Puddle-duck said that it was because of her nerves; but she had
211
+ always been a bad sitter.
stories/The_Tale_of_Peter_Rabbit.txt ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Tale of Peter Rabbit
2
+
3
+ Once upon a time there were four little Rabbits, and their names
4
+ were--
5
+
6
+ Flopsy,
7
+ Mopsy,
8
+ Cotton-tail,
9
+ and Peter.
10
+
11
+ They lived with their Mother in a sand-bank, underneath the root of a
12
+ very big fir-tree.
13
+
14
+ 'Now my dears,' said old Mrs. Rabbit one morning, 'you may go into
15
+ the fields or down the lane, but don't go into Mr. McGregor's garden:
16
+ your Father had an accident there; he was put in a pie by Mrs.
17
+ McGregor.'
18
+
19
+
20
+ 'Now run along, and don't get into mischief. I am going out.'
21
+
22
+ Then old Mrs. Rabbit took a basket and her umbrella, and went through
23
+ the wood to the baker's. She bought a loaf of brown bread and five
24
+ currant buns.
25
+
26
+
27
+ Flopsy, Mopsy, and Cottontail, who were good little bunnies, went
28
+ down the lane to gather blackberries:
29
+
30
+ But Peter, who was very naughty, ran straight away to Mr. McGregor's
31
+ garden, and squeezed under the gate!
32
+
33
+
34
+ First he ate some lettuces and some French beans; and then he ate
35
+ some radishes;
36
+
37
+ And then, feeling rather sick, he went to look for some parsley.
38
+
39
+
40
+ But round the end of a cucumber frame, whom should he meet but Mr.
41
+ McGregor!
42
+
43
+ Mr. McGregor was on his hands and knees planting out young cabbages,
44
+ but he jumped up and ran after Peter, waving a rake and calling out,
45
+ 'Stop thief!'
46
+
47
+
48
+ Peter was most dreadfully frightened; he rushed all over the garden,
49
+ for he had forgotten the way back to the gate.
50
+
51
+ He lost one of his shoes among the cabbages, and the other shoe
52
+ amongst the potatoes.
53
+
54
+ After losing them, he ran on four legs and went faster, so that I
55
+ think he might have got away altogether if he had not unfortunately
56
+ run into a gooseberry net, and got caught by the large buttons on his
57
+ jacket. It was a blue jacket with brass buttons, quite new.
58
+
59
+
60
+ Peter gave himself up for lost, and shed big tears; but his sobs were
61
+ overheard by some friendly sparrows, who flew to him in great
62
+ excitement, and implored him to exert himself.
63
+
64
+ Mr. McGregor came up with a sieve, which he intended to pop upon the
65
+ top of Peter; but Peter wriggled out just in time, leaving his jacket
66
+ behind him.
67
+
68
+
69
+ And rushed into the tool-shed, and jumped into a can. It would have
70
+ been a beautiful thing to hide in, if it had not had so much water in it.
71
+
72
+ Mr. McGregor was quite sure that Peter was somewhere in the
73
+ tool-shed, perhaps hidden underneath a flower-pot. He began to turn
74
+ them over carefully, looking under each.
75
+
76
+ Presently Peter sneezed--'Kertyschoo!' Mr. McGregor was after him in
77
+ no time.
78
+
79
+
80
+ And tried to put his foot upon Peter, who jumped out of a window,
81
+ upsetting three plants. The window was too small for Mr. McGregor, and
82
+ he was tired of running after Peter. He went back to his work.
83
+
84
+ Peter sat down to rest; he was out of breath and trembling with
85
+ fright, and he had not the least idea which way to go. Also he was
86
+ very damp with sitting in that can.
87
+
88
+ After a time he began to wander about, going lippity--lippity--not
89
+ very fast, and looking all round.
90
+
91
+
92
+ He found a door in a wall; but it was locked, and there was no room
93
+ for a fat little rabbit to squeeze underneath.
94
+
95
+ An old mouse was running in and out over the stone doorstep, carrying
96
+ peas and beans to her family in the wood. Peter asked her the way to
97
+ the gate, but she had such a large pea in her mouth that she could not
98
+ answer. She only shook her head at him. Peter began to cry.
99
+
100
+ Then he tried to find his way straight across the garden, but he
101
+ became more and more puzzled. Presently, he came to a pond where Mr.
102
+ McGregor filled his water-cans. A white cat was staring at some
103
+ gold-fish, she sat very, very still, but now and then the tip of her
104
+ tail twitched as if it were alive. Peter thought it best to go away
105
+ without speaking to her; he had heard about cats from his cousin,
106
+ little Benjamin Bunny.
107
+
108
+
109
+ He went back towards the tool-shed, but suddenly, quite close to him,
110
+ he heard the noise of a hoe--scr-r-ritch, scratch, scratch, scritch.
111
+ Peter scuttered underneath the bushes. But presently, as nothing
112
+ happened, he came out, and climbed upon a wheelbarrow and peeped over.
113
+ The first thing he saw was Mr. McGregor hoeing onions. His back was
114
+ turned towards Peter, and beyond him was the gate!
115
+
116
+ Peter got down very quietly off the wheelbarrow; and started running
117
+ as fast as he could go, along a straight walk behind some
118
+ black-currant bushes.
119
+
120
+ Mr. McGregor caught sight of him at the corner, but Peter did not
121
+ care. He slipped underneath the gate, and was safe at last in the wood
122
+ outside the garden.
123
+
124
+
125
+ Mr. McGregor hung up the little jacket and the shoes for a scare-crow
126
+ to frighten the blackbirds.
127
+
128
+ Peter never stopped running or looked behind him till he got home to
129
+ the big fir-tree.
130
+
131
+ He was so tired that he flopped down upon the nice soft sand on the
132
+ floor of the rabbit-hole and shut his eyes. His mother was busy
133
+ cooking; she wondered what he had done with his clothes. It was the
134
+ second little jacket and pair of shoes that Peter had lost in a
135
+ fortnight!
136
+
137
+
138
+ I am sorry to say that Peter was not very well during the evening.
139
+
140
+ His mother put him to bed, and made some camomile tea; and she gave a
141
+ dose of it to Peter!
142
+
143
+ 'One table-spoonful to be taken at bed-time.'
144
+
145
+
146
+ But Flopsy, Mopsy, and Cotton-tail had bread and milk and
147
+ blackberries for supper.
stories/The_Tale_of_Tom_Kitten.txt ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The Tale of Tom Kitten
2
+
3
+ Once upon a time there were three little kittens, and their names were
4
+ Mittens, Tom Kitten, and Moppet.
5
+
6
+ They had dear little fur coats of their own; and they tumbled about the
7
+ doorstep and played in the dust.
8
+
9
+ But one day their mother--Mrs. Tabitha Twitchit--expected friends to tea;
10
+ so she fetched the kittens indoors, to wash and dress them, before the
11
+ fine company arrived.
12
+
13
+
14
+ First she scrubbed their faces (this one is Moppet).
15
+
16
+ Then she brushed their fur, (this one is Mittens).
17
+
18
+
19
+ Then she combed their tails and whiskers (this is Tom Kitten).
20
+
21
+ Tom was very naughty, and he scratched.
22
+
23
+ Mrs. Tabitha dressed Moppet and Mittens in clean pinafores and tuckers;
24
+ and then she took all sorts of elegant uncomfortable clothes out of a
25
+ chest of drawers, in order to dress up her son Thomas.
26
+
27
+
28
+ Tom Kitten was very fat, and he had grown; several buttons burst off. His
29
+ mother sewed them on again.
30
+
31
+ When the three kittens were ready, Mrs. Tabitha unwisely turned them out
32
+ into the garden, to be out of the way while she made hot buttered toast.
33
+
34
+ "Now keep your frocks clean, children! You must walk on your hind legs.
35
+ Keep away from the dirty ash-pit, and from Sally Henny Penny, and from the
36
+ pig-stye and the Puddle-Ducks."
37
+
38
+
39
+ Moppet and Mittens walked down the garden path unsteadily. Presently they
40
+ trod upon their pinafores and fell on their noses.
41
+
42
+ When they stood up there were several green smears!
43
+
44
+ "Let us climb up the rockery, and sit on the garden wall," said Moppet.
45
+
46
+ They turned their pinafores back to front, and went up with a skip and a
47
+ jump; Moppet's white tucker fell down into the road.
48
+
49
+
50
+ Tom Kitten was quite unable to jump when walking upon his hind legs in
51
+ trousers. He came up the rockery by degrees, breaking the ferns, and
52
+ shedding buttons right and left.
53
+
54
+ He was all in pieces when he reached the top of the wall.
55
+
56
+ Moppet and Mittens tried to pull him together; his hat fell off, and the
57
+ rest of his buttons burst.
58
+
59
+
60
+ While they were in difficulties, there was a pit pat paddle pat! and the
61
+ three Puddle-Ducks came along the hard high road, marching one behind the
62
+ other and doing the goose step--pit pat paddle pat! pit pat waddle pat!
63
+
64
+ They stopped and stood in a row, and stared up at the kittens. They had
65
+ very small eyes and looked surprised.
66
+
67
+
68
+ Then the two duck-birds, Rebeccah and Jemima Puddle-Duck, picked up the
69
+ hat and tucker and put them on.
70
+
71
+ Mittens laughed so that she fell off the wall. Moppet and Tom descended
72
+ after her; the pinafores and all the rest of Tom's clothes came off on the
73
+ way down.
74
+
75
+ "Come! Mr. Drake Puddle-Duck," said Moppet--"Come and help us to dress
76
+ him! Come and button up Tom!"
77
+
78
+
79
+ Mr. Drake Puddle-Duck advanced in a slow sideways manner, and picked up
80
+ the various articles.
81
+
82
+ But he put them on himself! They fitted him even worse than Tom Kitten.
83
+
84
+ "It's a very fine morning!" said Mr. Drake Puddle-Duck.
85
+
86
+
87
+ And he and Jemima and Rebeccah Puddle-Duck set off up the road, keeping
88
+ step--pit pat, paddle pat! pit pat, waddle pat!
89
+
90
+ Then Tabitha Twitchit came down the garden and found her kittens on the
91
+ wall with no clothes on.
92
+
93
+
94
+ She pulled them off the wall, smacked them, and took them back to the
95
+ house.
96
+
97
+ "My friends will arrive in a minute, and you are not fit to be seen; I am
98
+ affronted," said Mrs. Tabitha Twitchit.
99
+
100
+ She sent them upstairs; and I am sorry to say she told her friends that
101
+ they were in bed with the measles; which was not true.
102
+
103
+
104
+ Quite the contrary; they were not in bed: not in the least.
105
+
106
+ Somehow there were very extraordinary noises over-head, which disturbed
107
+ the dignity and repose of the tea party.
108
+
109
+ And I think that some day I shall have to make another, larger, book, to
110
+ tell you more about Tom Kitten!
111
+
112
+
113
+ As for the Puddle-Ducks--they went into a pond.
114
+
115
+ The clothes all came off directly, because there were no buttons.
116
+
117
+
118
+ And Mr. Drake Puddle-Duck, and Jemima and Rebeccah, have been looking for
119
+ them ever since.
story_downloader/clean_stories.py ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Clean downloaded Gutenberg story files for TTS audiobook use.
3
+
4
+ Reference format: Three_LIttle_Pigs.txt
5
+ - Line 1: TITLE (all caps or title case)
6
+ - Line 2: blank
7
+ - Remaining: story text only (no metadata, illustrations, publisher info)
8
+
9
+ This script:
10
+ 1. Strips Gutenberg header (eBook preamble, author, language, credits, etc.)
11
+ 2. Strips Gutenberg footer (license boilerplate)
12
+ 3. Removes [Illustration] / [Illustration: ...] tags
13
+ 4. Removes publisher info, title pages, "Note:" blocks
14
+ 5. Removes _emphasis_ underscores (keeps the word)
15
+ 6. Removes BOM characters, excessive blank lines
16
+ 7. Writes cleaned files back in-place
17
+ """
18
+
19
+ import os
20
+ import re
21
+ from pathlib import Path
22
+
23
+ STORIES_DIR = Path(__file__).parent.parent / "stories"
24
+ REFERENCE_FILE = "Three_LIttle_Pigs.txt" # already clean, skip it
25
+
26
+ # Patterns that mark the START of Gutenberg header material (first line is title)
27
+ HEADER_PATTERNS = [
28
+ r"The Project Gutenberg eBook",
29
+ r"^\u feffThe Project Gutenberg", # BOM variant
30
+ r"^This eBook is for the use of",
31
+ r"^Title:",
32
+ r"^Author:",
33
+ r"^Release date:",
34
+ r"^Language:",
35
+ r"^Credits:",
36
+ r"^Other information and formats:",
37
+ r"^Illustrator:",
38
+ r"^Editor:",
39
+ r"^Most recently updated:",
40
+ ]
41
+
42
+ # Patterns that mark the START of Gutenberg footer
43
+ FOOTER_MARKERS = [
44
+ "End of the Project Gutenberg",
45
+ "End of Project Gutenberg",
46
+ "Updated editions will replace",
47
+ "*** END OF THE PROJECT GUTENBERG",
48
+ "*** END OF THIS PROJECT GUTENBERG",
49
+ "Uniform With This Volume",
50
+ "UNIFORMLY WITH THIS",
51
+ "PUBLISHED\nUNIFORMLY",
52
+ "* * * * *\n\n\nUniform",
53
+ ]
54
+
55
+ # Lines to remove entirely (exact or pattern match)
56
+ REMOVE_LINE_PATTERNS = [
57
+ re.compile(r"^\[Illustration[:\]].*$", re.IGNORECASE), # [Illustration] or [Illustration: ...]
58
+ re.compile(r"^\[Illustration\]$", re.IGNORECASE),
59
+ re.compile(r"^Note:.*Project Gutenberg.*$", re.IGNORECASE),
60
+ re.compile(r"^E-text prepared by.*$", re.IGNORECASE),
61
+ re.compile(r"^Transcriber.s Note.*$", re.IGNORECASE),
62
+ re.compile(r"^\s*https?://.*$"), # bare URLs
63
+ re.compile(r"^\s*\(https?://.*\)\s*$"), # (URLs)
64
+ re.compile(r"^\s*www\.gutenberg\.org.*$", re.IGNORECASE),
65
+ re.compile(r"^\s*See \d+-h\.htm.*$"),
66
+ re.compile(r"^\s*Images of the original pages.*$", re.IGNORECASE),
67
+ re.compile(r"^\s*Internet Archive.*$", re.IGNORECASE),
68
+ # Gutenberg metadata fields
69
+ re.compile(r"^\s*Author:.*$", re.IGNORECASE),
70
+ re.compile(r"^\s*Editor:.*$", re.IGNORECASE),
71
+ re.compile(r"^\s*Illustrator:.*$", re.IGNORECASE),
72
+ re.compile(r"^\s*Title:.*$", re.IGNORECASE),
73
+ re.compile(r"^\s*Release date:.*$", re.IGNORECASE),
74
+ re.compile(r"^\s*Most recently updated:.*$", re.IGNORECASE),
75
+ re.compile(r"^\s*Language:.*$", re.IGNORECASE),
76
+ re.compile(r"^\s*Other information and formats:.*$", re.IGNORECASE),
77
+ re.compile(r"^\s*Credits:.*$", re.IGNORECASE),
78
+ re.compile(r"^\s*\*\s*\*\s*\*\s*\*\s*\*\s*$"), # * * * * * dividers
79
+ ]
80
+
81
+ # Publisher/title-page noise patterns (only applied in the header zone, before story starts)
82
+ TITLE_PAGE_PATTERNS = [
83
+ re.compile(r"^\s*(BY|by)\s*$"),
84
+ re.compile(r"^\s*PRINTED IN.*$", re.IGNORECASE),
85
+ re.compile(r"^\s*COPYRIGHT.*$", re.IGNORECASE),
86
+ re.compile(r"^\s*PUBLISHED BY.*$", re.IGNORECASE),
87
+ re.compile(r"^\s*FREDERICK WARNE.*$", re.IGNORECASE),
88
+ re.compile(r"^\s*First published.*$", re.IGNORECASE),
89
+ re.compile(r"^\s*Printed and bound.*$", re.IGNORECASE),
90
+ re.compile(r"^\s*LONDON\.?\s*$", re.IGNORECASE),
91
+ re.compile(r"^\s*NEW YORK\.?\s*$", re.IGNORECASE),
92
+ re.compile(r"^\s*Dodd, Mead.*$", re.IGNORECASE),
93
+ re.compile(r"^\s*One Shilling Net\.?\s*$", re.IGNORECASE),
94
+ re.compile(r"^\s*With Drawings by.*$", re.IGNORECASE),
95
+ re.compile(r"^\s*With the Original Coloured.*$", re.IGNORECASE),
96
+ re.compile(r"^\s*Containing\s*$", re.IGNORECASE),
97
+ re.compile(r"^\s*_MARKS.S EDITION\._\s*$"),
98
+ re.compile(r"^\s*SAALFIELD PUBLISHING.*$", re.IGNORECASE),
99
+ re.compile(r"^\s*CHICAGO.*AKRON.*$", re.IGNORECASE),
100
+ re.compile(r"^\s*Online Distributed Proofreading.*$", re.IGNORECASE),
101
+ re.compile(r"^\s*Collections, University Libraries.*$", re.IGNORECASE),
102
+ re.compile(r"^\s*Book Cover\s*$", re.IGNORECASE),
103
+ re.compile(r"^\s*Edited by.*$", re.IGNORECASE),
104
+ re.compile(r"^\s*An Old English\s*$", re.IGNORECASE),
105
+ re.compile(r"^\s*Folk Tale\s*$", re.IGNORECASE),
106
+ re.compile(r"^\s*Retold\s*$", re.IGNORECASE),
107
+ re.compile(r"^\s*and\s*$"),
108
+ re.compile(r"^\s*or\s*$"),
109
+ re.compile(r"^\s*Illustrated\s*$", re.IGNORECASE),
110
+ ]
111
+
112
+
113
+ def is_title_line(line: str, title: str) -> bool:
114
+ """Check if a line is essentially a repetition of the story title."""
115
+ stripped = line.strip().strip("_").strip("*").strip().rstrip(".")
116
+ if not stripped or len(stripped) < 5:
117
+ return False
118
+ # Normalize both for comparison
119
+ norm_line = re.sub(r"[^a-z\s]", "", stripped.lower()).split()
120
+ norm_title = re.sub(r"[^a-z\s]", "", title.lower()).split()
121
+ if not norm_line or not norm_title:
122
+ return False
123
+ # The line must match the title closely (not just share a few words)
124
+ # At least 80% of title words must appear, and line can't be much longer
125
+ overlap = len(set(norm_line) & set(norm_title))
126
+ return overlap >= len(norm_title) * 0.8 and len(norm_line) <= len(norm_title) + 3
127
+
128
+
129
+ def find_story_start(lines: list[str], title: str) -> int:
130
+ """Find where the actual story narrative begins, past all header/title-page material."""
131
+ # Strategy: look for the LAST occurrence of the title in the header zone
132
+ # (first 30% of file), then find the first real narrative paragraph after it.
133
+ # Limit search to header zone to avoid matching title words in story text.
134
+ header_zone_end = min(len(lines), max(50, len(lines) // 3))
135
+
136
+ last_title_line = 0
137
+ for i in range(header_zone_end):
138
+ if is_title_line(lines[i], title):
139
+ last_title_line = i
140
+
141
+ # Now find the first narrative line after the last title occurrence
142
+ # A narrative line is: not empty, not a metadata line, not all caps short line,
143
+ # and contains actual sentence-like text
144
+ search_start = max(last_title_line + 1, 1)
145
+ for i in range(search_start, len(lines)):
146
+ line = lines[i].strip()
147
+ if not line:
148
+ continue
149
+ # Skip short all-caps lines (chapter headings on title page)
150
+ if line.isupper() and len(line) < 60:
151
+ continue
152
+ # Skip [Illustration] lines
153
+ if line.startswith("[Illustration"):
154
+ continue
155
+ # Skip publisher/metadata lines
156
+ if any(p.match(line) for p in TITLE_PAGE_PATTERNS):
157
+ continue
158
+ if any(p.match(line) for p in REMOVE_LINE_PATTERNS):
159
+ continue
160
+ # Skip "Author of..." attribution lines
161
+ if re.match(r'^Author of\b', line, re.IGNORECASE):
162
+ continue
163
+ # Skip publisher names
164
+ if re.match(r'^Frederick Warne', line, re.IGNORECASE):
165
+ continue
166
+ # Skip dedication blocks
167
+ if re.match(r'^DEDICATED\b', line, re.IGNORECASE):
168
+ continue
169
+ # Skip partial title fragments (single title words on their own line)
170
+ if line.isupper() and len(line.split()) <= 4:
171
+ continue
172
+ # Skip table-of-contents style lines (semicolons separating titles)
173
+ if line.count(";") >= 2 and not re.search(r'[.!?]', line):
174
+ continue
175
+ # Skip lines ending with just a colon (TOC entries, subtitles)
176
+ if re.match(r'^[^.!?]+:$', line):
177
+ continue
178
+ # Skip lines that are just a year (e.g. "1907 by Frederick Warne")
179
+ if re.match(r'^\d{4}\b', line):
180
+ continue
181
+ # Must contain lowercase letters (actual prose)
182
+ if re.search(r"[a-z]", line) and len(line) > 20:
183
+ # Final check: would clean_line remove this?
184
+ if clean_line(lines[i]) is not None:
185
+ return i
186
+
187
+ return search_start
188
+
189
+
190
+ def find_story_end(text: str) -> int:
191
+ """Find where Gutenberg footer begins. Returns char index or len(text)."""
192
+ for marker in FOOTER_MARKERS:
193
+ idx = text.find(marker)
194
+ if idx >= 0:
195
+ return idx
196
+ return len(text)
197
+
198
+
199
+ def clean_line(line: str) -> str | None:
200
+ """Clean a single line. Returns None if line should be removed entirely."""
201
+ # Remove BOM
202
+ line = line.replace("\ufeff", "")
203
+
204
+ # Remove [Illustration] and [Illustration: ...]
205
+ line = re.sub(r"\[Illustration[:\s][^\]]*\]", "", line)
206
+ line = re.sub(r"\[Illustration\]", "", line)
207
+
208
+ # Remove _emphasis_ underscores but keep the word
209
+ line = re.sub(r"_([^_]+)_", r"\1", line)
210
+
211
+ # Remove Gutenberg eBook header line
212
+ if "Project Gutenberg eBook" in line:
213
+ return None
214
+ # Remove license preamble
215
+ if "This eBook is for the use of anyone" in line:
216
+ return None
217
+ # Remove proofreading/credit lines
218
+ if "Distributed Proofreading" in line or "Proofreading Team" in line:
219
+ return None
220
+ if "pgdp.net" in line or "dp.rastko.net" in line:
221
+ return None
222
+ if "Project Gutenberg License" in line:
223
+ return None
224
+ # Remove publisher lines that may appear mid-file
225
+ if re.match(r"^\s*Frederick Warne", line.strip()):
226
+ return None
227
+ if re.match(r"^\s*Author of\b", line.strip(), re.IGNORECASE):
228
+ return None
229
+ # Remove dedication lines
230
+ if re.match(r"^\s*DEDICATED\b", line.strip()):
231
+ return None
232
+ # Remove author name lines (all caps, short)
233
+ if re.match(r"^\s*BEATRIX POTTER\s*$", line.strip()):
234
+ return None
235
+ if re.match(r"^\s*WALTER CRANE\s*$", line.strip()):
236
+ return None
237
+ # Remove quoted title reference lines ("The Tale of...", &c.)
238
+ if re.match(r'^\s*["\u201c].*["\u201d],?\s*&c\.?\s*$', line.strip()):
239
+ return None
240
+ # Remove printer/publisher lines
241
+ if re.match(r"^\s*William Clowes", line.strip(), re.IGNORECASE):
242
+ return None
243
+ # Remove dedication lines (TO ALL / PICKLES / --ESPECIALLY...)
244
+ stripped_check = line.strip()
245
+ if re.match(r"^(TO ALL|PICKLES|--ESPECIALLY)", stripped_check):
246
+ return None
247
+ if re.match(r"^GET UPON MY", stripped_check):
248
+ return None
249
+
250
+ # Check if line matches any remove pattern
251
+ stripped = line.strip()
252
+ for pattern in REMOVE_LINE_PATTERNS:
253
+ if pattern.match(stripped):
254
+ return None
255
+
256
+ return line
257
+
258
+
259
+ def clean_story(filepath: Path) -> bool:
260
+ """Clean a single story file. Returns True if modified."""
261
+ with open(filepath, "r", encoding="utf-8") as f:
262
+ raw = f.read()
263
+
264
+ # The first line is the title (from our download script)
265
+ lines = raw.split("\n")
266
+ title = lines[0].strip().replace("\ufeff", "")
267
+
268
+ # Find where footer starts and cut it
269
+ footer_pos = find_story_end(raw)
270
+ if footer_pos < len(raw):
271
+ # Find the line index corresponding to footer_pos
272
+ char_count = 0
273
+ footer_line = len(lines)
274
+ for i, line in enumerate(lines):
275
+ char_count += len(line) + 1 # +1 for \n
276
+ if char_count >= footer_pos:
277
+ footer_line = i
278
+ break
279
+ lines = lines[:footer_line]
280
+
281
+ # Find where actual story starts
282
+ story_start = find_story_start(lines, title)
283
+
284
+ # Extract just the story lines
285
+ story_lines = lines[story_start:]
286
+
287
+ # Clean each line
288
+ cleaned = []
289
+ for line in story_lines:
290
+ result = clean_line(line)
291
+ if result is not None:
292
+ cleaned.append(result)
293
+
294
+ # Collapse multiple blank lines into max 2
295
+ final_lines = cleaned
296
+ output_lines = []
297
+ blank_count = 0
298
+ for line in final_lines:
299
+ if line.strip() == "":
300
+ blank_count += 1
301
+ if blank_count <= 2:
302
+ output_lines.append("")
303
+ else:
304
+ blank_count = 0
305
+ output_lines.append(line)
306
+
307
+ # Strip trailing blank lines
308
+ while output_lines and output_lines[-1].strip() == "":
309
+ output_lines.pop()
310
+
311
+ # Build final text: TITLE\n\nstory_text\n
312
+ story_text = "\n".join(output_lines)
313
+
314
+ # Clean up any remaining artifacts
315
+ # Remove "Transcriber's Note" blocks at the end
316
+ story_text = re.sub(
317
+ r"\n\s*Transcriber.s Note.*$", "", story_text, flags=re.DOTALL | re.IGNORECASE
318
+ )
319
+
320
+ # Remove any "Obvious punctuation..." notes
321
+ story_text = re.sub(
322
+ r"\n\s*\*\s*Obvious punctuation.*$", "", story_text, flags=re.DOTALL | re.IGNORECASE
323
+ )
324
+
325
+ # Remove trailing publisher catalogs / book lists
326
+ story_text = re.sub(
327
+ r"\n\s*\*[\s*]+\*\s*\n.*$", "", story_text, flags=re.DOTALL
328
+ )
329
+ story_text = re.sub(
330
+ r"\n\s*PUBLISHED\s*\n.*$", "", story_text, flags=re.DOTALL | re.IGNORECASE
331
+ )
332
+ story_text = re.sub(
333
+ r"\n\s*Uniform With This.*$", "", story_text, flags=re.DOTALL | re.IGNORECASE
334
+ )
335
+ story_text = re.sub(
336
+ r"\n\s*UNIFORMLY? WITH THIS.*$", "", story_text, flags=re.DOTALL | re.IGNORECASE
337
+ )
338
+
339
+ # Remove trailing "THE END" marker
340
+ story_text = re.sub(r"\n\s*THE END\s*$", "", story_text, flags=re.IGNORECASE)
341
+
342
+ final = f"{title}\n\n{story_text.strip()}\n"
343
+
344
+ with open(filepath, "w", encoding="utf-8") as f:
345
+ f.write(final)
346
+
347
+ word_count = len(story_text.split())
348
+ print(f" Cleaned: {filepath.name} ({word_count} words)")
349
+ return True
350
+
351
+
352
+ def main():
353
+ if not STORIES_DIR.exists():
354
+ print(f"Stories directory not found: {STORIES_DIR}")
355
+ return
356
+
357
+ files = sorted(STORIES_DIR.glob("*.txt"))
358
+ cleaned = 0
359
+ skipped = 0
360
+
361
+ for filepath in files:
362
+ if filepath.name == REFERENCE_FILE:
363
+ print(f" Skipped (reference): {filepath.name}")
364
+ skipped += 1
365
+ continue
366
+
367
+ print(f"\n--- {filepath.name} ---")
368
+ try:
369
+ clean_story(filepath)
370
+ cleaned += 1
371
+ except Exception as e:
372
+ print(f" ERROR: {e}")
373
+
374
+ print(f"\n=== Done: {cleaned} cleaned, {skipped} skipped ===")
375
+
376
+
377
+ if __name__ == "__main__":
378
+ main()
story_downloader/download_stories.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Download 10 short children's stories from Project Gutenberg
3
+ and save them as text files under ../stories/
4
+
5
+ Uses direct cache URLs (more reliable than page scraping)
6
+ and the GutenbergDownloader's parse_text_book to strip headers/footers.
7
+ """
8
+
9
+ import sys
10
+ import os
11
+ import requests
12
+ import time
13
+
14
+ sys.path.insert(0, os.path.dirname(__file__))
15
+ from gutenberg_downloader import GutenbergDownloader
16
+ from pathlib import Path
17
+
18
+ # 10 short children's stories known to have plain text on Gutenberg
19
+ STORIES = [
20
+ {"id": 14838, "title": "The Tale of Peter Rabbit"},
21
+ {"id": 14407, "title": "The Tale of Benjamin Bunny"},
22
+ {"id": 14814, "title": "The Tale of Jemima Puddle-Duck"},
23
+ {"id": 14837, "title": "The Tale of Tom Kitten"},
24
+ {"id": 1988, "title": "The History of Tom Thumb"},
25
+ {"id": 18155, "title": "The Story of the Three Little Pigs"},
26
+ {"id": 18735, "title": "The Little Red Hen"},
27
+ {"id": 25877, "title": "The Little Gingerbread Man"},
28
+ {"id": 23521, "title": "The Sleeping Beauty"},
29
+ {"id": 37529, "title": "The Adventures of Puss in Boots"},
30
+ ]
31
+
32
+ # Direct URL patterns Gutenberg uses (try in order)
33
+ URL_PATTERNS = [
34
+ "https://www.gutenberg.org/cache/epub/{id}/pg{id}.txt",
35
+ "https://www.gutenberg.org/files/{id}/{id}-0.txt",
36
+ "https://www.gutenberg.org/files/{id}/{id}.txt",
37
+ ]
38
+
39
+
40
+ def download_raw(book_id: int) -> str | None:
41
+ """Try direct Gutenberg cache/file URLs to get plain text."""
42
+ for pattern in URL_PATTERNS:
43
+ url = pattern.format(id=book_id)
44
+ try:
45
+ r = requests.get(url, timeout=15)
46
+ if r.status_code == 200 and len(r.text) > 500:
47
+ print(f" Found at: {url}")
48
+ return r.text
49
+ except requests.RequestException:
50
+ continue
51
+ return None
52
+
53
+
54
+ def main():
55
+ downloader = GutenbergDownloader()
56
+ stories_dir = Path(__file__).parent.parent / "stories"
57
+ stories_dir.mkdir(parents=True, exist_ok=True)
58
+
59
+ success = 0
60
+ failed = 0
61
+
62
+ for story in STORIES:
63
+ filename = story["title"].replace(" ", "_").replace("'", "").replace("-", "_")
64
+ print(f"\n--- {story['title']} (#{story['id']}) ---")
65
+
66
+ raw = download_raw(story["id"])
67
+ if not raw:
68
+ print(f" FAILED to download")
69
+ failed += 1
70
+ continue
71
+
72
+ # Use the downloader's parser to strip Gutenberg boilerplate
73
+ book_data = downloader.parse_text_book(raw)
74
+ text = book_data.get("main_text", raw) if book_data else raw
75
+ title = book_data.get("title", story["title"]) if book_data else story["title"]
76
+
77
+ output_file = stories_dir / f"{filename}.txt"
78
+ with open(output_file, "w", encoding="utf-8") as f:
79
+ f.write(f"{title}\n\n{text}\n")
80
+
81
+ words = len(text.split())
82
+ print(f" Saved: {output_file.name} ({words} words)")
83
+ success += 1
84
+ time.sleep(1) # be polite to Gutenberg servers
85
+
86
+ print(f"\n=== Done: {success} succeeded, {failed} failed ===")
87
+
88
+
89
+ if __name__ == "__main__":
90
+ main()
story_downloader/example_usage.py ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Project Gutenberg Downloader - Example Usage
3
+
4
+ This script demonstrates how to use the GutenbergDownloader to download
5
+ and process free e-books from Project Gutenberg.
6
+
7
+ Project Gutenberg URLs:
8
+ - https://www.gutenberg.org/ebooks/11 - Alice's Adventures in Wonderland
9
+ - https://www.gutenberg.org/ebooks/1342 - Pride and Prejudice
10
+ - https://www.gutenberg.org/ebooks/98 - A Tale of Two Cities
11
+ - https://www.gutenberg.org/ebooks/219 - Heart of Darkness
12
+ - https://www.gutenberg.org/ebooks/514 - Little Women
13
+ - https://www.gutenberg.org/ebooks/4300 - Ulysses
14
+ - https://www.gutenberg.org/ebooks/1661 - Sherlock Holmes - A Study in Scarlet
15
+ """
16
+
17
+ import json
18
+ from pathlib import Path
19
+ from gutenberg_downloader import GutenbergDownloader
20
+
21
+
22
+ def example_1_single_book():
23
+ """Example 1: Download and process a single book."""
24
+ print("\n" + "=" * 70)
25
+ print("Example 1: Download and Process a Single Book")
26
+ print("=" * 70)
27
+
28
+ downloader = GutenbergDownloader(cache_dir="./gutenberg_cache")
29
+
30
+ # Download Alice in Wonderland
31
+ book_url = "https://www.gutenberg.org/ebooks/11"
32
+ print(f"\nDownloading from: {book_url}")
33
+
34
+ content = downloader.download_book(book_url, format_type="text")
35
+
36
+ if content:
37
+ print(f"Downloaded {len(content)} characters")
38
+
39
+ # Parse the book
40
+ book_data = downloader.parse_text_book(content)
41
+
42
+ print(f"\nBook Title: {book_data['title']}")
43
+ print(f"Chapters found: {len(book_data['chapters'])}")
44
+ print(f"Main text length: {len(book_data['main_text'])} characters")
45
+
46
+ # Display first chapter
47
+ if book_data['chapters']:
48
+ print(f"\nFirst chapter: {book_data['chapters'][0]}")
49
+
50
+ # Display first 500 characters of main text
51
+ print(f"\nFirst 500 characters of main text:")
52
+ print(book_data['main_text'][:500])
53
+
54
+ # Save to file
55
+ output_file = Path("./processed_books/alice.json")
56
+ output_file.parent.mkdir(parents=True, exist_ok=True)
57
+ with open(output_file, 'w', encoding='utf-8') as f:
58
+ json.dump(book_data, f, indent=2, ensure_ascii=False)
59
+ print(f"\nSaved to: {output_file}")
60
+ else:
61
+ print("Failed to download book")
62
+
63
+
64
+ def example_2_multiple_books():
65
+ """Example 2: Download and process multiple books."""
66
+ print("\n" + "=" * 70)
67
+ print("Example 2: Batch Download Multiple Books")
68
+ print("=" * 70)
69
+
70
+ downloader = GutenbergDownloader(cache_dir="./gutenberg_cache")
71
+
72
+ # List of books to download
73
+ books = [
74
+ ("https://www.gutenberg.org/ebooks/11", "Alice in Wonderland"),
75
+ ("https://www.gutenberg.org/ebooks/1342", "Pride and Prejudice"),
76
+ ("https://www.gutenberg.org/ebooks/98", "A Tale of Two Cities"),
77
+ ]
78
+
79
+ results = downloader.process_books(
80
+ [book_url for book_url, _ in books],
81
+ format_type="text",
82
+ output_dir="./processed_books"
83
+ )
84
+
85
+ print(f"\nProcessed {len(results)} books:\n")
86
+ for i, result in enumerate(results, 1):
87
+ if result['status'] == 'success':
88
+ print(f"{i}. {result['title']}")
89
+ print(f" File: {result['file']}")
90
+
91
+ # Load and display stats
92
+ with open(result['file'], 'r', encoding='utf-8') as f:
93
+ data = json.load(f)
94
+ print(f" Chapters: {len(data['chapters'])}")
95
+ print(f" Text length: {len(data['main_text'])} characters")
96
+ else:
97
+ print(f"{i}. FAILED: {result['url']}")
98
+ print()
99
+
100
+
101
+ def example_3_process_and_extract():
102
+ """Example 3: Process a book and extract specific information."""
103
+ print("\n" + "=" * 70)
104
+ print("Example 3: Process and Extract Specific Information")
105
+ print("=" * 70)
106
+
107
+ downloader = GutenbergDownloader(cache_dir="./gutenberg_cache")
108
+
109
+ # Download Pride and Prejudice
110
+ book_url = "https://www.gutenberg.org/ebooks/1342"
111
+ print(f"\nDownloading: {book_url}")
112
+
113
+ content = downloader.download_book(book_url, format_type="text")
114
+
115
+ if content:
116
+ book_data = downloader.parse_text_book(content)
117
+
118
+ print(f"\nTitle: {book_data['title']}")
119
+ print(f"Format: {book_data['format']}")
120
+ print(f"Source: {book_data['source']}")
121
+
122
+ # Extract and display chapters
123
+ print(f"\n--- Chapter Titles ({len(book_data['chapters'])} found) ---")
124
+ for i, chapter in enumerate(book_data['chapters'][:10], 1):
125
+ print(f"{i}. {chapter[:60]}") # Truncate for display
126
+
127
+ # Extract and display statistics
128
+ print(f"\n--- Content Statistics ---")
129
+ print(f"Total characters: {len(book_data['main_text']):,}")
130
+ print(f"Total words (approx): {len(book_data['main_text'].split()):,}")
131
+ print(f"Average chapter length: {len(book_data['main_text']) / len(book_data['chapters']):.0f} characters")
132
+
133
+ # Display text sample
134
+ print(f"\n--- Text Sample (first 800 characters) ---")
135
+ print(book_data['main_text'][:800])
136
+ print("...")
137
+
138
+
139
+ def example_4_save_as_text():
140
+ """Example 4: Save extracted book as plain text file."""
141
+ print("\n" + "=" * 70)
142
+ print("Example 4: Save Book as Plain Text File")
143
+ print("=" * 70)
144
+
145
+ downloader = GutenbergDownloader(cache_dir="./gutenberg_cache")
146
+
147
+ # Download Little Women
148
+ book_url = "https://www.gutenberg.org/ebooks/514"
149
+ print(f"\nDownloading: {book_url}")
150
+
151
+ content = downloader.download_book(book_url, format_type="text")
152
+
153
+ if content:
154
+ book_data = downloader.parse_text_book(content)
155
+
156
+ # Create output file
157
+ output_file = Path("./processed_books/little_women.txt")
158
+ output_file.parent.mkdir(parents=True, exist_ok=True)
159
+
160
+ with open(output_file, 'w', encoding='utf-8') as f:
161
+ # Write title
162
+ f.write(f"{'='*70}\n")
163
+ f.write(f"{book_data['title']}\n")
164
+ f.write(f"{'='*70}\n\n")
165
+
166
+ # Write chapter list
167
+ if book_data['chapters']:
168
+ f.write("CHAPTERS:\n")
169
+ for chapter in book_data['chapters']:
170
+ f.write(f" - {chapter}\n")
171
+ f.write("\n" + "="*70 + "\n\n")
172
+
173
+ # Write main text
174
+ f.write(book_data['main_text'])
175
+
176
+ print(f"Saved to: {output_file}")
177
+ print(f"File size: {output_file.stat().st_size:,} bytes")
178
+
179
+
180
+ def example_5_extract_first_chapter():
181
+ """Example 5: Extract and save only the first chapter."""
182
+ print("\n" + "=" * 70)
183
+ print("Example 5: Extract and Save First Chapter")
184
+ print("=" * 70)
185
+
186
+ downloader = GutenbergDownloader(cache_dir="./gutenberg_cache")
187
+
188
+ # Download A Tale of Two Cities
189
+ book_url = "https://www.gutenberg.org/ebooks/98"
190
+ print(f"\nDownloading: {book_url}")
191
+
192
+ content = downloader.download_book(book_url, format_type="text")
193
+
194
+ if content:
195
+ book_data = downloader.parse_text_book(content)
196
+
197
+ print(f"\nTitle: {book_data['title']}")
198
+ print(f"Chapters: {len(book_data['chapters'])}")
199
+
200
+ # Find first chapter marker in text
201
+ if book_data['chapters']:
202
+ first_chapter = book_data['chapters'][0]
203
+ print(f"\nFirst chapter: {first_chapter}")
204
+
205
+ # Save first chapter metadata
206
+ chapter_data = {
207
+ 'book_title': book_data['title'],
208
+ 'chapter_title': first_chapter,
209
+ 'chapter_number': 1,
210
+ 'text_preview': book_data['main_text'][:1000]
211
+ }
212
+
213
+ output_file = Path("./processed_books/chapter_extract.json")
214
+ output_file.parent.mkdir(parents=True, exist_ok=True)
215
+ with open(output_file, 'w', encoding='utf-8') as f:
216
+ json.dump(chapter_data, f, indent=2, ensure_ascii=False)
217
+
218
+ print(f"\nSaved chapter data to: {output_file}")
219
+
220
+
221
+ def example_6_api_usage():
222
+ """Example 6: Using the downloader as a Python API."""
223
+ print("\n" + "=" * 70)
224
+ print("Example 6: Python API Usage")
225
+ print("=" * 70)
226
+
227
+ # Initialize downloader
228
+ downloader = GutenbergDownloader(cache_dir="./gutenberg_cache")
229
+
230
+ # Download a book
231
+ print("\nDownloading book...")
232
+ content = downloader.download_book(
233
+ "https://www.gutenberg.org/ebooks/11",
234
+ format_type="text"
235
+ )
236
+
237
+ # Parse the book
238
+ print("Parsing book...")
239
+ book_data = downloader.parse_text_book(content)
240
+
241
+ # Access data programmatically
242
+ print(f"\nBook Title: {book_data['title']}")
243
+ print(f"Format: {book_data['format']}")
244
+ print(f"Source: {book_data['source']}")
245
+ print(f"Chapters: {len(book_data['chapters'])}")
246
+
247
+ # Use the data in your application
248
+ book_json = json.dumps(book_data, ensure_ascii=False)
249
+ print(f"\nJSON representation size: {len(book_json):,} bytes")
250
+
251
+
252
+ def main():
253
+ """Run all examples."""
254
+ print("\n")
255
+ print("#" * 70)
256
+ print("# Project Gutenberg Downloader - Usage Examples")
257
+ print("#" * 70)
258
+
259
+ # Run examples
260
+ try:
261
+ example_1_single_book()
262
+ except Exception as e:
263
+ print(f"Example 1 error: {e}")
264
+
265
+ try:
266
+ example_2_multiple_books()
267
+ except Exception as e:
268
+ print(f"Example 2 error: {e}")
269
+
270
+ try:
271
+ example_3_process_and_extract()
272
+ except Exception as e:
273
+ print(f"Example 3 error: {e}")
274
+
275
+ try:
276
+ example_4_save_as_text()
277
+ except Exception as e:
278
+ print(f"Example 4 error: {e}")
279
+
280
+ try:
281
+ example_5_extract_first_chapter()
282
+ except Exception as e:
283
+ print(f"Example 5 error: {e}")
284
+
285
+ try:
286
+ example_6_api_usage()
287
+ except Exception as e:
288
+ print(f"Example 6 error: {e}")
289
+
290
+ print("\n" + "=" * 70)
291
+ print("All examples completed!")
292
+ print("=" * 70 + "\n")
293
+
294
+
295
+ if __name__ == "__main__":
296
+ main()
story_downloader/gutenberg_downloader.py ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Project Gutenberg E-Book Downloader and Cleaner
3
+
4
+ Downloads and processes free e-books from Project Gutenberg.
5
+ Supports both Plain TEXT UTF-8 and EPUB formats.
6
+ Outputs cleaned text with title, chapter titles, and main content.
7
+ """
8
+
9
+ import re
10
+ import requests
11
+ import os
12
+ import logging
13
+ from typing import List, Dict, Optional, Tuple
14
+ from pathlib import Path
15
+ from urllib.parse import urljoin, urlparse
16
+ import json
17
+
18
+ # Try to import ebooklib for EPUB support
19
+ try:
20
+ from ebooklib import epub
21
+ EPUB_SUPPORT = True
22
+ except ImportError:
23
+ EPUB_SUPPORT = False
24
+
25
+ # Try to import lxml for HTML parsing
26
+ try:
27
+ from lxml import html
28
+ LXML_SUPPORT = True
29
+ except ImportError:
30
+ LXML_SUPPORT = False
31
+
32
+ # Configure logging
33
+ logging.basicConfig(
34
+ level=logging.INFO,
35
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
36
+ )
37
+ logger = logging.getLogger(__name__)
38
+
39
+
40
+ class GutenbergDownloader:
41
+ """Downloads and processes e-books from Project Gutenberg."""
42
+
43
+ GUTENBERG_URL = "https://www.gutenberg.org"
44
+
45
+ # Common Gutenberg headers/footers patterns to remove
46
+ FOOTER_PATTERNS = [
47
+ r'\*\*\*.*?END.*?PROJECT GUTENBERG.*?\*\*\*',
48
+ r'End of the Project Gutenberg.*',
49
+ r'This eBook is for the use of anyone.*?freely under.*?\.',
50
+ ]
51
+
52
+ HEADER_PATTERNS = [
53
+ r'\*\*\*.*?START.*?PROJECT GUTENBERG.*?\*\*\*',
54
+ r'Produced by.*?\n',
55
+ r'This eBook is for the use of anyone.*?freely under.*?\.',
56
+ ]
57
+
58
+ def __init__(self, cache_dir: str = "./gutenberg_cache"):
59
+ """Initialize downloader with optional caching."""
60
+ self.cache_dir = Path(cache_dir)
61
+ self.cache_dir.mkdir(parents=True, exist_ok=True)
62
+ self.session = requests.Session()
63
+ self.session.headers.update({
64
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
65
+ })
66
+
67
+ def download_book(self, book_url: str, format_type: str = "text") -> Optional[str]:
68
+ """
69
+ Download a book from Project Gutenberg.
70
+
71
+ Args:
72
+ book_url: URL of the book on Project Gutenberg
73
+ format_type: Either "text" for Plain TEXT UTF-8 or "epub" for EPUB format
74
+
75
+ Returns:
76
+ Content of the downloaded book or None if download fails
77
+ """
78
+ try:
79
+ logger.info(f"Downloading book from: {book_url}")
80
+
81
+ # Get the book page
82
+ response = self.session.get(book_url, timeout=10)
83
+ response.raise_for_status()
84
+
85
+ # Extract download links from the page
86
+ download_url = self._extract_download_url(response.text, format_type)
87
+
88
+ if not download_url:
89
+ logger.warning(f"Could not find {format_type} download link for {book_url}")
90
+ return None
91
+
92
+ # Ensure URL is absolute
93
+ if not download_url.startswith('http'):
94
+ download_url = urljoin(self.GUTENBERG_URL, download_url)
95
+
96
+ logger.info(f"Downloading from: {download_url}")
97
+
98
+ # Download the actual book file
99
+ response = self.session.get(download_url, timeout=30)
100
+ response.raise_for_status()
101
+
102
+ logger.info("Book downloaded successfully")
103
+ return response.text if format_type == "text" else response.content
104
+
105
+ except requests.RequestException as e:
106
+ logger.error(f"Error downloading book: {e}")
107
+ return None
108
+ except Exception as e:
109
+ logger.error(f"Unexpected error: {e}")
110
+ return None
111
+
112
+ def _extract_download_url(self, page_html: str, format_type: str) -> Optional[str]:
113
+ """
114
+ Extract the download URL for the specified format from book page HTML.
115
+
116
+ Args:
117
+ page_html: HTML content of the book page
118
+ format_type: "text" or "epub"
119
+
120
+ Returns:
121
+ Download URL or None if not found
122
+ """
123
+ try:
124
+ if LXML_SUPPORT:
125
+ tree = html.fromstring(page_html)
126
+
127
+ if format_type.lower() == "text":
128
+ # Look for UTF-8 plain text link
129
+ links = tree.xpath('//a[contains(@href, "cache") and contains(@href, ".txt.utf-8")]/@href')
130
+ if links:
131
+ return links[0]
132
+ elif format_type.lower() == "epub":
133
+ # Look for EPUB link
134
+ links = tree.xpath('//a[contains(@href, ".epub.images") or contains(@href, ".epub")]/@href')
135
+ if links:
136
+ return links[0]
137
+ else:
138
+ # Fallback: use regex if lxml not available
139
+ if format_type.lower() == "text":
140
+ match = re.search(r'href="([^"]*\.txt\.utf-8[^"]*)"', page_html)
141
+ if match:
142
+ return match.group(1)
143
+ elif format_type.lower() == "epub":
144
+ match = re.search(r'href="([^"]*\.epub[^"]*)"', page_html)
145
+ if match:
146
+ return match.group(1)
147
+
148
+ return None
149
+ except Exception as e:
150
+ logger.error(f"Error extracting download URL: {e}")
151
+ return None
152
+
153
+ def parse_text_book(self, content: str) -> Dict[str, any]:
154
+ """
155
+ Parse a plain text book and extract title, chapters, and content.
156
+
157
+ Args:
158
+ content: Plain text content of the book
159
+
160
+ Returns:
161
+ Dictionary with title, chapters, and cleaned text
162
+ """
163
+ try:
164
+ # Remove Project Gutenberg header and footer
165
+ cleaned = self._remove_gutenberg_boilerplate(content)
166
+
167
+ # Extract title (first non-empty line or from metadata)
168
+ title = self._extract_title(cleaned)
169
+
170
+ # Split into chapters
171
+ chapters = self._extract_chapters(cleaned)
172
+
173
+ # Clean content
174
+ main_text = self._clean_text(cleaned)
175
+
176
+ return {
177
+ 'title': title,
178
+ 'chapters': chapters,
179
+ 'main_text': main_text,
180
+ 'format': 'text',
181
+ 'source': 'Project Gutenberg'
182
+ }
183
+ except Exception as e:
184
+ logger.error(f"Error parsing text book: {e}")
185
+ return None
186
+
187
+ def parse_epub_book(self, content: bytes) -> Optional[Dict[str, any]]:
188
+ """
189
+ Parse an EPUB book and extract title, chapters, and content.
190
+
191
+ Args:
192
+ content: EPUB file content (bytes)
193
+
194
+ Returns:
195
+ Dictionary with title, chapters, and cleaned text
196
+ """
197
+ if not EPUB_SUPPORT:
198
+ logger.error("EPUB support not available. Install ebooklib: pip install ebooklib")
199
+ return None
200
+
201
+ try:
202
+ # Save to temporary file for ebooklib
203
+ import tempfile
204
+ with tempfile.NamedTemporaryFile(suffix='.epub', delete=False) as tmp:
205
+ tmp.write(content)
206
+ tmp_path = tmp.name
207
+
208
+ try:
209
+ # Read EPUB
210
+ book = epub.read_epub(tmp_path)
211
+
212
+ # Extract title
213
+ title = book.get_metadata('DC', 'title')
214
+ if title:
215
+ title = title[0][0] if isinstance(title, list) else title
216
+ else:
217
+ title = "Untitled"
218
+
219
+ # Extract chapters and content
220
+ chapters = []
221
+ main_text_parts = []
222
+
223
+ for item in book.get_items():
224
+ if item.get_type() == epub.ITEM_DOCUMENT:
225
+ text = self._extract_text_from_epub_item(item)
226
+ if text.strip():
227
+ main_text_parts.append(text)
228
+ # Simple chapter detection
229
+ if re.match(r'^(Chapter|CHAPTER|\d+)', text.strip()):
230
+ chapters.append(text[:100])
231
+
232
+ main_text = '\n\n'.join(main_text_parts)
233
+ main_text = self._clean_text(main_text)
234
+
235
+ return {
236
+ 'title': title,
237
+ 'chapters': chapters,
238
+ 'main_text': main_text,
239
+ 'format': 'epub',
240
+ 'source': 'Project Gutenberg'
241
+ }
242
+ finally:
243
+ # Clean up temp file
244
+ os.unlink(tmp_path)
245
+
246
+ except Exception as e:
247
+ logger.error(f"Error parsing EPUB book: {e}")
248
+ return None
249
+
250
+ def _extract_text_from_epub_item(self, item) -> str:
251
+ """Extract text content from an EPUB item."""
252
+ try:
253
+ content = item.get_content().decode('utf-8', errors='ignore')
254
+ if LXML_SUPPORT:
255
+ tree = html.fromstring(content)
256
+ text = tree.text_content()
257
+ else:
258
+ # Simple HTML tag removal
259
+ text = re.sub(r'<[^>]+>', '', content)
260
+ return text
261
+ except Exception as e:
262
+ logger.warning(f"Error extracting text from EPUB item: {e}")
263
+ return ""
264
+
265
+ def _remove_gutenberg_boilerplate(self, content: str) -> str:
266
+ """Remove Project Gutenberg header and footer."""
267
+ # Remove header
268
+ for pattern in self.HEADER_PATTERNS:
269
+ content = re.sub(pattern, '', content, flags=re.IGNORECASE | re.DOTALL)
270
+
271
+ # Remove footer
272
+ for pattern in self.FOOTER_PATTERNS:
273
+ content = re.sub(pattern, '', content, flags=re.IGNORECASE | re.DOTALL)
274
+
275
+ return content
276
+
277
+ def _extract_title(self, content: str) -> str:
278
+ """Extract the book title from content."""
279
+ # Look for "Title:" at the beginning
280
+ match = re.search(r'^Title:\s*(.+?)(?:\nAuthor:|$)', content, re.MULTILINE)
281
+ if match:
282
+ return match.group(1).strip()
283
+
284
+ # Otherwise, use first non-empty line
285
+ for line in content.split('\n'):
286
+ line = line.strip()
287
+ if line and len(line) > 5 and len(line) < 200:
288
+ return line
289
+
290
+ return "Untitled"
291
+
292
+ def _extract_chapters(self, content: str) -> List[str]:
293
+ """Extract chapter titles from content."""
294
+ chapters = []
295
+
296
+ # Look for common chapter patterns
297
+ patterns = [
298
+ r'^(CHAPTER\s+\w+[:\.]?\s*.*)$',
299
+ r'^(Chapter\s+\d+[:\.]?\s*.*)$',
300
+ r'^(\d+\.\s+.+?)$',
301
+ r'^(Part\s+\w+[:\.]?\s*.*)$',
302
+ ]
303
+
304
+ for pattern in patterns:
305
+ for match in re.finditer(pattern, content, re.MULTILINE):
306
+ chapter = match.group(1).strip()
307
+ if chapter not in chapters:
308
+ chapters.append(chapter)
309
+
310
+ return chapters[:20] # Return first 20 chapters
311
+
312
+ def _clean_text(self, content: str) -> str:
313
+ """
314
+ Clean text content by removing extra whitespace and formatting artifacts.
315
+
316
+ Args:
317
+ content: Raw text content
318
+
319
+ Returns:
320
+ Cleaned text
321
+ """
322
+ # Remove multiple consecutive blank lines
323
+ content = re.sub(r'\n\n\n+', '\n\n', content)
324
+
325
+ # Remove lines that are just underscores/dashes/asterisks (decorative)
326
+ content = re.sub(r'^\s*[_\-*]+\s*$', '', content, flags=re.MULTILINE)
327
+
328
+ # Remove page break indicators
329
+ content = re.sub(r'\[\d+\]|\[Page\s+\d+\]', '', content)
330
+
331
+ # Clean up extra spaces within lines
332
+ content = re.sub(r' {2,}', ' ', content)
333
+
334
+ # Remove lines that are just whitespace
335
+ content = '\n'.join(line.rstrip() for line in content.split('\n'))
336
+
337
+ # Remove leading/trailing whitespace from the entire document
338
+ content = content.strip()
339
+
340
+ return content
341
+
342
+ def process_books(self, book_urls: List[str], format_type: str = "text",
343
+ output_dir: str = "./processed_books") -> List[Dict]:
344
+ """
345
+ Download and process multiple books.
346
+
347
+ Args:
348
+ book_urls: List of Project Gutenberg book URLs
349
+ format_type: "text" or "epub"
350
+ output_dir: Directory to save processed books
351
+
352
+ Returns:
353
+ List of processed book data
354
+ """
355
+ output_path = Path(output_dir)
356
+ output_path.mkdir(parents=True, exist_ok=True)
357
+
358
+ results = []
359
+
360
+ for url in book_urls:
361
+ logger.info(f"Processing: {url}")
362
+
363
+ # Download book
364
+ content = self.download_book(url, format_type)
365
+ if not content:
366
+ logger.warning(f"Skipping {url} - download failed")
367
+ continue
368
+
369
+ # Parse book
370
+ if format_type.lower() == "text":
371
+ book_data = self.parse_text_book(content)
372
+ elif format_type.lower() == "epub":
373
+ book_data = self.parse_epub_book(content)
374
+ else:
375
+ logger.error(f"Unsupported format: {format_type}")
376
+ continue
377
+
378
+ if not book_data:
379
+ logger.warning(f"Skipping {url} - parsing failed")
380
+ continue
381
+
382
+ # Save processed book
383
+ safe_filename = re.sub(r'[^\w\s-]', '', book_data['title']).replace(' ', '_')[:50]
384
+ output_file = output_path / f"{safe_filename}.json"
385
+
386
+ try:
387
+ with open(output_file, 'w', encoding='utf-8') as f:
388
+ json.dump(book_data, f, indent=2, ensure_ascii=False)
389
+ logger.info(f"Saved to: {output_file}")
390
+ results.append({
391
+ 'url': url,
392
+ 'title': book_data['title'],
393
+ 'file': str(output_file),
394
+ 'status': 'success'
395
+ })
396
+ except Exception as e:
397
+ logger.error(f"Error saving book: {e}")
398
+ results.append({
399
+ 'url': url,
400
+ 'status': 'error',
401
+ 'error': str(e)
402
+ })
403
+
404
+ return results
405
+
406
+
407
+ def main():
408
+ """Example usage of the downloader."""
409
+ downloader = GutenbergDownloader()
410
+
411
+ # Example: Download "Alice's Adventures in Wonderland"
412
+ books = [
413
+ "https://www.gutenberg.org/ebooks/11", # Alice in Wonderland
414
+ ]
415
+
416
+ results = downloader.process_books(books, format_type="text")
417
+
418
+ for result in results:
419
+ print(f"\n{result}")
420
+
421
+
422
+ if __name__ == "__main__":
423
+ main()