Class ConversionDictionary

java.lang.Object
  extended by ConversionDictionary

public class ConversionDictionary
extends java.lang.Object

This class represents the dictionary generated by DicExtractor and handed on to Replacer for conversion

Version:
0.1, November 2007
Author:
Johannes Dellert

Constructor Summary
ConversionDictionary()
          create a new conversion dictionary to store masking information sorted by POS classes
 
Method Summary
 void addEntry(java.lang.String pos, java.lang.String orth, java.lang.String conv)
          add a new entry (= the information from one leaf)
 java.lang.String getConv(java.lang.String pos, java.lang.String orth)
          retrieve the replace token for an original token
 java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> getMap()
          used by the morphology analyzer to get more direct access to the dictionary
static ConversionDictionary read(java.io.File keyFile)
          read a dictionary from a file as generated by writeToFile()
static ConversionDictionary readReverse(java.io.File keyFile)
          read a dictionary in reverse from a file as generated by writeToFile() dictionary is then in the correct format to be used for demasking
 void writeToFile(java.io.File outputFile)
          simply print out list sorted according to POS tags: POS original replacement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionDictionary

public ConversionDictionary()
create a new conversion dictionary to store masking information sorted by POS classes

Method Detail

addEntry

public void addEntry(java.lang.String pos,
                     java.lang.String orth,
                     java.lang.String conv)
add a new entry (= the information from one leaf)

Parameters:
pos - - the new entry's POS class
pos - - the new entry's original version
conv - - the new entry's masked version

getConv

public java.lang.String getConv(java.lang.String pos,
                                java.lang.String orth)
retrieve the replace token for an original token

Parameters:
pos - - the token's POS class
orth - - the token
Returns:
- the masked version of the token from the dictionary

getMap

public java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.String>> getMap()
used by the morphology analyzer to get more direct access to the dictionary

Returns:
- the dictionary structure to be processed by the morphology analyzer

writeToFile

public void writeToFile(java.io.File outputFile)
                 throws java.io.IOException,
                        java.lang.NullPointerException
simply print out list sorted according to POS tags: POS original replacement

Parameters:
- - the file to write the dictionary to
Throws:
java.io.IOException
java.lang.NullPointerException

read

public static ConversionDictionary read(java.io.File keyFile)
read a dictionary from a file as generated by writeToFile()

Parameters:
- - the file to write the dictionary to

readReverse

public static ConversionDictionary readReverse(java.io.File keyFile)
read a dictionary in reverse from a file as generated by writeToFile() dictionary is then in the correct format to be used for demasking

Parameters:
- - the file to write the dictionary to