Class Anto
java.lang.Object
Anto
public class Anto
- extends java.lang.Object
An abstraction class for holding antonym definitions.
Constructed to read the file "anto.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 antonymes.
- See Also:
Syno
Field Summary |
java.io.File |
antofile
|
java.io.BufferedReader |
d
|
org.apache.commons.collections.map.MultiValueMap |
ht
|
Constructor Summary |
Anto()
Constructor for creating an Anto. |
Method Summary |
boolean |
isAnto(java.lang.String x,
java.lang.String y)
Method to check if a word is an antonyme of another. |
void |
setAnto(java.lang.String x,
java.lang.String y)
Method to define two words as antonymes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
antofile
public java.io.File antofile
d
public java.io.BufferedReader d
ht
public org.apache.commons.collections.map.MultiValueMap ht
Anto
public Anto()
- Constructor for creating an Anto. Tries to access the file "anto.dat".
If the files does not exist, it is created with default permissions. (Set by umask in UNIX environment)
isAnto
public boolean isAnto(java.lang.String x,
java.lang.String y)
- Method to check if a word is an antonyme of another.
Looks up all antonymes to the word in x, and then traverses all antonyme definitions.
Returns true if Y is found. That is, true is the words are antonymes, false if the pair is not defined.
- Parameters:
x
- the (gold) term to look upy
- the (test) term to compare
- Returns:
- true if the words are defined antonymes, else false
setAnto
public void setAnto(java.lang.String x,
java.lang.String y)
- Method to define two words as antonymes. Their sequence is not abitary: the first parameter is from GOLD and the second is from TEST.
Writes (appends) the result to anto.dat, and assumes that the file is availiable. (If it was not, there would not have been an instance of Anto availiable.)
- Parameters:
x
- the GOLD wordy
- the TEST word