Open savetz opened 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'
"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:
Code: alice-py.txt
Book: alice-out.txt