hyphenation-0.2.0.1: Configurable Knuth-Liang hyphenation

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Infered

Text.Hyphenation.Hyphenator

Contents

Description

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

Synopsis

Documentation

data Hyphenator Source

Constructors

Hyphenator 

Fields

hyphenatorChars :: Char -> Char

a normalization function applied to input characters before applying patterns or exceptions

hyphenatorPatterns :: Patterns

hyphenation patterns stored in a trie

hyphenatorExceptions :: Exceptions

exceptions to the general hyphenation rules, hyphenated manually

hyphenatorLeftMin :: !Int

the number of characters as the start of a word to skip hyphenating, by default: 2

hyphenatorRightMin :: !Int

the number of characters at the end of the word to skip hyphenating, by default: 3

Hyphenate with a given set of patterns

hyphenate :: Hyphenator -> String -> [String]Source

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

 ghci> hyphenate english_US "supercalifragilisticexpialadocious"
 ["su","per","cal","ifrag","ilis","tic","ex","pi","al","ado","cious"]
 ghci> hyphenate english_US "hyphenation"
 ["hy","phen","ation"]