edu.umn.cs.nlp.old
Class ChartCell

java.lang.Object
  extended by edu.umn.cs.nlp.old.ChartCell
All Implemented Interfaces:
Iterable<ParseSpan>

public class ChartCell
extends Object
implements Iterable<ParseSpan>

Parse chart cell for a Chiang-style CKY+ parser

Version:
$LastChangedDate: 2007-11-14 09:28:40 -0600 (Wed, 14 Nov 2007) $
Author:
Lane Schwartz

Constructor Summary
ChartCell(int X_node_b, double X_node_beta, int S_node_b, double S_node_beta, LanguageModel languageModel)
          Construct a new ChartCell; use the specified parameters for pruning.
 
Method Summary
 boolean add(int i, int j, TranslationRule rule)
          Attempt to store a new terminal parse span in this chart cell.
 boolean add(int i, int j, TranslationRule rule, ParseSpan... children)
          Attempt to store a new parse span in this chart cell.
 void addTerminal(int i, String token)
          Set the specified token to be the terminal token for this chart cell
 Iterable<ParseSpan> getNBest(int n)
           
 boolean isEmpty()
          Is this chart cell empty?
 Iterator<ParseSpan> iterator()
           
 int size()
          Get the total number of parse spans stored in this chart cell.
 int ssize()
          Get the number of S parse spans stored in this chart cell.
 int xsize()
          Get the number of X parse spans stored in this chart cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartCell

public ChartCell(int X_node_b,
                 double X_node_beta,
                 int S_node_b,
                 double S_node_beta,
                 LanguageModel languageModel)
Construct a new ChartCell; use the specified parameters for pruning.

Parameters:
X_node_b -
X_node_beta -
S_node_b -
S_node_beta -
Method Detail

xsize

public int xsize()
Get the number of X parse spans stored in this chart cell.

Returns:
the number of X parse spans stored in this chart cell

ssize

public int ssize()
Get the number of S parse spans stored in this chart cell.

Returns:
the number of S parse spans stored in this chart cell

size

public int size()
Get the total number of parse spans stored in this chart cell.

Returns:
the total number of parse spans stored in this chart cell

isEmpty

public boolean isEmpty()
Is this chart cell empty?

Returns:
true if there are no ParseSpan objects stored in this chart cell; false otherwise

addTerminal

public void addTerminal(int i,
                        String token)
Set the specified token to be the terminal token for this chart cell

Parameters:
i - the start index in the chart for this token
token - the token to store as a terminal parse span

add

public boolean add(int i,
                   int j,
                   TranslationRule rule)
Attempt to store a new terminal parse span in this chart cell.

If appropriate, this method will also attempt to add a new parse span for the rule S => X to this chart cell.

If the rule to be added has a left-hand side of "X", and the rule is successfully added as a new parse span, but the corresponding S => X rule is not sucessfully added, this method will still return true.

Returns:
true if a new parse span was successfully added to the chart cell, false otherwise

add

public boolean add(int i,
                   int j,
                   TranslationRule rule,
                   ParseSpan... children)
Attempt to store a new parse span in this chart cell.

If appropriate, this method will also attempt to add a new parse span for the rule S => X to this chart cell.

If the rule to be added has a left-hand side of "X", and the rule is successfully added as a new parse span, but the corresponding S => X rule is not sucessfully added, this method will still return true.

Returns:
true if a new parse span was successfully added to the chart cell, false otherwise

getNBest

public Iterable<ParseSpan> getNBest(int n)

iterator

public Iterator<ParseSpan> iterator()
Specified by:
iterator in interface Iterable<ParseSpan>