|
|||||||||
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.AbstractSequentialList<Element>
edu.umn.cs.nlp.mt.NBestList<Element>
public class NBestList<Element extends Scorable>
Implementation of a n-best list with b and beta pruning.
Elements with high-valued scores are interpreted to be "better" than elements with low-valued scores.
Elements with infinite scores are not allowed in the list.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
NBestList(int b)
Represents an n-best list, as defined in Chiang (2005). |
|
NBestList(int b,
double beta,
boolean acceptNaN)
Represents an n-best list, as defined in Chiang (2005). |
Method Summary | |
---|---|
boolean |
add(Element e)
Attempt to add an item to the list |
boolean |
isEmpty()
|
Iterator<Element> |
iterator()
Return an iterator capable of traversing the list in order from best element to worst element. |
ListIterator<Element> |
listIterator(int index)
|
int |
size()
Get the number of elements in the list. |
Methods inherited from class java.util.AbstractSequentialList |
---|
add, addAll, get, remove, set |
Methods inherited from class java.util.AbstractList |
---|
clear, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public NBestList(int b, double beta, boolean acceptNaN)
beta
- any item that has a score worse than beta plus the score of the best item in the list will not be added to the listb
- any item that has a score worse than the bth best item in the list will not be added to the listacceptNaN
- Determines how elements with NaN score will be treated;
if true
then such elements will simply not be added to the list,
if false
then any attempt to add such an element will cause an IllegalArgumentException
to be thrownpublic NBestList(int b)
Equivalent to NBestList(b, Double.POSITIVE_INFINITY, false)
b
- any item that has a score worse than the bth best item in the list will not be added to the listMethod Detail |
---|
public boolean isEmpty()
isEmpty
in interface Collection<Element extends Scorable>
isEmpty
in interface List<Element extends Scorable>
isEmpty
in class AbstractCollection<Element extends Scorable>
public boolean add(Element e)
If Double.isInfinite(e.getScore())
is true
, this method will return false
add
in interface Collection<Element extends Scorable>
add
in interface List<Element extends Scorable>
add
in class AbstractList<Element extends Scorable>
e
- item to add to the list
true
if the item was added to the list, false
otherwisepublic int size()
Implementation note: this method traverses the entire underlying linked list to calculate the size of the list
size
in interface Collection<Element extends Scorable>
size
in interface List<Element extends Scorable>
size
in class AbstractCollection<Element extends Scorable>
public Iterator<Element> iterator()
iterator
in interface Iterable<Element extends Scorable>
iterator
in interface Collection<Element extends Scorable>
iterator
in interface List<Element extends Scorable>
iterator
in class AbstractSequentialList<Element extends Scorable>
public ListIterator<Element> listIterator(int index)
listIterator
in interface List<Element extends Scorable>
listIterator
in class AbstractSequentialList<Element extends Scorable>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |