HyphenationTree

This tree structure stores the hyphenation patterns in an efficient way for fast lookup. It provides the provides the method to hyphenate a word.

This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open override fun addClass(chargroup: String)

Add a character class to the tree. It is used by {@link PatternParser} as callback to add character classes. Character classes define the valid word characters for hyphenation. If a word contains a character not defined in any of the classes, it is not hyphenated. It also defines a way to normalize the characters in order to compare them with the stored patterns. Usually pattern files use only lower case characters, in this case a class for letter 'a', for example, should be defined as "aA", the first character being the normalization char.

Link copied to clipboard
open override fun addException(word: String, hyphenatedword: ArrayList<Any>)

Add an exception to the tree. It is used by {@link PatternParser PatternParser} class as callback to store the hyphenation exceptions.

Link copied to clipboard
open override fun addPattern(pattern: String, ivalue: String)

Add a pattern to the tree. Mainly, to be used by {@link PatternParser PatternParser} class as callback to add a pattern to the tree.

Link copied to clipboard
open fun balance()
Link copied to clipboard
open override fun clone(): TernaryTree
Link copied to clipboard
open fun find(key: String): Int
open fun find(key: CharArray, start: Int): Int
Link copied to clipboard
Link copied to clipboard
fun hyphenate(word: String, remainCharCount: Int, pushCharCount: Int): Hyphenation?

Hyphenate word and return a Hyphenation object.

fun hyphenate(w: CharArray, offset: Int, len0: Int, remainCharCount: Int, pushCharCount: Int): Hyphenation?

Hyphenate word and return an array of hyphenation points.

Link copied to clipboard
open fun insert(key: String, val: Char)
open fun insert(key: CharArray, start: Int, val: Char)
Link copied to clipboard
open fun knows(key: String): Boolean
Link copied to clipboard

Read hyphenation patterns from an XML file.

Link copied to clipboard
open fun printStats(out: Any)
Link copied to clipboard
open fun trimToSize()