PyHyphen-0.2.1a - OpenOffice-like hyphenation

D

Dr. leo

Hi,

a couple of weeks ago I uploaded PyHyphen-0.1 on the PyPI. It is a wrapper
around the C library "hnj_hyphen 2.3" that ships with OpenOffice and Mozilla
products. You can have a look at PyHyphen at

http://pypi.python.org/pypi/PyHyphen/0.2.1a

I've tested it on Linux, but it should also run on Windows (for which I have
no C compiler and I think I won't get one as I am using W2K).

What PyHyphen can do is shown in the code example on the module's cover page
on PyPI. Unlike a wrapper module called 'pyhnj' written by someone from
Berkeley, PyHyphen supports non-standard hyphenation with replacements. It
is therefore suitable for all languages. It also accepts unicode objects.

There are no inherent limitations, let alone the max. length of words = 100.

Just download a hyphenation dictionary for your favorite language at
http://wiki.services.openoffice.org/wiki/Dictionaries

or use the included English one, ... and enjoy!

The 10 line 'example.py' included in the tarball shows how it works.

There are no doc strings yet (but a README), and the C source of the wrapper
module 'hyphenmodule.c' is lenthier than desirable. I will work on this as
soon as I can. For now I am not aware of any major bugs though.

My next plans are as follows:
- shorten and polish the C code
- add short doc strings
- add search paths for the dictionaries
- add a 'wrap' method to the convenience interface that selects the best
hyphenation (among a tuple of pairs) to fit in the current line
- modify the 'textwrap' module from the Standard Library to use hyphenation
instead of just pushing entire words into the next line

Any feedback or help, preferrably by e-mail ([email protected]) is
highly welcome. I won't read the postings here regularly.

Have fun!

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,838
Latest member
KandiceChi

Latest Threads

Top