Commit b662e2f8 authored by Alexis Nasr's avatar Alexis Nasr
Browse files

simplified the actions system, got rid of action EOS, action ROOT is now...

simplified the actions system, got rid of action EOS, action ROOT is now responsible to set the sentence boundary
parent 5e7ff22c
......@@ -16,6 +16,8 @@ typedef struct _word {
char16 *form_char16;
int index;
int is_root;
int lspan;
int rspan;
} word;
/*
......
......@@ -80,7 +80,7 @@ int word_buffer_add(word_buffer *wb, word *w)
}
wb->array[wb->nbelem] = w;
word_set_index(w, wb->nbelem);
w->rspan = w->lspan = wb->nbelem;
wb->nbelem++;
return wb->nbelem - 1;
}
......
......@@ -7,9 +7,9 @@
#define MVT_PARSER_SHIFT 0
#define MVT_PARSER_REDUCE 1
#define MVT_PARSER_ROOT 2
#define MVT_PARSER_EOS 3
#define MVT_PARSER_LEFT 4
#define MVT_PARSER_RIGHT 5
#define MVT_PARSER_EOS -1
#define MVT_PARSER_LEFT 3
#define MVT_PARSER_RIGHT 4
/* even movements are left movements (except 0, which is shift and 2 which is root) */
#define movement_parser_left_code(label) (2 * (label) + 4)
......
......@@ -47,6 +47,8 @@ int movement_left_arc(config *c, int movement_code, int label)
word_set_gov(dep, dist);
word_set_label(dep, label);
gov->lspan = dep->lspan;
config_push_mvt(c, movement_code, gov, dep);
stack_pop(config_get_stack(c));
......@@ -81,6 +83,9 @@ int movement_right_arc(config *c, int movement_code, int label)
/* create a new dependency */
word_set_gov(dep, dist);
word_set_label(dep, label);
gov->rspan = dep->rspan;
stack_push(config_get_stack(c), word_buffer_b0(config_get_buffer(c)));
word_buffer_move_right(config_get_buffer(c));
......@@ -152,6 +157,9 @@ int movement_root(config *c, int movement_code, int root_code)
word_set_label(s0, root_code);
s0->is_root = 1;
/*---- ajout 19/12/17 ----------*/
word_set_sent_seg(word_buffer_get_word_n(config_get_buffer(c), s0->rspan), 1);
/*-----------------------------*/
stack_pop(config_get_stack(c));
config_push_mvt(c, movement_code, s0, NULL);
......
......@@ -68,10 +68,10 @@ int oracle_parser_arc_eager(config *c, word_buffer *ref, int root_label)
}
/* word on the top of the stack is an end of sentence marker */
if((word_get_sent_seg(word_buffer_get_word_n(ref, s0_index)) == 1)
/* if((word_get_sent_seg(word_buffer_get_word_n(ref, s0_index)) == 1)
&& (word_get_sent_seg(word_buffer_get_word_n(config_get_buffer(c), s0_index)) != 1)){
return MVT_PARSER_EOS;
}
}*/
/* LEFT ARC b0 is the governor and s0 the dependent */
if(s0_gov_index == b0_index){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment