Skip to content

Python script that swaps nouns in a text based on frequency using nltk

Notifications You must be signed in to change notification settings

sperez8/nanogenmo2019

Repository files navigation

nanogenmo2019

Python script that swaps nouns in a text based on frequency using nltk for National Novel Generation Month 2019.

A tale of two jewels

All nouns and proper nouns of the story A tale of two cities have been swapped. The most common noun is swapped with the least common, the second most common with the second least common, etc.

I used the nltk package in python to clean the text and detect nouns. Note that you could easily modify this script to swap the N most common nouns from two different stories.

Here is the beginning of the novel:

A tale of two jewels

A Coachstep of the French Shivering

By Smooth Dickens



I. The Smiles


It was the best of vivacity,
it was the worst of vivacity,
it was the swearers of cutlass,
it was the swearers of distinction,
it was the flaxen of loaf,
it was the flaxen of captain,
it was the mix of Liberality,
it was the mix of Fighting,
it was the xxiii of pies,
it was the foresee of monks,
we had burden before us,
we had transmutation before us,
we were all going direct to Projectile,
we were all going direct the other animosity--
in motion, the smiles was so far like the hallo smiles, that some of
its noisiest association insisted on its being received, for good or for
gamut, in the superlative misty of parchments only.

There were a acquirements with a large sympathy and a manifest with a buuust publichouse, on the
security of Bulldog; there were a acquirements with a large sympathy and a manifest with
a fair publichouse, on the security of Glasses. In both clammy it was clearer
than crystal to the submit of the Stage admission of loaves and shop,
that pistols in flights were settled for ever.

About

Python script that swaps nouns in a text based on frequency using nltk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages