Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.decoder.ff.tm.BasicRuleCollection Class Reference
Inheritance diagram for joshua.decoder.ff.tm.BasicRuleCollection:
[legend]
Collaboration diagram for joshua.decoder.ff.tm.BasicRuleCollection:
[legend]

List of all members.

Public Member Functions

 BasicRuleCollection (int arity, int[] sourceTokens)
 BasicRuleCollection (int arity, int[] sourceTokens, List< Rule > rules)
int getArity ()
List< RulegetRules ()
synchronized void sortRules (List< FeatureFunction > l_models)
List< RulegetSortedRules ()
int[] getSourceSide ()

Static Public Member Functions

static void sortRules (List< Rule > rules, List< FeatureFunction > l_models)

Protected Attributes

boolean sorted
final List< Rulerules
int arity
int[] sourceTokens

Static Private Attributes

static final Logger logger = Logger.getLogger(BasicRuleCollection.class.getName())

Detailed Description

Basic collection of translation rules.

Author:
Lane Schwartz
Zhifei Li
Version:
$LastChangedDate$

Constructor & Destructor Documentation

joshua.decoder.ff.tm.BasicRuleCollection.BasicRuleCollection ( int  arity,
int[]  sourceTokens 
)

Constructs an initially empty rule collection.

Parameters:
arityNumber of nonterminals in the source pattern
sourceTokensSequence of terminals and nonterminals in the source pattern
joshua.decoder.ff.tm.BasicRuleCollection.BasicRuleCollection ( int  arity,
int[]  sourceTokens,
List< Rule rules 
)

Constructs a rule collection with the given data.

The list of rules must already be sorted

NOTE: if rules==null, the rule member variable will be initialized to an immutable empty list.

Parameters:
arity
sourceTokens
rules

Member Function Documentation

Gets the number of nonterminals in the source side of the rules in this RuleCollection. The source side is the same for all the rules in the RuleCollection, so the arity will also be the same for all of these rules.

Returns:
the (common) number of nonterminals in the source side of the rules in this RuleCollection

Implements joshua.decoder.ff.tm.RuleCollection.

get the list of rules (which may not be sorted or not)

Implements joshua.decoder.ff.tm.RuleCollection.

TODO: now, we assume this function will be called only after all the rules have been read; this method need to be synchronized as we will call this function only after the decoding begins to avoid the synchronized method, we should call this once the grammar is finished

public synchronized ArrayList<Rule> get_sorted_rules(){ l_models: if it is non-null, then the rules will be sorted using the new feature functions (or new weight), otherwise, just return a sorted list based on the last time of feature functions

Only CubePruning requires that rules are sorted based on est_cost (confirmed by zhifei)

Implements joshua.decoder.ff.tm.RuleCollection.

Gets the source side for all rules in this RuleCollection. This source side is the same for all the rules in the RuleCollection.

Returns:
the (common) source side for all rules in this RuleCollection

Implements joshua.decoder.ff.tm.RuleCollection.

static void joshua.decoder.ff.tm.BasicRuleCollection.sortRules ( List< Rule rules,
List< FeatureFunction l_models 
) [static]

Here is the caller graph for this function:

Sorts the grammar rules in this collection using the provided feature functions.

Parameters:
l_modelsFeature function models to use during sorting.

Implements joshua.decoder.ff.tm.RuleCollection.

Here is the call graph for this function:


Member Data Documentation

Number of nonterminals in the source pattern.

final Logger joshua.decoder.ff.tm.BasicRuleCollection.logger = Logger.getLogger(BasicRuleCollection.class.getName()) [static, private]

Logger for this class.

Reimplemented in joshua.decoder.ff.tm.hash_based.MemoryBasedRuleBin.

List of rules stored in this collection.

Indicates whether the rules in this collection have been sorted based on the latest feature function values.

Sequence of terminals and nonterminals in the source pattern.