Skip to main content
PyCon US is happening May 14th-22nd in Pittsburgh, PA USA.  Learn more

Determine hyphenation breaks in English words

Project description

Hyphenate, using Frank Liang’s algorithm.

This module provides a single function to hyphenate words. The hyphenate_word function takes a string (the word to hyphenate), and returns a list of parts that can be separated by hyphens. For example:

>>> from hyphenate import hyphenate_word
>>> hyphenate_word('hyphenation')
['hy', 'phen', 'ation']
>>> hyphenate_word('supercalifragilistic')
['su', 'per', 'cal', 'ifrag', 'ilis', 'tic']
>>> hyphenate_word('project')
['project']

This code, originally written by Ned Batchelder in July 2007, is in the public domain.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page