1 #ifndef __ZGEN_SHIFTREDUCE_MODEL_SCORE_CONTEXT_H__
2 #define __ZGEN_SHIFTREDUCE_MODEL_SCORE_CONTEXT_H__
7 #define _LEGEAL_RANGE_(x) (((x) >= 0) && ((x) < N))
9 #define __SET_CTX(prefix) do { \
10 prefix##w = (item.ref->forms).at(prefix); \
11 prefix##p = item.postags[prefix]; \
12 prefix##l = item.deprels[prefix]; \
15 #define __CLEAR_CTX(prefix) do { \
16 prefix##w = kNoneWord; \
17 prefix##p = kNonePostag; \
18 prefix##l = kNoneDeprel; \
21 #define __SET_CNT(prefix) do { \
22 prefix##la = item.nr_left_children[prefix]; \
23 prefix##ra = item.nr_right_children[prefix]; \
24 prefix##ls = utils::bin(item.nr_left_descendant[prefix]); \
25 prefix##rs = utils::bin(item.nr_right_descendant[prefix]); \
28 #define __CLEAR_CNT(prefix) do { \
38 namespace ShiftReduce {
40 namespace eg = ZGen::Engine;
41 namespace utils= ZGen::Utility;
125 if (item.
stack.size() > 2) {
270 #endif // __ZGEN_SHIFTREDUCE_MODEL_SCORE_CONTEXT_H__
int S1S1rdDist
Definition: score_context.h:257
Definition: score_context.h:47
deprel_t S1ldl
Definition: score_context.h:249
#define _LEGEAL_RANGE_(x)
Definition: score_context.h:7
word_t S0l2dw
Definition: score_context.h:241
bool is_begin_state() const
Definition: score_context.h:222
#define __SET_CNT(prefix)
Definition: score_context.h:21
word_t S0lddw
Definition: score_context.h:241
postag_t S0rdp
Definition: score_context.h:242
Definition: word_alphabet.h:63
postag_t S1lddp
Definition: score_context.h:248
Definition: postag_alphabet.h:33
deprel_t S1r2dl
Definition: score_context.h:249
postag_t S0rddp
Definition: score_context.h:242
deprel_t S0lddl
Definition: score_context.h:243
int S0S0rdDist
Definition: score_context.h:257
int S0ls
Definition: score_context.h:245
Definition: word_alphabet.h:63
std::vector< word_t > word_sequence
The sequence of words leading by the current state.
Definition: state.h:59
word_t S0rddw
Definition: score_context.h:241
postag_t P0
Definition: score_context.h:254
int right_most_child[kMaxNumberOfWords]
CACHE: use to store the right most child for the word.
Definition: state.h:95
int S0S1Dist
Definition: score_context.h:256
int S0ra
Definition: score_context.h:244
int S0rs
Definition: score_context.h:245
const int kNonePostag
Definition: score_context.h:44
int S1rs
Definition: score_context.h:251
int postags[kMaxNumberOfWords]
The postags cache.
Definition: state.h:71
#define __SET_CTX(prefix)
Definition: score_context.h:9
postag_t S1rdp
Definition: score_context.h:248
int word_t
Definition: instance.h:11
deprel_t S1rddl
Definition: score_context.h:249
deprel_t S0r2dl
Definition: score_context.h:243
bool has_W2() const
Definition: score_context.h:234
postag_t S1ldp
Definition: score_context.h:248
const dependency_t * ref
The second top word.
Definition: state.h:51
word_t S1w
Definition: score_context.h:247
#define __CLEAR_CTX(prefix)
Definition: score_context.h:15
int S0la
Definition: score_context.h:244
postag_t S1r2dp
Definition: score_context.h:248
deprel_t S0rddl
Definition: score_context.h:243
postag_t S0l2dp
Definition: score_context.h:242
word_t W0
Definition: score_context.h:253
#define __CLEAR_CNT(prefix)
Definition: score_context.h:28
std::vector< postag_t > postag_sequence
The sequence of postags leading by the current state.
Definition: state.h:62
word_t S0ldw
Definition: score_context.h:241
int left_most_child[kMaxNumberOfWords]
CACHE: use to store the left most child for the word.
Definition: state.h:92
deprel_t S0l2dl
Definition: score_context.h:243
postag_t S1rddp
Definition: score_context.h:248
postag_t S0p
Definition: score_context.h:242
word_t S1lddw
Definition: score_context.h:247
bool has_W1() const
Definition: score_context.h:230
std::vector< word_t > sentence_t
Definition: instance.h:14
int bin(int x)
Definition: math_utils.cc:6
const int kNoneWord
Definition: score_context.h:43
word_t S1l2dw
Definition: score_context.h:247
deprel_t S1l2dl
Definition: score_context.h:249
ScoreContext ctx_t
Definition: score_context.h:260
deprel_t S1lddl
Definition: score_context.h:249
postag_t S1p
Definition: score_context.h:248
postag_t P1
Definition: score_context.h:254
std::vector< word_t > forms
Definition: instance.h:21
word_t S0rdw
Definition: score_context.h:241
postag_t S0ldp
Definition: score_context.h:242
Definition: postag_alphabet.h:33
int S1ls
Definition: score_context.h:251
size_t size() const
Definition: instance.cc:83
postag_t S0lddp
Definition: score_context.h:242
int deprel_t
Definition: instance.h:13
int postag_t
Definition: instance.h:12
word_t S0r2dw
Definition: score_context.h:241
std::vector< int > stack
The score for the current state.
Definition: state.h:56
int top1
The top word in the stack of the current state.
Definition: state.h:50
deprel_t S0ldl
Definition: score_context.h:243
word_t S1rdw
Definition: score_context.h:247
Definition: deprel_alphabet.h:31
int left_2nd_most_child[kMaxNumberOfWords]
CACHE: use to store the 2nd-left-most child.
Definition: state.h:98
word_t W1
Definition: score_context.h:253
word_t S1r2dw
Definition: score_context.h:247
word_t W2
Definition: score_context.h:253
int right_2nd_most_child[kMaxNumberOfWords]
CACHE: use to store the 2nd-right-most child.
Definition: state.h:101
deprel_t S1rdl
Definition: score_context.h:249
word_t S0w
Definition: score_context.h:241
bool _has_S1
Definition: score_context.h:239
const int kNoneDeprel
Definition: score_context.h:45
deprel_t S0rdl
Definition: score_context.h:243
bool _is_begin_state
Definition: score_context.h:238
postag_t S0r2dp
Definition: score_context.h:242
ScoreContext(const StateItem &item)
Definition: score_context.h:48
int S1la
Definition: score_context.h:250
bool has_S1() const
Definition: score_context.h:226
bool _has_W2
Definition: score_context.h:239
bool _has_W1
Definition: score_context.h:239
postag_t P2
Definition: score_context.h:254
postag_t S1l2dp
Definition: score_context.h:248
int S0S0ldDist
Definition: score_context.h:257
int S1ra
Definition: score_context.h:250
int top0
Definition: state.h:49
int rank[kMaxNumberOfWords]
The rank of the form, with word considered.
Definition: state.h:68
word_t S1rddw
Definition: score_context.h:247
word_t S1ldw
Definition: score_context.h:247
int S1S1ldDist
Definition: score_context.h:257