dict.prepare
Class UDDLParser

java.lang.Object
  extended by dict.prepare.ParserBase
      extended by dict.prepare.UDDLParser

public class UDDLParser
extends ParserBase

UDDL dictionary file parser. Used for creating index for text files from the Universal Dictionary Database http://www.dicts.info/uddl.php. The following format is assumed:

  1. the dictionary file is a plain text file encoded in UTF-8
  2. each translation is located in one line of this text file, lines are separated by CR, LF or both
  3. the lines consist of tokens separated by a tab character
  4. the first token contains one or more keywords, if there are more than one keywords, the keyword tokens are separated by whitespaces, semicolons, colons or dots

Version:
$Revision: 21 $
Author:
Daniel Stoinski

Field Summary
private static java.lang.String INDEX_SEPARATOR
          Separates the keyword part from the translation.
private static java.lang.String SEPARATORS
          Separates keywors within the index part.
 
Fields inherited from class dict.prepare.ParserBase
m_handler
 
Constructor Summary
UDDLParser(IDictParserHandler handler)
          Initializes the parser for the given handler.
 
Method Summary
protected  boolean processLine(java.lang.String s, int fileno, long from, long to)
          Extracts index keywords from one line of the dictionary file.
 
Methods inherited from class dict.prepare.ParserBase
getInstance, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDEX_SEPARATOR

private static final java.lang.String INDEX_SEPARATOR
Separates the keyword part from the translation.

See Also:
Constant Field Values

SEPARATORS

private static final java.lang.String SEPARATORS
Separates keywors within the index part.

See Also:
Constant Field Values
Constructor Detail

UDDLParser

public UDDLParser(IDictParserHandler handler)
Initializes the parser for the given handler.

Parameters:
handler - the handler for retrieving extracted index keywords.
Method Detail

processLine

protected boolean processLine(java.lang.String s,
                              int fileno,
                              long from,
                              long to)
Extracts index keywords from one line of the dictionary file.

Specified by:
processLine in class ParserBase
Parameters:
s - the line string from the dictionary file.
from - position of the line begin in the file.
to - position of the line end in the file.
fileno - index of the dictionary file, from which line s has been extracted.
Returns:
true, if the parsing process should continue, false if it has been interrupted.