Prev |  | Next

## Normation: Implementing language specific features

###
General

With normation you can implement phonetic searches for a language and a lot more. Normation classes for several languages are already implemented. The description below gives you information for implementing an additional Normation class.

For normation a Java class needs to be implemented. The name of this Java class is provided in the property languageXNormationClassName.

The class name needs to include the package identification (no package identification if default package is used).

Per convention the Normation classes have as name NormationXXX where XXX is the value from the property languageXFilePostfix.

The normation class needs to inherit from the class de.kugihan.dictionaryformids.normation.Normation and provide a language specific implementation for the methods of the Normation class. Here is an extract from the Normation class:

         package de.kugihan.dictionaryformids.translation.normation;

         public class Normation {
                 public StringBuffer normateWord(StringBuffer nonNormatedWord) {
                     // default is to do nothing
                     return nonNormatedWord;
                 }

                 public Vector searchWord(String text) {
                     // default is to do return only the provided text
                     Vector words = new Vector();
                     words.addElement(new SearchedWord(text));
                     return words;
                 }

                 public Vector suggestionWord(String text) {
                     // default is to do return no suggestion
                     Vector suggestions = new Vector();
                     return suggestions;
                 }
         }

Writing Normation-classes is an easy task for the Java part. If you know some rules for a language but you do not know how to implement them in Java or you do not have an Java development environment, send us the rules and we will implement them and create the java Normation class for you.

In any case, if you did implement a Normation class, please send it to us, so that we can make it available for other users who might be interested.

### Implementation of method normatedWord

Overwrite the method normateWord for support of phonetic search. Or for search of words that have different spellings. This method takes a nonNormatedWord and returns a normated representation of that word.

Example: NormationGer parses the nonNormatedWord for the German 'Umlauts' (ä, ö, ü) and returns the word with the Umlaut-paraphrasing (ae, oe, ue). So the user can search for "Mädchen" or "Maedchen" and the translation will be found in both cases.

Note: in general you should also call NormationLib.defaultNormation as part of normatedWord. NormationLib.defaultNormation provides some general useful normations such as ignoring upper case/lower case and ignoring punctuation characters.

### Implementation of method searchWord

With searchWord you can generate additional words that are searched. searchWord returns a Vector of SearchedWord.

Example: NormationJpn generates a Hiragana and Katakana representation from a romaji input word. When the user enters a word in romaji, the search done for both Hiragana and Katakana.

### Implementation of method suggestionWord

With suggestionWord you can generate additional words that are suggested to the user when no match is found. The user then can pick a suggestion and re-run the translation. suggestionWord returns a Vector of SuggestedWord.

Prev | DfM-Creator Home | Next
Normation - Available classes |  | Multiple source dictionaries