Valid XHTML 1.0 Transitional

DictionaryUpdate classes

One important DictionaryGeneration customization is done by providing a "DictionaryUpdate"-class with a specific behavior. A customized "DictionaryUpdate"-class can be provided for each language. This is done via the property languageXDictionaryUpdateClassName in the DictionaryForMIDs.properties file, see section Configuring the properties of the file DictionaryForMIDs.properties.

You need to have a Java SDK installed on your PC for implementing DictionaryUpdate classes and you should have some basic Java knowledge.

The DictionaryUpdate class provides the following methods:

        package de.kugihan.dictionaryformids.dictgen.dictionaryupdate;
        public class DictionaryUpdate {

                public String updateDictionaryExpression(String dictionaryExpression) {
                    // default is to do nothing
                    return dictionaryExpression;
                }

                public String removeNonSearchParts(String expression) {
                    // default is to do nothing
                    return expression;
                }

                public void updateKeyWordVector(Vector keyWordVector) {
                    // default is to do nothing
                }
        }
        

First on the term 'expression': DictionaryGeneration reads strings from inputdictionaryfile till the separation character (or newline) is found. These strings are called expressions. An expression may contain one or more words, depending on your inputdictionaryfile. An expression could be for example "give up", then "give" would be a word and "up" would be a word of the expression. The words are put into the index files.
 

For each expression that is read for a language this method is called. This methods gets the expression that was read from the inputdictionaryfile (parameter dictionaryExpression) and returns the expression that goes into the generated dictionary. In the method updateDictionaryExpression you may do whatever conversion from the input expression to the generated expression.
 

An expression may contain some information that is useful for showing in the translation result, but is not useful for being included in the search indexes. For example, expressions from the inputdictionaryfile may be of the form "word [pronounciation]". The pronounciation may look cryptic and may not be useful for searching. Then the part in square brackets should be removed by the method removeNonSearchParts. Still the pronounciation will be shown by DictionaryForMIDs in the translation result.
The method removeNonSearchParts is called after the method updateDictionaryExpression.
 

For some dictionaries it turns out that there are words in the inputdictionaryfile that simply should be ignored. After DictionryGeneration did split up the expressions into its words this method is called. keyWordVector contains the list of  IndexKeyWordEntry objects:

public class IndexKeyWordEntry {
			public String keyWord; // the word for the index
			public SearchIndicator searchIndicator;  // typically not needed
		...
		}

In the method updateKeyWordVector those words that should not go in the dictionary can be removed from keyWordVector.
The method updateKeyWordVector is called after the method removeNonSearchParts.

For more advanced capabilities of the DictionaryUpdate-class, see here.