D
Dr. leo
Hi,
I have just uploaded the latest sources of PyHyphen
(http://cheeseshop.python.org/pypi/PyHyphen). The tarball also contains
Windows binaries of the C extension for Python 2.4 and 2.5. So most Windows
users will get going without compiling. Just enter the usual 'python
setup.py install'.
There are many bug fixes both in the Python modules on top as well as in the
C extension that uses a new release of the underlying hyphenation library
(hyphen-2.3.1).
Further, I have added a module 'dictools' for easy download and installation
of dictionaries (see below). Finally, a script for easy testing of the
hyphenation functionality with large wordlists and multiple dictionaries has
been added. Dictionaries are installed on the fly and everything is logged.
The default dir for dictionaries and the default repository to download
dictionaries are configurable, so that one can use existing dictionaries,
e.g., from an OpenOffice installation.
The package also includes and installs the module 'textwrap2' which adds a
hyphenation feature to the standard module textwrap.
Code example:
from hyphen import hyphenator
from hyphen.dictools import *
# Download and install some dictionaries in the default directory using the
default
# repository, usually the OpenOffice website
for lang in ['de_DE', 'fr_FR', 'en_UK', 'hu_HU']:
if not is_installed(lang): install(lang)
# Create some hyphenators
h_de = hyphenator('de_DE')
h_en = hyphenator('en_US')
h_hu = hyphenator('hu_HU')
# Now hyphenate some words
print h_hu.inserted(u'asszonnyal')
'asz=szony=nyal'
print h_en.pairs('beautiful')
[[u'beau', u'tiful'], [u'beauti', u'ful']]
print h_en.wrap('beautiful', 6)
[u'beau-', u'tiful']
print h_en.wrap('beautiful', 7)
[u'beauti-', u'ful']
from textwrap2 import fill
print fill('very long text...', width = 40, use_hyphens = h_en)
My thanks go to those who helped enormously with advice, suggestions,
criticism and Windows builds.
Regards
Leo
I have just uploaded the latest sources of PyHyphen
(http://cheeseshop.python.org/pypi/PyHyphen). The tarball also contains
Windows binaries of the C extension for Python 2.4 and 2.5. So most Windows
users will get going without compiling. Just enter the usual 'python
setup.py install'.
There are many bug fixes both in the Python modules on top as well as in the
C extension that uses a new release of the underlying hyphenation library
(hyphen-2.3.1).
Further, I have added a module 'dictools' for easy download and installation
of dictionaries (see below). Finally, a script for easy testing of the
hyphenation functionality with large wordlists and multiple dictionaries has
been added. Dictionaries are installed on the fly and everything is logged.
The default dir for dictionaries and the default repository to download
dictionaries are configurable, so that one can use existing dictionaries,
e.g., from an OpenOffice installation.
The package also includes and installs the module 'textwrap2' which adds a
hyphenation feature to the standard module textwrap.
Code example:
from hyphen import hyphenator
from hyphen.dictools import *
# Download and install some dictionaries in the default directory using the
default
# repository, usually the OpenOffice website
for lang in ['de_DE', 'fr_FR', 'en_UK', 'hu_HU']:
if not is_installed(lang): install(lang)
# Create some hyphenators
h_de = hyphenator('de_DE')
h_en = hyphenator('en_US')
h_hu = hyphenator('hu_HU')
# Now hyphenate some words
print h_hu.inserted(u'asszonnyal')
'asz=szony=nyal'
print h_en.pairs('beautiful')
[[u'beau', u'tiful'], [u'beauti', u'ful']]
print h_en.wrap('beautiful', 6)
[u'beau-', u'tiful']
print h_en.wrap('beautiful', 7)
[u'beauti-', u'ful']
from textwrap2 import fill
print fill('very long text...', width = 40, use_hyphens = h_en)
My thanks go to those who helped enormously with advice, suggestions,
criticism and Windows builds.
Regards
Leo