ZGen  0.2.0
a linearization system for natural language.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ZGen::ShiftReduce::Decoder Class Referenceabstract

#include <decoder.h>

Inheritance diagram for ZGen::ShiftReduce::Decoder:
ZGen::ShiftReduce::FullDecoder ZGen::ShiftReduce::NoneDecoder ZGen::ShiftReduce::PartialDecoder

Public Types

typedef std::pair< const
StateItem *, const StateItem * > 
decode_result_t
 

Public Member Functions

 Decoder (const option_t &opts, DecodeContext *ctx, Model *model, const Knowledge::PostagConstrain *constrain)
 
 ~Decoder ()
 
decode_result_t decode (const dependency_t *input, const action_sequence_t &gold_actions)
 

Protected Member Functions

virtual void get_possible_actions (const StateItem &item)=0
 
virtual void config_input (const dependency_t *input)=0
 
void get_possible_shift_actions (const StateItem &item, int index, word_t word, postag_t postag)
 

Protected Attributes

const option_topts
 The options. More...
 
Modelmodel
 The model. More...
 
DecodeContextctx
 The decode context. More...
 
action_sequence_t possible_actions
 The cached possible actions. More...
 
packed_score_t packed_score
 The cached packed score for transition. More...
 
scored_transition_t candidate_transitions [kMaxBeamSize]
 The candidate state tuple: (from state, action, score) More...
 
const Knowledge::PostagConstrainconstraint
 The postag constraints. More...
 

Member Typedef Documentation

Constructor & Destructor Documentation

ZGen::ShiftReduce::Decoder::Decoder ( const option_t opts,
DecodeContext ctx,
Model model,
const Knowledge::PostagConstrain constrain 
)
ZGen::ShiftReduce::Decoder::~Decoder ( )

Member Function Documentation

virtual void ZGen::ShiftReduce::Decoder::config_input ( const dependency_t input)
protectedpure virtual

Config the input onto the decoder.

Parameters
[in]inputThe pointer to the input instance.
Decoder::decode_result_t ZGen::ShiftReduce::Decoder::decode ( const dependency_t input,
const action_sequence_t gold_actions 
)

Perform the beam-search decoding.

Parameters
[in]inputThe input dependency instance.
[in]gold_actionsThe gold transition action (only actived in the learning process).
Returns
decode_result_t The decode result.
virtual void ZGen::ShiftReduce::Decoder::get_possible_actions ( const StateItem item)
protectedpure virtual

Get the possible actions from the current state. Store the possible actions in the possible_actions (action_collection_t)

Parameters
[in]itemThe input item
void ZGen::ShiftReduce::Decoder::get_possible_shift_actions ( const StateItem item,
int  index,
word_t  word,
postag_t  postag 
)
protected

Get the possible shift action from the current state, by refering the postag constrain. The possible actions is stored in possible_actions

Parameters
[in]itemThe input state item.
[in]indexThe index.
[in]wordThe word.
[in]postagThe postag.

Member Data Documentation

scored_transition_t ZGen::ShiftReduce::Decoder::candidate_transitions[kMaxBeamSize]
protected

The candidate state tuple: (from state, action, score)

const Knowledge::PostagConstrain* ZGen::ShiftReduce::Decoder::constraint
protected

The postag constraints.

DecodeContext* ZGen::ShiftReduce::Decoder::ctx
protected

The decode context.

Model* ZGen::ShiftReduce::Decoder::model
protected

The model.

const option_t& ZGen::ShiftReduce::Decoder::opts
protected

The options.

packed_score_t ZGen::ShiftReduce::Decoder::packed_score
protected

The cached packed score for transition.

action_sequence_t ZGen::ShiftReduce::Decoder::possible_actions
protected

The cached possible actions.


The documentation for this class was generated from the following files: