NaNoGenMo / 2020

National Novel Generation Month, 2020 edition.
76 stars 0 forks source link

Alice's Adventures in Runonland #81

Open savetz opened 3 years ago

savetz commented 3 years ago

"Curiouser and curiouser!" cried Alice (they was so much surprised, that for the moment they quite forgot how to speak good English)

Alice's Adventures in Wonderland plus Through The Looking-Glass (for word count :) run through simple text replacements to:

I could't figure out the regex commands in python to lowercase a substitution, so there's things like "...and then There was nothing else to do" rather than "and then there was nothing else to do"

Samples:

Either the well was very deep, or they fell very slowly, for they had
plenty of time as they went down to look about their and to wonder what
was going to happen next, and then First, they tried to look down and make out
what they was coming to, but it was too dark to see anything; then they
looked at the sides of the well, and noticed that they were filled with
cupboards and book-shelves; here and there they saw maps and pictures
hung upon pegs, and then They took down a jar from one of the shelves as they
passed; it was labelled "ORANGE MARMALADE", but to their great
disappointment it was empty: they did not like to drop the jar for fear
of killing somebody underneath, so managed to put it into one of the
cupboards as they fell past it.

...

"I have answered three questions, and that is enough,"
    Said their parent; "don't give yourself airs!
Do you think I can listen all day to such stuff?
    Be off, or I'll kick you down stairs!"

"That is not said right," said the Caterpillar.

"Not _quite_ right, I'm afraid," said Alice, timidly; "some of the
words have got altered."

Code: alice-py.txt

Book: alice-out.txt

hugovk commented 3 years ago

Fun!


I could't figure out the regex commands in python to lowercase a substitution

You can do it with a lambda, like this:

https://stackoverflow.com/a/7588961/724176

For example:

>>> re.sub("\. +([A-Z])", lambda m: ", and then " + m.group(1).lower(), "was going to happen next. First, they tried to look down and make out")
'was going to happen next, and then first, they tried to look down and make out'