Skip to content
Snippets Groups Projects
Commit 89c594c6 authored by Alexis Nasr's avatar Alexis Nasr
Browse files

moved parser specific code that was in feat_model.c to maca_trans_parser

parent dc4e44ea
No related branches found
No related tags found
No related merge requests found
...@@ -130,36 +130,6 @@ void catenate_int(char *string, int val) ...@@ -130,36 +130,6 @@ void catenate_int(char *string, int val)
strcat(string, s); 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) feat_model *feat_model_new(char *name)
{ {
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include"feat_model.h" #include"feat_model.h"
#include"config2feat_vec.h" #include"config2feat_vec.h"
int get_feat_value_fann(feat_model *fm, config *c, int feat_nb) int get_feat_value_fann(feat_model *fm, config *c, int feat_nb)
{ {
feat_desc *fd = fm->array[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_ ...@@ -23,6 +22,7 @@ int get_feat_value_cff(feat_model *fm, config *c, dico *dico_features, int feat_
fm->string[0] = '\0'; fm->string[0] = '\0';
for(i=0; i < fd->nbelem; i++){ for(i=0; i < fd->nbelem; i++){
strcat(fm->string, fd->array[i]->name); strcat(fm->string, fd->array[i]->name);
strcat(fm->string, "==");
feat_val = fd->array[i]->fct(c); feat_val = fd->array[i]->fct(c);
catenate_int(fm->string, feat_val); catenate_int(fm->string, feat_val);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment