From 89c594c666fd868e8ffa3c20185ca58275c8b626 Mon Sep 17 00:00:00 2001 From: Alexis Nasr <alexis.nasr@lif.univ-mrs.fr> Date: Fri, 10 Mar 2017 15:56:38 +0100 Subject: [PATCH] moved parser specific code that was in feat_model.c to maca_trans_parser --- maca_common/src/feat_model.c | 30 ------------------------- maca_trans_parser/src/config2feat_vec.c | 2 +- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/maca_common/src/feat_model.c b/maca_common/src/feat_model.c index 503da46..4bf28ca 100644 --- a/maca_common/src/feat_model.c +++ b/maca_common/src/feat_model.c @@ -130,36 +130,6 @@ void catenate_int(char *string, int val) strcat(string, s); } -int feat_model_get_feat_value_fann(feat_model *fm, config *c, int feat_nb) -{ - feat_desc *fd = fm->array[feat_nb]; - /* fm must be exclusively composed of simple features */ - return fd->array[0]->fct(c); -} - -int feat_model_get_feat_value_cff(feat_model *fm, config *c, dico *dico_features, int feat_nb, int mode) -{ - feat_desc *fd = fm->array[feat_nb]; - int i; - int feat_val; - - /* the name of the feature is built in fm->string and its value in the dictionnary (dico_features) is returned */ - fm->string[0] = '\0'; - for(i=0; i < fd->nbelem; i++){ - strcat(fm->string, fd->array[i]->name); - strcat(fm->string, "=="); - feat_val = fd->array[i]->fct(c); - catenate_int(fm->string, feat_val); - } - - if(mode == LOOKUP_MODE){ - if(fm->string) - /* printf("fmstring = %s\n", fm->string); */ - return dico_string2int(dico_features, fm->string); - } - return dico_add(dico_features, fm->string); -} - feat_model *feat_model_new(char *name) { diff --git a/maca_trans_parser/src/config2feat_vec.c b/maca_trans_parser/src/config2feat_vec.c index 0b63b16..362125b 100644 --- a/maca_trans_parser/src/config2feat_vec.c +++ b/maca_trans_parser/src/config2feat_vec.c @@ -5,7 +5,6 @@ #include"feat_model.h" #include"config2feat_vec.h" - int get_feat_value_fann(feat_model *fm, config *c, int feat_nb) { feat_desc *fd = fm->array[feat_nb]; @@ -23,6 +22,7 @@ int get_feat_value_cff(feat_model *fm, config *c, dico *dico_features, int feat_ fm->string[0] = '\0'; for(i=0; i < fd->nbelem; i++){ strcat(fm->string, fd->array[i]->name); + strcat(fm->string, "=="); feat_val = fd->array[i]->fct(c); catenate_int(fm->string, feat_val); } -- GitLab