dariusk / NaNoGenMo-2014

National Novel Generation Month, 2014 edition.
257 stars 17 forks source link

character swap #94

Open amanda opened 9 years ago

amanda commented 9 years ago

I'm going to try to make something that will take two texts and allow you to replace the character names in one with names from the other. Moby Dick with Mr. Darcy, Alice in Wonderland with Anna Karenina, etc. Simple but hopefully fun?

WhiteFangs commented 9 years ago

It would be really really fun if you swapped also all the descriptions about their personality and their physical appearance but that seems harder. And the problem is, characters are also defined by their actions. But anyway, it's already a fun idea! I would definitely read "Raskolnikov in Wonderland".

hugovk commented 9 years ago

Nice idea! I was considering doing a similar thing (but probably won't get time): a friend struggled reading Dostoyevsky due to the many similar and unfamiliar names could have a new book with, say, Fyodor Pavlovich replaced with Rodney Dennis.

NLTK is a good Python tool for identifying names of people.

amanda commented 9 years ago

progress: https://github.com/amandapickering/annainwonderland

it works on short texts i've been testing it with so far but there are many issues: first/last names, (anna karenina is also anna), it's not finding all the names (i don't know if this is something i can fix or ne_chunk), and i still need to fix the spacing in the output format and make it write to a file. hopefully will have a cleaner/better version soon!

amanda commented 9 years ago

late! and still not working how i want it, but working: https://github.com/amandapickering/annainwonderland/blob/master/cast_annainwonderland.py

to run: python cast_annainwonderland.py [book file]

it replaces character names in the text with the names you feed it, and writes the new text to a file in the current directory.

beware: if you use it on a long text, it's going to take a while. also: the output is all wrong, working on it. i have a lot to learn!

MichaelPaulukonis commented 9 years ago

Any update?

amanda commented 9 years ago

Erm, not really sorry :'( I did some more cleanup today but the output format is still pretty bad, and I need to figure out how to write to a PDF. I feel like maybe doing the whole thing over eventually...we'll see.

On Mon, Dec 29, 2014 at 12:44 PM, Michael Paulukonis < notifications@github.com> wrote:

Any update?

— Reply to this email directly or view it on GitHub https://github.com/dariusk/NaNoGenMo-2014/issues/94#issuecomment-68279322 .

MichaelPaulukonis commented 9 years ago

Output formatting is for publishers! Give us raw-text with paragraph breaks, and all is forgiven!

amanda commented 9 years ago

Haven't thoroughly tested it, but it's working! Writes to a file with line/paragraph breaks, sample output is in the repo: https://github.com/amandapickering/annainwonderland

enkiv2 commented 9 years ago

Is the fact that the swapped names are in single quotes a bug or a feature? I'm leaning toward feature :-)

On Tue Jan 13 2015 at 6:06:45 PM Amanda Pickering notifications@github.com wrote:

Haven't thoroughly tested it, but it's working! Writes to a file with line/paragraph breaks, sample output is in the repo: https://github.com/amandapickering/annainwonderland

— Reply to this email directly or view it on GitHub https://github.com/dariusk/NaNoGenMo-2014/issues/94#issuecomment-69839329 .

amanda commented 9 years ago

It was actually just me being lazy with the input list I had (parsed HTML where I neglected to get rid of the quotes around peoples' names) but I like how it turned out :)