diff --git a/maca_common/include/word.h b/maca_common/include/word.h index 33fd8c13605cbf2f9d47e58c57677089202a302e..c6a4b56db3b7d6e1760ae59bf3b5d6f521688f9b 100644 --- a/maca_common/include/word.h +++ b/maca_common/include/word.h @@ -16,6 +16,8 @@ typedef struct _word { char16 *form_char16; int index; int is_root; + int lspan; + int rspan; } word; /* diff --git a/maca_common/src/word_buffer.c b/maca_common/src/word_buffer.c index e9355d50e3fc8d271b13205dbbcd0f7678a4f65d..b72f72e14efacfd65d46880cc2be82aa7a224095 100644 --- a/maca_common/src/word_buffer.c +++ b/maca_common/src/word_buffer.c @@ -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; } diff --git a/maca_trans_parser/src/movement_parser_arc_eager.h b/maca_trans_parser/src/movement_parser_arc_eager.h index 2b11bf049e24bf6edb5e71fcf90663d7d857db2f..3a040d59249949c3ee0fd9d343d5f5edeb4b224a 100644 --- a/maca_trans_parser/src/movement_parser_arc_eager.h +++ b/maca_trans_parser/src/movement_parser_arc_eager.h @@ -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) diff --git a/maca_trans_parser/src/movements.c b/maca_trans_parser/src/movements.c index 36e3ff77c5042056c947e28b3cfe1e36f94ff53d..8622e4a62b5874ac136237daef6859b80bba25c1 100644 --- a/maca_trans_parser/src/movements.c +++ b/maca_trans_parser/src/movements.c @@ -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); diff --git a/maca_trans_parser/src/oracle_parser_arc_eager.c b/maca_trans_parser/src/oracle_parser_arc_eager.c index 074400e2b14b8bede8cbef8815224b2a73553b95..e258c93d632757a4346f3b7c6c3b9e6a009f8ceb 100644 --- a/maca_trans_parser/src/oracle_parser_arc_eager.c +++ b/maca_trans_parser/src/oracle_parser_arc_eager.c @@ -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){