SourceForge.net Logo
aXSL API 0.1

org.axsl.hyphenR
Interface Hyphenation


public interface Hyphenation

Encapsulates a "word" and provides information about hyphenation break possibilities in that a word.


Method Summary
 HyphenBreak getHyphenBreak(int index)
          Provides detailed information about a hyphenation break opportunity if such information is available.
 byte[] getLiangWeights()
          Provides the same information as getWeights(), except the values returned use the Liang input scheme.
 int[] getPoints()
          Provides hyphenation point information for the underlying word.
 byte[] getWeights()
          Provides hyphenation point values for the underlying word.
 

Method Detail

getPoints

public int[] getPoints()
Provides hyphenation point information for the underlying word. Information for each character in the word is provided, some implicitly, some explicitly. Points not reported have an implicit value of zero (see getWeights() for details about the values. Points reported (that is, that have an explicit value) contain two pieces of information. First is the index to the character being reported, which is returned by this method. Second is the explicit value of that hyphenation point, which is returned in the corresponding element of getWeights(). Caveat: The array returned by this method is not necessarily a list of valid hyphenation points. Any corresponding negative values in getWeights() indicate a point that should be avoided. See the includeInhibitors parameter on HyphenationServer.hyphenate(char[], int, int, String, String, int, int, boolean) and its overloaded sister methods.

Returns:
A list of indexes to all non-zero hyphenation points.
See Also:
getWeights()

getWeights

public byte[] getWeights()
Provides hyphenation point values for the underlying word. The returned values have a one-to-one correspondence with the items returned by getPoints(). Valid values range from -2 (a truly awful hyphenation point) to +3 (an ideal hyphenation point). No returned values should be zero. All points in the words that have no explicit information reported have an implicit value of zero. The implied zero indicates that the word should not be hyphenated at that point, but that it is "less bad" than a lower explicit value. Note that it is important to report the negative values as well as the possible for cases where a "less bad" hyphenation point is better than no hyphenation point at all.

Returns:
An array containing the weights that correspond to each element in getPoints().
See Also:
getPoints(), getLiangWeights()

getLiangWeights

public byte[] getLiangWeights()

Provides the same information as getWeights(), except the values returned use the Liang input scheme. The Liang input scheme uses values between 0 and 5 (we exclude the 0 values since they are implied). We have expanded the range to between 0 and 9. Odd values indicate possible hyphenation points, even values (including 0) indicate points that should not be hyphenated. Higher numbers indicate a greater magnitude of "goodness" for odd numbers, and a greater magnitude of "badness" for even numbers. This method is included for backward compatibility with systems that may already be dependent on the Liang input scheme. (The Liang input scheme was probably optimized for input and point selection efficiency, but is somewhat counter-intuitive for an application that is evaluating the results).

The following table compares the values returned by the two methods. Note that, except for the difference between "good" and "bad", the various values have no absolute meanings, but only meanings relative to the others. Implementations are free to use some subset of the possible return values. For example, some implementations may return Liang values in the range 0 to 5, and others may return them in the range 0 to 9.

Description Weight Liang Input Scheme
better than below 5 9
better than below 4 7
better than below 3 5
better than below 2 3
allowable 1 1
avoid 0 0
worse than above -1 2
worse than above -2 4
worse than above -3 6
worse than above -4 8

Returns:
An array containing the Liang input weights that correspond to each element in getPoints().
See Also:
getWeights()

getHyphenBreak

public HyphenBreak getHyphenBreak(int index)
Provides detailed information about a hyphenation break opportunity if such information is available. Most hyphen break opportunities do not need such information, as their location (provided by getPoints() and values (provided by getWeights() and getLiangWeights() are sufficient to tell client applications everything they need to make hyphenation decisions. HyphenBreak provides extra information for certain "hard" cases.

Parameters:
index - The index into the array returned by getPoints() that specifies the point for which a HyphenBreak is desired.
Returns:
The HyphenBreak instance for the hyphen break opportunity at index, or null if there is none.

SourceForge.net Logo
aXSL API 0.1

This documentation was created September 6 2006 by The aXSL Group and may be freely copied. See license for details.