|
ABL4J (Alignment Based Learning for Java) - 0.9.7 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<NonTerminal>
org.schwiebert.abl4j.data.impl.abl.Constituent<T>
public class Constituent<T>
This class 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.
| Field Summary | |
|---|---|
private int |
begin
The boundaries of the constituent. |
private int |
end
|
private ISentence<T> |
sentence
The sentence this constituent belongs to. |
private Map<Integer,Double> |
sentenceToScore
ABL4J extension: If an alignment or selection algorithm supports local alignments, the probability of the alignment is stored in this map. |
private static long |
serialVersionUID
|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
Constituent()
Constructs a new Constituent. |
|
| Method Summary | |
|---|---|
boolean |
addAllNonTerminals(Collection<NonTerminal> nonTerminals)
Adds all 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). |
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. |
boolean |
valid()
Is the constituent valid (i.e. begin<=end)? |
| Methods inherited from class java.util.ArrayList |
|---|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
|---|
iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.schwiebert.abl4j.data.IConstituent |
|---|
add, clear, get, size |
| Methods inherited from interface java.util.List |
|---|
containsAll, iterator, listIterator, listIterator, removeAll, retainAll, subList |
| Field Detail |
|---|
private static final long serialVersionUID
private int begin
private int end
private Map<Integer,Double> sentenceToScore
private ISentence<T> sentence
| Constructor Detail |
|---|
public Constituent()
| Method Detail |
|---|
public void init(ISentence<T> sentence,
int begin,
int end)
IConstituentDataFactory.
init in interface IConstituent<T>public int getBeginIndex()
IConstituent
getBeginIndex in interface IConstituent<T>public int getEndIndex()
IConstituent
getEndIndex in interface IConstituent<T>public boolean empty()
IConstituent
empty in interface IConstituent<T>public boolean equals(Object o)
IConstituentIConstituent are equal, if their boundaries are
equal (this.boundaries.first == o.boundaries.first && this.boundaries.second == o.boundaries.second).
equals in interface Collection<NonTerminal>equals in interface List<NonTerminal>equals in interface IConstituent<T>equals in class AbstractList<NonTerminal>public int hashCode()
hashCode in interface Collection<NonTerminal>hashCode in interface List<NonTerminal>hashCode in interface IConstituent<T>hashCode in class AbstractList<NonTerminal>public boolean valid()
IConstituent
valid in interface IConstituent<T>public void mergeNonterminals(NonTerminal n)
IConstituent
mergeNonterminals in interface IConstituent<T>
public void setLocalScore(int sentenceId,
double score)
IConstituent
setLocalScore in interface IConstituent<T>public Map<Integer,Double> getLocalScoreMap()
IConstituentCollections.EMPTY_MAP,
if no probabilities have been set.
getLocalScoreMap in interface IConstituent<T>public double getAverageLocalScore()
IConstituent
getAverageLocalScore in interface IConstituent<T>public double getHighestLocalScore()
IConstituent
getHighestLocalScore in interface IConstituent<T>public List<IWord<T>> getWords()
IConstituent
getWords in interface IConstituent<T>public ISentence<T> getSentence()
IConstituent
getSentence in interface IConstituent<T>public int indexOf(NonTerminal n)
IConstituent
indexOf in interface IConstituent<T>public boolean addAllNonTerminals(Collection<NonTerminal> nonTerminals)
IConstituent
addAllNonTerminals in interface IConstituent<T>public boolean containsNonTerminal(NonTerminal nonTerminal)
IConstituent
containsNonTerminal in interface IConstituent<T>
|
ABL4J (Alignment Based Learning for Java) - 0.9.7 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||