Simplify test module
Update hyphenator test for new hyphenator API
pattern-trie: Fix typo in graph
R7RS Scheme library providing Knuth-Liang hyphenation, as used in TeX. Ported from the Haskell library by Edward Kmett.
(import (scheme base)
(srfi 1)
(hyphenate pattern-trie)
(hyphenate hyphenator))
(define patterns
(with-input-from-file "data/hyph-en-us.pat.txt"
pattern-trie-parse))
(define hyphenate (hyphenator patterns 2 3))
(append-map hyphenate '("word" "hyphenation" "by" "computer"))
; => ("word" "hy" "phen" "ation" "by" "com" "puter")
To run the tests you currently need Guile or Chibi Scheme.
WIP
The pattern-trie-graph
procedure from (hyphenate pattern-trie)
is useful
to see what a pattern trie looks like, conceptually. These graphs can be
compared with those from Liang's thesis.
The graph below shows a small trie of patterns which match on the word "hyphenation", with boxed sequences of numbers representing a hyphenation score up to that point.