From 217453b85b5e579033a6d9dd7e2fa151c5be14b1 Mon Sep 17 00:00:00 2001 From: Alexis Nasr <alexis.nasr@lif.univ-mrs.fr> Date: Tue, 18 Oct 2016 09:51:27 -0400 Subject: [PATCH] some refactoring in maca_common --- maca_common/include/mcd.h | 1 + maca_common/src/mcd.c | 52 +++++++++++++++++++ maca_tools/src/mcf2conll.c | 49 ----------------- .../src/oracle_parser_arc_eager.c | 2 +- 4 files changed, 54 insertions(+), 50 deletions(-) diff --git a/maca_common/include/mcd.h b/maca_common/include/mcd.h index c45d5d7..622d4c3 100644 --- a/maca_common/include/mcd.h +++ b/maca_common/include/mcd.h @@ -119,6 +119,7 @@ typedef struct { mcd *mcd_build_conll07(void); mcd *mcd_build_ifpls(void); mcd *mcd_build_wplgf(void); +mcd *mcd_build_wplgfs(void); mcd *mcd_read(char *mcd_filename, int verbose); void mcd_link_to_dico(mcd *m, dico_vec *vocabs, int verbose); diff --git a/maca_common/src/mcd.c b/maca_common/src/mcd.c index a9313d6..79533c5 100644 --- a/maca_common/src/mcd.c +++ b/maca_common/src/mcd.c @@ -371,6 +371,58 @@ mcd *mcd_build_ifpls(void) return m; } +mcd *mcd_build_wplgfs(void) +{ + mcd *m = mcd_new(6); + int col; + + col = 0; + m->wf[col]=MCD_WF_FORM; + m->wf_str[col]=strdup("FORM"); + m->representation[col]= MCD_REPRESENTATION_VOCAB; + m->filename[col] = strdup("_"); + m->wf2col[MCD_WF_FORM] = col; + + col = 1; + m->wf[col]=MCD_WF_POS; + m->wf_str[col]=strdup("POS"); + m->representation[col]= MCD_REPRESENTATION_VOCAB; + m->filename[col] = strdup("_"); + m->wf2col[MCD_WF_POS] = 1; + + col = 2; + m->wf[col]=MCD_WF_LEMMA; + m->wf_str[col]=strdup("LEMMA"); + m->representation[col]= MCD_REPRESENTATION_VOCAB; + m->filename[col] = strdup("_"); + m->wf2col[MCD_WF_LEMMA] = 2; + + col = 3; + m->wf[col]=MCD_WF_GOV; + m->wf_str[col]=strdup("GOV"); + m->representation[col]= MCD_REPRESENTATION_INT; + m->filename[col] = strdup("_"); + m->wf2col[MCD_WF_GOV] = 3; + + col = 4; + m->wf[col]=MCD_WF_LABEL; + m->wf_str[col]=strdup("LABEL"); + m->representation[col]= MCD_REPRESENTATION_VOCAB; + m->filename[col] = strdup("_"); + m->wf2col[MCD_WF_LABEL] = 4; + + col = 5; + m->wf[col]=MCD_WF_SENT_SEG; + m->wf_str[col]=strdup("SENT_SEG"); + m->representation[col]= MCD_REPRESENTATION_INT; + m->filename[col] = strdup("_"); + m->wf2col[MCD_WF_SENT_SEG] = 5; + + return m; +} + + + /* returns a dico_vec containing the different dictionnaries found in an mcd structure */ dico_vec *mcd_build_dico_vec(mcd *mcd_struct) diff --git a/maca_tools/src/mcf2conll.c b/maca_tools/src/mcf2conll.c index 4b300ba..7fb78ae 100644 --- a/maca_tools/src/mcf2conll.c +++ b/maca_tools/src/mcf2conll.c @@ -44,55 +44,6 @@ void context_general_help_message(context *ctx) fprintf(stderr, "\t-o --conll : conll filename (write to stdout if absent)\n"); } -mcd *mcd_build_wplgfs(void) -{ - mcd *m = mcd_new(6); - int col; - - col = 0; - m->wf[col]=MCD_WF_FORM; - m->wf_str[col]=strdup("FORM"); - m->representation[col]= MCD_REPRESENTATION_VOCAB; - m->filename[col] = strdup("_"); - m->wf2col[MCD_WF_FORM] = col; - - col = 1; - m->wf[col]=MCD_WF_POS; - m->wf_str[col]=strdup("POS"); - m->representation[col]= MCD_REPRESENTATION_VOCAB; - m->filename[col] = strdup("_"); - m->wf2col[MCD_WF_POS] = 1; - - col = 2; - m->wf[col]=MCD_WF_LEMMA; - m->wf_str[col]=strdup("LEMMA"); - m->representation[col]= MCD_REPRESENTATION_VOCAB; - m->filename[col] = strdup("_"); - m->wf2col[MCD_WF_LEMMA] = 2; - - col = 3; - m->wf[col]=MCD_WF_GOV; - m->wf_str[col]=strdup("GOV"); - m->representation[col]= MCD_REPRESENTATION_INT; - m->filename[col] = strdup("_"); - m->wf2col[MCD_WF_GOV] = 3; - - col = 4; - m->wf[col]=MCD_WF_LABEL; - m->wf_str[col]=strdup("LABEL"); - m->representation[col]= MCD_REPRESENTATION_VOCAB; - m->filename[col] = strdup("_"); - m->wf2col[MCD_WF_LABEL] = 4; - - col = 5; - m->wf[col]=MCD_WF_SENT_SEG; - m->wf_str[col]=strdup("SENT_SEG"); - m->representation[col]= MCD_REPRESENTATION_INT; - m->filename[col] = strdup("_"); - m->wf2col[MCD_WF_SENT_SEG] = 5; - - return m; -} void mcf2conll_check_options(context *ctx){ if(ctx->help){ diff --git a/maca_trans_parser/src/oracle_parser_arc_eager.c b/maca_trans_parser/src/oracle_parser_arc_eager.c index e77d9e4..c865186 100644 --- a/maca_trans_parser/src/oracle_parser_arc_eager.c +++ b/maca_trans_parser/src/oracle_parser_arc_eager.c @@ -9,7 +9,7 @@ int check_all_dependents_of_word_in_ref_are_in_hyp(config *c, word_buffer *ref, int dep; int gov_ref; int gov_hyp; - int sentence_change; + /* int sentence_change; */ #if 1 for(dep = word_index - 1; (dep > 0) && (word_get_sent_seg(word_buffer_get_word_n(ref, dep)) == 0); dep--){ -- GitLab