ABL4J (Alignment Based Learning for Java) - 0.9.7

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

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<IWord<T>>
              extended by org.schwiebert.abl4j.data.impl.abl.Sentence<T>
                  extended by org.schwiebert.abl4j.data.impl.abl.Tree<T>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<IWord<T>>, Collection<IWord<T>>, List<IWord<T>>, RandomAccess, ISentence<T>, ITree<T>

public final class Tree<T>
extends Sentence<T>
implements ITree<T>

A Tree is an ISentence which additionally contains a Vector of IConstituents.

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  double score
          The probability of the sentence.
private static long serialVersionUID
           
private  List<IConstituent<T>> structure
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Tree()
          Creates a new, empty Tree.
 
Method Summary
 void addAllWords(List<IWord<T>> otherWords)
          Adds the given list of words to the list of words already contained in the ITree, as in List.addAll(java.util.Collection)
 boolean addStructure(IConstituent<T> c)
          Adds a constituent c to the tree.
 void addWord(IWord<T> w)
          Adds IWord w to the list of words, as in List.add(Object)
 void changeSentence(List<IWord<T>> words)
          Removes all words currently contained in this Tree, and adds all Word objects in words.
 void clear()
          This procedure clears the entire tree (sentence and structure).
 ITree<T> cloneTree()
          Returns a copy of this object.
 ISentence<T> createSubStructure(int begin, int end)
           
 Iterator<IConstituent<T>> findStructure(IConstituent<T> c)
          This procedure returns an iterator to c in the tree.
 List<IConstituent<T>> getConstituentStructure()
          Returns all Constituents stored in this Tree.
 int getNumberOfConstituents()
          This procedure returns the number of hypotheses the tree contains
 double getSentenceScore()
          Returns the probability of the sentence.
 void setSentenceScore(double score)
          Sets the probability of the sentence to the given value.
 
Methods inherited from class org.schwiebert.abl4j.data.impl.abl.Sentence
addWords, buildSimilarSentencesSet, getCommentLine, getSequenceId, getSequenceText, getWords, indexOf, isSimilarTo, registerWordsInSentence, setCommentLine, setSequenceId
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, 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.ISentence
addWords, buildSimilarSentencesSet, get, getCommentLine, getSequenceId, getSequenceText, getWords, indexOf, isSimilarTo, registerWordsInSentence, setCommentLine, setSequenceId, size, subList
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

structure

private final List<IConstituent<T>> structure

score

private double score
The probability of the sentence. Unless modified, the default value is 1.0d.

Constructor Detail

Tree

public Tree()
Creates a new, empty Tree.

Method Detail

cloneTree

public ITree<T> cloneTree()
Description copied from interface: ITree
Returns a copy of this object.

Specified by:
cloneTree in interface ITree<T>

addStructure

public boolean addStructure(IConstituent<T> c)
Description copied from interface: ITree
Adds a constituent c to the tree. If a constituent with the same begin and end indices already exists, the nonterminals of c are added to that constituent, and false will be returned. Otherwise, c is added itself and the method returns true.

Specified by:
addStructure in interface ITree<T>

clear

public void clear()
Description copied from interface: ITree
This procedure clears the entire tree (sentence and structure).

Specified by:
clear in interface Collection<IWord<T>>
Specified by:
clear in interface List<IWord<T>>
Specified by:
clear in interface ITree<T>
Overrides:
clear in class ArrayList<IWord<T>>

changeSentence

public void changeSentence(List<IWord<T>> words)
Description copied from interface: ITree
Removes all words currently contained in this Tree, and adds all Word objects in words.

Specified by:
changeSentence in interface ITree<T>

getNumberOfConstituents

public int getNumberOfConstituents()
Description copied from interface: ITree
This procedure returns the number of hypotheses the tree contains

Specified by:
getNumberOfConstituents in interface ITree<T>

findStructure

public Iterator<IConstituent<T>> findStructure(IConstituent<T> c)
Description copied from interface: ITree
This procedure returns an iterator to c in the tree.

Specified by:
findStructure in interface ITree<T>

getConstituentStructure

public List<IConstituent<T>> getConstituentStructure()
Description copied from interface: ITree
Returns all Constituents stored in this Tree.

Specified by:
getConstituentStructure in interface ITree<T>
Returns:

createSubStructure

public ISentence<T> createSubStructure(int begin,
                                       int end)
Specified by:
createSubStructure in interface ITree<T>

setSentenceScore

public void setSentenceScore(double score)
Description copied from interface: ITree
Sets the probability of the sentence to the given value.

Specified by:
setSentenceScore in interface ITree<T>

getSentenceScore

public double getSentenceScore()
Description copied from interface: ITree
Returns the probability of the sentence.

Specified by:
getSentenceScore in interface ITree<T>
Returns:

addAllWords

public void addAllWords(List<IWord<T>> otherWords)
Description copied from interface: ITree
Adds the given list of words to the list of words already contained in the ITree, as in List.addAll(java.util.Collection)

Specified by:
addAllWords in interface ITree<T>

addWord

public void addWord(IWord<T> w)
Description copied from interface: ITree
Adds IWord w to the list of words, as in List.add(Object)

Specified by:
addWord in interface ITree<T>

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert