|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.apache.lucene.analysis.compound.hyphenation.PatternParser
public class PatternParser
A SAX document handler to read and parse hyphenation patterns from a XML file. This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
| Constructor Summary | |
|---|---|
PatternParser()
|
|
PatternParser(PatternConsumer consumer)
|
|
| Method Summary | |
|---|---|
void |
addClass(String c)
Add a character class. |
void |
addException(String w,
ArrayList<Object> e)
Add a hyphenation exception. |
void |
addPattern(String p,
String v)
Add hyphenation patterns. |
void |
characters(char[] ch,
int start,
int length)
|
void |
endElement(String uri,
String local,
String raw)
|
protected String |
getExceptionWord(ArrayList<?> ex)
|
protected static String |
getInterletterValues(String pat)
|
protected static String |
getPattern(String word)
|
static void |
main(String[] args)
|
protected ArrayList<Object> |
normalizeException(ArrayList<?> ex)
|
void |
parse(File file)
Parses a hyphenation pattern file. |
void |
parse(InputSource source)
Parses a hyphenation pattern file. |
void |
parse(String filename)
Parses a hyphenation pattern file. |
protected String |
readToken(StringBuffer chars)
|
InputSource |
resolveEntity(String publicId,
String systemId)
|
void |
setConsumer(PatternConsumer consumer)
|
void |
startElement(String uri,
String local,
String raw,
Attributes attrs)
|
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PatternParser()
throws HyphenationException
HyphenationException
public PatternParser(PatternConsumer consumer)
throws HyphenationException
HyphenationException| Method Detail |
|---|
public void setConsumer(PatternConsumer consumer)
public void parse(String filename)
throws HyphenationException
filename - the filename
HyphenationException - In case of an exception while parsing
public void parse(File file)
throws HyphenationException
file - the pattern file
HyphenationException - In case of an exception while parsing
public void parse(InputSource source)
throws HyphenationException
source - the InputSource for the file
HyphenationException - In case of an exception while parsingprotected String readToken(StringBuffer chars)
protected static String getPattern(String word)
protected ArrayList<Object> normalizeException(ArrayList<?> ex)
protected String getExceptionWord(ArrayList<?> ex)
protected static String getInterletterValues(String pat)
public InputSource resolveEntity(String publicId,
String systemId)
resolveEntity in interface EntityResolverresolveEntity in class DefaultHandler
public void startElement(String uri,
String local,
String raw,
Attributes attrs)
startElement in interface ContentHandlerstartElement in class DefaultHandlerContentHandler.startElement(java.lang.String,
java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(String uri,
String local,
String raw)
endElement in interface ContentHandlerendElement in class DefaultHandlerContentHandler.endElement(java.lang.String,
java.lang.String, java.lang.String)
public void characters(char[] ch,
int start,
int length)
characters in interface ContentHandlercharacters in class DefaultHandlerContentHandler.characters(char[], int, int)public void addClass(String c)
PatternConsumer
addClass in interface PatternConsumerc - character group
public void addException(String w,
ArrayList<Object> e)
PatternConsumerHyphen instances
addException in interface PatternConsumer
public void addPattern(String p,
String v)
PatternConsumer
addPattern in interface PatternConsumerp - the patternv - interletter values expressed as a string of digit characters.
public static void main(String[] args)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||