Hyphenation algorithm