ABL4J (Alignment Based Learning for Java) - 0.9.7

org.schwiebert.abl4j.data.impl.abl
Class Word<T>

java.lang.Object
  extended by org.schwiebert.abl4j.data.impl.abl.Word<T>
All Implemented Interfaces:
Serializable, IWord<T>

public final class Word<T>
extends Object
implements Serializable, IWord<T>

This class is used to store a "word". In Abl4J, a word can be any java object. Note: Internally, ABL uses index to determine the equality of two words. The index is generated with the help of WordMapping and requires that Object.equals(Object) and Object.hashCode() are overwritten properly.

Author:
Menno van Zaanen (menno@ics.mq.edu.au) (original C++ Version), Jeroen Geertzen (j.geertzen@uvt.nl) (modifications in C++ Version), Stephan Schwiebert (sschwieb@spinfo.uni-koeln.de) (Java-Implementation)
See Also:
Serialized Form

Field Summary
private  int index
          index of current word
private static long serialVersionUID
           
static int UNDEF
           
 
Constructor Summary
Word()
           
 
Method Summary
 void addSentenceToWord(int sentenceId)
          This method registers the use of the current word in a sentence specified with parameter "sentenceId".
 boolean equals(Object obj)
          Two words are equal, if their indices are equal.
 int getIndex()
          Returns the index of the word.
 List<Integer> getSentenceOccurrences()
          Returns all sentences which contain this word.
 T getWord()
          Returns the underlying string of the word.
 int hashCode()
          Returns the hashcode of index, which is, as in Integer, the value itself.
 void init(int index)
          Initialize this word with the given index.
 String toString()
          Returns a String-representation of this word.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

UNDEF

public static final int UNDEF
See Also:
Constant Field Values

index

private int index
index of current word

Constructor Detail

Word

public Word()
Method Detail

hashCode

public int hashCode()
Description copied from interface: IWord
Returns the hashcode of index, which is, as in Integer, the value itself.

Specified by:
hashCode in interface IWord<T>
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Description copied from interface: IWord
Two words are equal, if their indices are equal.

Specified by:
equals in interface IWord<T>
Overrides:
equals in class Object

init

public void init(int index)
Description copied from interface: IWord
Initialize this word with the given index. That is, the unique represenation of the type of this IWord is mapped to index.

Specified by:
init in interface IWord<T>
Parameters:
index - the unique identifier of this IWord

getIndex

public int getIndex()
Description copied from interface: IWord
Returns the index of the word.

Specified by:
getIndex in interface IWord<T>
Returns:

getWord

public T getWord()
Description copied from interface: IWord
Returns the underlying string of the word.

Specified by:
getWord in interface IWord<T>
Returns:

addSentenceToWord

public void addSentenceToWord(int sentenceId)
This method registers the use of the current word in a sentence specified with parameter "sentenceId".

Specified by:
addSentenceToWord in interface IWord<T>
Parameters:
sentenceId - the id of the sequence

getSentenceOccurrences

public List<Integer> getSentenceOccurrences()
Description copied from interface: IWord
Returns all sentences which contain this word.

Specified by:
getSentenceOccurrences in interface IWord<T>

toString

public String toString()
Description copied from interface: IWord
Returns a String-representation of this word.

Specified by:
toString in interface IWord<T>
Overrides:
toString in class Object

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert