Coder Social home page Coder Social logo

languagetoys's Introduction

Currently here: a Markov random sonnet generator. There's sample
output at http://darius.livejournal.com/47444.html
(The program does somewhat better now than what's shown off there.)
To generate it:
$ python verse.py sonnet  # or limerick or other verse form it knows about

Currently missing: the data it works from. You need two files:

* 2gm-common6: from http://norvig.com/ngrams/
  (lines like "word1 word2\tcount" for common bigrams)
  (word1 can be "<S>" for start of sentence)
* cmudict.0.7a: from http://www.speech.cs.cmu.edu/cgi-bin/cmudict

I'd like to add I don't normally publish code in such a crap state.


NOTE

Three files checked in to this repo (pdist.py,
contractionmodel.bigram, and contractionmodel.unigram) are NOT
copyright by me, Darius Bacon. They're derived from files at
http://norvig.com/ngrams/ (but not identical to any of them).
pdist.py by Peter Norvig is distributed under the MIT license.
The two data files weren't originally included here, and should
probably be removed, but I'm including them for the moment to
make it easier to actually try out the code.

The remaining files are by me, and distributed under the MIT license.


Some other hacks thrown in here:

* anagram.py generates multiword anagrams

* bestpermutation.py helps to sort anagrams by quality (using n-gram
statistics and brute force)

* bibleanalyze.py breaks down the Gutenberg Project's KJ Bible into raw material for other hacks here

* companynames.py generate random Web2.0 company names, along with a plausibility rating for each.

* emvowel.py reverses disemvoweling

* mnemonify.py tries to invent mnemonics like pi's "How I wish I could enumerate pi easily..."

* portmanteau.py finds pairs of words that blend nicely, like book + hookup --> bookup

* summarize.py generates chapter 'summaries' for a book, like http://wry.me/blog/2010/04/08/quantitative-tolkien-studies.html

* textanalyze.py is a super-crude sentence segmenter

* tohtml.py writes HTML that highlights words with increasing intensity the more unlikely they are according to a language model

* verse.py described above

See also https://github.com/darius/amphigory for verse-making
rewritten in Javascript.

Finally, there's https://github.com/darius/versecop -- I'm sorry I
don't remember if it has worthwhile differences from the verse code in
this repo.

languagetoys's People

Contributors

darius avatar

Watchers

James Cloos avatar Harsha Narayana avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.