hyphenation-0.8.1: Configurable Knuth-Liang hyphenation

Text.Hyphenation.Hyphenator

Description

Hyphenation based on the Knuth-Liang algorithm as used by TeX.

Synopsis

# Documentation

A Hyphenator is combination of an alphabet normalization scheme, a set of Patterns, a set of Exceptions to those patterns and a number of characters at each end to skip hyphenating.

Constructors

 Hyphenator FieldshyphenatorChars :: Char -> Chara normalization function applied to input characters before applying patterns or exceptionshyphenatorPatterns :: Patternshyphenation patterns stored in a triehyphenatorExceptions :: Exceptionsexceptions to the general hyphenation rules, hyphenated manuallyhyphenatorLeftMin :: !Intthe number of characters as the start of a word to skip hyphenating, by default: 2hyphenatorRightMin :: !Intthe number of characters at the end of the word to skip hyphenating, by default: 3

# Hyphenate with a given set of patterns

hyphenate a single word using the specified Hyphenator. Returns a set of candidate breakpoints by decomposing the input into substrings.

>>> import Text.Hyphenation

>>> hyphenate english_US "supercalifragilisticexpialadocious"
["su","per","cal","ifrag","ilis","tic","ex","pi","al","ado","cious"]

>>> hyphenate english_US "hyphenation"
["hy","phen","ation"]