• Stars
    star
    113
  • Rank 310,115 (Top 7 %)
  • Language
    Python
  • License
    Other
  • Created about 15 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python module to locate haikus in unstructured English text
Installer: http://MrFeinberg.com/haikufinder-1.1.zip

* 
*	REQUIRES NLTK, THE NATURAL LANGUAGE TOOLKIT
*	http://www.nltk.org/download
*

A Python hack to find "haikus" in English text. For the purposes of this
module, a "haiku" is one or more complete sentences that, together, can be
broken into groups of 5, 7, and 5 syllables. Each canididate haiku line, 
and then the entire haiku, has to make it through a few heuristics to 
filter out constructions that are likely to scan awkwardly (like verb 
phrases split across lines). Since this code doesn't really try to 
understand the texts, it might throw away a few legitimate phrases, and it 
certainly lets through some bad ones.

Any improvements would be welcomed.

The license, found in license.txt, is "modified BSD".

Example usage:

	text = open("ulysses.txt", "r").read()
	haikus = HaikuFinder(text).find_haikus()
	for haiku in haikus:
	    print haiku[0]
	    print "    %s" % haiku[1]
	    print haiku[2]
	    print

If you find that the HaikuFinder doesn't seem to recognize some word
you're using, or is counting its syllables incorrectly, you can say

    HaikuFinder.add_word('shmeggegge', 3)
    HaikuFinder.add_word('kvetch', 1)
    haikus = HaikuFinder('''
    	For this I should stay? To hear some shmeggegge kvetch about his lawsuit?
    	''').find_haikus()

If you like, you can fork the project, modify the custom.dict, and submit a pull
request. I'll accept all useful dictionary additions.

More Repositories

1

processing.py

Write Processing sketches in Python
Python
1,619
star
2

processing-py-site

Site for processing.py.
HTML
197
star
3

peasycam

Dead-simple mouse-driven camera for Processing
Java
114
star
4

Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41
star
5

patchy

Patchy provides an easy-to-use bicubic patch for 3D graphics in the Processing programming environment.
Java
10
star
6

equivalence-lock

Lock on an equivalence class instead of a particular object
Java
6
star
7

anti-grain-geometry

My personal fork of AGG 2.4 with fixes as I need them.
C++
6
star
8

unicode-for-smarties

Slides for a 60-minute introduction to Unicode.
JavaScript
5
star
9

javalin

Java LSystems framework, supporting a rich set of operators and primitives
Java
4
star
10

allrgb

My noodlings for the allrgb project
Java
4
star
11

html2text

A goofy Python hack for converting HTML to plain text. Uses lynx.
Python
3
star
12

jdf.animation

A tiny framework for implementing animations
Java
2
star
13

jdf.github.com

My github home away from home.
2
star
14

cv

My resume.
1
star
15

Todd

a wee jumping guy
JavaScript
1
star
16

haikufinder.webapp

The web app found at http://mrfeinberg.com/haikufinder/
Python
1
star
17

wordle.policy

App to fix b0rken Mac OSX policy config
Java
1
star
18

there-is-no-plain-text

Slides from a 5-minute talk
JavaScript
1
star
19

wordle.beautifulvis

A chapter for an upcoming O'Reilly book
1
star
20

filmore

A golang library to provide easy text outline hacking.
Go
1
star
21

processing.py.web

Website of the Processing.py project.
CSS
1
star