org.foray.hyphen
Interface PatternConsumer

All Known Implementing Classes:
PatternTree

public interface PatternConsumer

Implementations of this interface take the information parsed by a PatternParser while it is parsing a Liang-style hyphenation file, and do something useful with it, presumably storing it in a structure that makes it available to other applications.


Method Summary
 void addClass(String characterClass)
          Add a Liang-style character class.
 void addException(String exceptionWord, int qtyMorphing)
          Add a Liang-style hyphenation exception.
 void addMorphException(String exceptionWord, String pre, String post, String no)
          Add a morphing hyphenation break to an exception word.
 void addPattern(String pattern)
          Add a Liang-style hyphenation pattern.
 void setHyphenChar(char hyphenChar)
          Sets the character that should be interpreted as the hyphenation character in exceptions.
 void setMinAfter(byte minAfter)
          Sets the minimum number of characters that should be left on a line before a hyphenation break.
 void setMinBefore(byte minBefore)
          Sets the minimum number of characters that should be at the beginning of a line after a hyphenation break.
 

Method Detail

setHyphenChar

void setHyphenChar(char hyphenChar)
Sets the character that should be interpreted as the hyphenation character in exceptions.

Parameters:
hyphenChar - The hyphenation character to set.
See Also:
addException(String, int)

setMinBefore

void setMinBefore(byte minBefore)
Sets the minimum number of characters that should be at the beginning of a line after a hyphenation break. This is different than the similar concept that might be specified by a client application at document-processing time, which is discretionary and for aesthetic purposes. Instead this value is needed to ensure that inaccurate hyphenation breaks are not generated.

Parameters:
minBefore - The minimum number of characters that should be at the beginning of a line after a hyphenation break.

setMinAfter

void setMinAfter(byte minAfter)
Sets the minimum number of characters that should be left on a line before a hyphenation break. This is different than the similar concept that might be specified by a client application at document-processing time, which is discretionary and for aesthetic purposes. Instead this value is needed at parse-time to ensure that inaccurate hyphenation breaks are not generated.

Parameters:
minAfter - The minimum number of characters that should be left on a line before a hyphenation break.

addClass

void addClass(String characterClass)
Add a Liang-style character class. 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. Character classes also define a way to normalize the characters in order to compare them with the stored patterns. Hyphenation is generally a case-insensitive operation, that is, the Strings "CE", "Ce", "cE", and "ce" should all be treated as equivalent for purposes of making hyphenation decisions. Therefore, pattern files usually use only lower case characters. To mark two characters as equivalent, they are included in the same character class, with the normalized character recorded first in that class. So, for the example above, a class "cC" and another "eE" would ensure that those characters were treated in a case-insensitive way.

Parameters:
characterClass - The character class to add.

addException

void addException(String exceptionWord,
                  int qtyMorphing)
Add a Liang-style hyphenation exception. An exception supercedes the result obtained by the algorithm. It is useful in cases where the algorith gives a bad result, in in which the user otherwise wants to provide his own hyphenation.

Parameters:
exceptionWord - The raw word for which the exception is being created. For example, the English pattern dictionary distributed with TeX includes the exception "oblig-a-tory", which is the text expected here.
qtyMorphing - The number of morph exceptions that will be added to this exception word.
See Also:
addMorphException(String, String, String, String)

addMorphException

void addMorphException(String exceptionWord,
                       String pre,
                       String post,
                       String no)
                       throws org.axsl.hyphen.HyphenationException
Add a morphing hyphenation break to an exception word. A morphing break opportunity is one that changes the spelling of the word if it is selected. A morph exception can only be added to a word that already is recorded as an exception, and for which the "qtyMorphing" is greater than 0.

Parameters:
exceptionWord - The raw word for which the exception is being created. This must be the same word that was used in addException(String, int).
pre - The "pre" portion of the special exception.
post - The "post" portion of the special exception.
no - The "no" portion of the special exception.
Throws:
org.axsl.hyphen.HyphenationException - If exceptionWord is not found in the exception words.

addPattern

void addPattern(String pattern)
Add a Liang-style hyphenation pattern.

Parameters:
pattern - The raw Liang-style pattern to be added, for example ".ab4i".


Copyright © 2017. All rights reserved.