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
......@@ -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)
{
......
......@@ -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);
}
......
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