Class Syno

java.lang.Object
  extended by Syno

public class Syno
extends java.lang.Object

An abstraction class for holding synonym definitions. Constructed to read the file "syno.dat", which is a CSV-formatted file containg key,value-pairs. The contents of this file is availiable for getting and setting via public methods. This class employs the MultiValueMap from org.apache.commons.collections.map to be able to map one word to different synonymes.

See Also:
Anto

Field Summary
 java.io.BufferedReader d
           
 org.apache.commons.collections.map.MultiValueMap ht
           
 java.io.File synofile
           
 
Constructor Summary
Syno()
          Constructor for creating an Syno.
 
Method Summary
 boolean isSyno(java.lang.String x, java.lang.String y)
          Method to check if a word is an synonyme of another.
 void setSyno(java.lang.String x, java.lang.String y)
          Method to define two words as synonymes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

synofile

public java.io.File synofile

d

public java.io.BufferedReader d

ht

public org.apache.commons.collections.map.MultiValueMap ht
Constructor Detail

Syno

public Syno()
Constructor for creating an Syno. Tries to access the file "syno.dat". If the files does not exist, it is created with default permissions. (Set by umask in UNIX environment)

Method Detail

isSyno

public boolean isSyno(java.lang.String x,
                      java.lang.String y)
Method to check if a word is an synonyme of another. Looks up all synonymes to the word in x, and then traverses all synonyme definitions. Returns true if Y is found. That is, true is the words are synonymes, false if the pair is not defined.

Parameters:
x - the (gold) term to look up
y - the (test) term to compare
Returns:
true if the words are defined synonymes, else false

setSyno

public void setSyno(java.lang.String x,
                    java.lang.String y)
Method to define two words as synonymes. Their sequence is not abitary: the first parameter is from GOLD and the second is from TEST. Writes (appends) the result to syno.dat, and assumes that the file is availiable. (If it was not, there would not have been an instance of Synoavailiable.)

Parameters:
x - the GOLD word
y - the TEST word