Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hyphenator ¶
type Hyphenator struct {
// contains filtered or unexported fields
}
Hyphenator holds the loaded patterns and the min-affix limits.
func New ¶
func New() *Hyphenator
func (*Hyphenator) AddPattern ¶
func (h *Hyphenator) AddPattern(p string)
addPattern parses one Liang pattern (e.g. "a1bc3d" or ".ach4") into its letter key and inter-letter value array (length = letters+1).
func (*Hyphenator) Mins ¶
func (h *Hyphenator) Mins() (left, right int)
Mins reports the current minimum number of letters before the first hyphen and after the last.
func (*Hyphenator) Points ¶
func (h *Hyphenator) Points(word string) []int
points returns the break positions in word: each value t means a hyphen is allowed after the first t letters (so between word[t-1] and word[t]).
func (*Hyphenator) SetMins ¶
func (h *Hyphenator) SetMins(left, right int)
SetMins sets how many letters must remain before the first hyphen and after the last. The defaults are 2 and 3 — the long-standing English convention, and the reason a five-letter word is never hyphenated; other languages, and other house styles, want otherwise.