ABL4J (Alignment Based Learning for Java) - 0.9.7

org.schwiebert.abl4j.data
Interface ISentence<T>

All Known Subinterfaces:
ITree<T>
All Known Implementing Classes:
Sentence, Tree

public interface ISentence<T>

An ISentence is used to store a sequence of IWords. Default implementation: Sentence.

Author:
sschwieb

Method Summary
 void addWords(List<IWord<T>> words)
          Adds all IWord stored in words to this sentence, as in List.addAll(java.util.Collection).
 void buildSimilarSentencesSet()
          This procedure considers each word in the sentence and fills the set "similars" with sentences to compare with as these sentences have at least one word in common.
 IWord<T> get(int index)
          Returns the IWord at the given index
 String getCommentLine()
          Returns the commentLine
 int getSequenceId()
          This procedure returns the sentence ID
 String getSequenceText()
          Returns a string representation of this sequence.
 List<IWord<T>> getWords()
          Returns the list of all IWords in this sentence.
 int indexOf(IWord<T> elem, int index)
          Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.
 boolean isSimilarTo(int id)
          This procedure returns true if the current sentence has in its "similars" set the sentence specified with argument "id", and returns false if it has not, or if the map of similar sentences has not been created (Because buildSimilarSentencesSet() has not been called).
 void registerWordsInSentence()
          This procedure considers each word in the sentence and registers its appearance in the current sentence to facilitate future decisions on which sentences to compare with.
 void setCommentLine(String commentLine)
          Sets the commentLine
 void setSequenceId(int id)
          This procedure sets the sentence ID
 int size()
          Returns the number of IWords in this sentence.
 List<IWord<T>> subList(int begin, int end)
          Returns the subList of IWord from begin to end, as defined in List.subList(int, int).
 

Method Detail

setCommentLine

void setCommentLine(String commentLine)
Sets the commentLine

Parameters:
commentLine -

getCommentLine

String getCommentLine()
Returns the commentLine

Returns:

setSequenceId

void setSequenceId(int id)
This procedure sets the sentence ID


getSequenceId

int getSequenceId()
This procedure returns the sentence ID


registerWordsInSentence

void registerWordsInSentence()
This procedure considers each word in the sentence and registers its appearance in the current sentence to facilitate future decisions on which sentences to compare with. It should be called while reading in the full treebank line by line.


buildSimilarSentencesSet

void buildSimilarSentencesSet()
This procedure considers each word in the sentence and fills the set "similars" with sentences to compare with as these sentences have at least one word in common.


isSimilarTo

boolean isSimilarTo(int id)
This procedure returns true if the current sentence has in its "similars" set the sentence specified with argument "id", and returns false if it has not, or if the map of similar sentences has not been created (Because buildSimilarSentencesSet() has not been called).


getSequenceText

String getSequenceText()
Returns a string representation of this sequence.

Returns:

indexOf

int indexOf(IWord<T> elem,
            int index)
Searches for the first occurence of the given argument, beginning the search at index, and testing for equality using the equals method.

Parameters:
elem - an object.
index - the non-negative index to start searching from.
Returns:
the index of the first occurrence of the object argument in this sequence at position index or later in the sequence, that is, the smallest value k such that elem.equals(elementData[k]) && (k >= index) is true; returns -1 if the object is not found. (Returns -1 if index >= the current size of this sequence.)
Throws:
IndexOutOfBoundsException - if index is negative.
See Also:
Object.equals(Object), List.indexOf(Object)

subList

List<IWord<T>> subList(int begin,
                       int end)
Returns the subList of IWord from begin to end, as defined in List.subList(int, int).

Parameters:
begin - the begin index (included)
end - the end index (not included)
Returns:
the sublist
See Also:
List.subList(int, int)

getWords

List<IWord<T>> getWords()
Returns the list of all IWords in this sentence.

Returns:
the list of words

size

int size()
Returns the number of IWords in this sentence.

Returns:

get

IWord<T> get(int index)
Returns the IWord at the given index

Parameters:
index - the index of the word.
Returns:
the word at index

addWords

void addWords(List<IWord<T>> words)
Adds all IWord stored in words to this sentence, as in List.addAll(java.util.Collection).

Parameters:
words -

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert