Pyphen

Presentation

Pyphen is a pure Python module to hyphenate text using included or external Hunspell hyphenation dictionaries.

Usage

>>> import pyphen
>>> pyphen.language_fallback('nl_NL_variant1')
'nl_NL'
>>> 'nl_NL' in pyphen.LANGUAGES
True
>>> dic = pyphen.Pyphen(lang='nl_NL')
>>> dic.inserted('lettergrepen')
'let-ter-gre-pen'
>>> dic.wrap('autobandventieldopje', 11)
('autoband-', 'ventieldopje')
>>> for pair in dic.iterate('Amsterdam'):
...     print(pair)
...
('Amster', 'dam')
('Am', 'sterdam')

Features

Included Dictionaries

The dictionaries included in LibreOffice are distributed with Pyphen:

Download

Latest version of Pyphen is 0.9.4, released on January 24, 2016.

Pyphen available on PyPI. To install, just type pip install pyphen as superuser.

Pyphen is also packaged for ArchLinux, CentOS, Gentoo, Fedora and Mageia.

If you want the development version, take a look at the git repository on GitHub, or clone it thanks to git clone git://github.com/Kozea/Pyphen.git.

You can also download the Pyphen package of the git repository.

Contribute

Features, bugs, hacks, documentation, tests, dictionaries? Fork us on GitHub, or chat with us on IRC (##kozea on Freenode).

License

Pyphen is a friendly fork of the unmaintained python-hyphenator module.

Pyphen is released under the GPL 2.0+ ~ LGPL 2.1+ ~ MPL 1.1 tri-license. See COPYING.GPL, COPYING.LGPL and COPYING.MPL for more details.

The dictionaries included in Pyphen come from the LibreOffice’s git repository and are distributed under GPL, LGPL and/or MPL. See the dictionaries and LibreOffice’s repository for more details.