ABL4J (Alignment Based Learning for Java) - 0.9.7

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

All Known Implementing Classes:
Constituent

public interface IConstituent<T>

An IConstituent is used to store a hypothesis or a nonterminal. A hypothesis is defined by a begin and end index (in a ISentence) and one or more NonTerminals. Default implementation: Constituent.

Author:
sschwieb

Method Summary
 boolean add(NonTerminal n)
          Adds a NonTerminal to the List of NonTerminals.
 boolean addAllNonTerminals(Collection<NonTerminal> nonTerminals)
          Adds all NonTerminals.
 void clear()
          Clears the List of NonTerminals
 boolean containsNonTerminal(NonTerminal nonTerminal)
          Returns true if the given NonTerminal is already contained in the List of NonTerminals.
 boolean empty()
          Is the constituent empty (i.e. begin==end)?
 boolean equals(Object o)
          Two IConstituent are equal, if their boundaries are equal (this.boundaries.first == o.boundaries.first && this.boundaries.second == o.boundaries.second).
 NonTerminal get(int index)
          Returns the NonTerminal at Position index.
 double getAverageLocalScore()
          Returns the average local score of this hypothesis.
 int getBeginIndex()
          Returns the begin index
 int getEndIndex()
          Returns the end index
 double getHighestLocalScore()
          Returns the highest local score of this hypothesis.
 Map<Integer,Double> getLocalScoreMap()
          Returns the map of local scores, or Collections.EMPTY_MAP, if no probabilities have been set.
 ISentence<T> getSentence()
          Returns the sentence to which this constituent belongs to.
 List<IWord<T>> getWords()
          Returns the list of words the constituent contains.
 int hashCode()
           
 int indexOf(NonTerminal n)
          Returns the index of NonTerminal n.
 void init(ISentence<T> sentence, int begin, int end)
          Initializes the NonTerminal.
 void mergeNonterminals(NonTerminal n)
          Sets the nonterminal of the hypothesis to n
 void setLocalScore(int sentenceId, double score)
          Sets the local score of a constituent.
 int size()
          Returns the number of NonTerminals
 boolean valid()
          Is the constituent valid (i.e. begin<=end)?
 

Method Detail

getBeginIndex

int getBeginIndex()
Returns the begin index


getEndIndex

int getEndIndex()
Returns the end index


empty

boolean empty()
Is the constituent empty (i.e. begin==end)?


equals

boolean equals(Object o)
Two IConstituent are equal, if their boundaries are equal (this.boundaries.first == o.boundaries.first && this.boundaries.second == o.boundaries.second).

Overrides:
equals in class Object

hashCode

int hashCode()
Overrides:
hashCode in class Object

valid

boolean valid()
Is the constituent valid (i.e. begin<=end)?


mergeNonterminals

void mergeNonterminals(NonTerminal n)
Sets the nonterminal of the hypothesis to n


setLocalScore

void setLocalScore(int sentenceId,
                   double score)
Sets the local score of a constituent. The score is local to the sentence defined by sentenceId, and must be a value between 0 and 1.

Parameters:
sentenceId -
score -

getLocalScoreMap

Map<Integer,Double> getLocalScoreMap()
Returns the map of local scores, or Collections.EMPTY_MAP, if no probabilities have been set.
Note:Only a few algorithms support local scores.

Returns:

getAverageLocalScore

double getAverageLocalScore()
Returns the average local score of this hypothesis. Experimental...

Returns:

getHighestLocalScore

double getHighestLocalScore()
Returns the highest local score of this hypothesis. Experimental...

Returns:

getWords

List<IWord<T>> getWords()
Returns the list of words the constituent contains.

Returns:

getSentence

ISentence<T> getSentence()
Returns the sentence to which this constituent belongs to.

Returns:

get

NonTerminal get(int index)
Returns the NonTerminal at Position index.

Parameters:
index -
Returns:

size

int size()
Returns the number of NonTerminals

Returns:

indexOf

int indexOf(NonTerminal n)
Returns the index of NonTerminal n.

Parameters:
n -
Returns:

add

boolean add(NonTerminal n)
Adds a NonTerminal to the List of NonTerminals.

Parameters:
n -
Returns:

clear

void clear()
Clears the List of NonTerminals


addAllNonTerminals

boolean addAllNonTerminals(Collection<NonTerminal> nonTerminals)
Adds all NonTerminals.

Parameters:
nonTerminals -
Returns:

containsNonTerminal

boolean containsNonTerminal(NonTerminal nonTerminal)
Returns true if the given NonTerminal is already contained in the List of NonTerminals.

Parameters:
nonTerminal -
Returns:

init

void init(ISentence<T> sentence,
          int begin,
          int end)
Initializes the NonTerminal. Should only be called from DataFactory.

Parameters:
sentence -
begin -
end -

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert