From 44a039c79ef050493161ffb1d3ad425c7c7bfb71 Mon Sep 17 00:00:00 2001
From: Alexis Nasr <alexis.nasr@lif.univ-mrs.fr>
Date: Thu, 14 Dec 2017 11:00:32 +0100
Subject: [PATCH] modified maca_tm_decoder so that it does not lemmatize when
 word does not have a POS (hack git status)

---
 maca_trans_parser/src/cff2fann.c        | 4 ++--
 maca_trans_parser/src/maca_tm_decoder.c | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/maca_trans_parser/src/cff2fann.c b/maca_trans_parser/src/cff2fann.c
index 4a39ebc..b90246d 100644
--- a/maca_trans_parser/src/cff2fann.c
+++ b/maca_trans_parser/src/cff2fann.c
@@ -63,7 +63,7 @@ void print_header(mcd *m, feat_model *fm)
   for(i=0; i <fm->nbelem; i++){
     fd = fm->array[i];
     if(fd->nbelem > 1){
-      printf("feature %d is a complex feature, skipping it\n", i);
+      fprintf(stderr, "feature %d is a complex feature, skipping it\n", i);
     }
     else{
       sfd = fd->array[0];
@@ -76,7 +76,7 @@ void print_header(mcd *m, feat_model *fm)
   for(i=0; i <fm->nbelem; i++){
     fd = fm->array[i];
     if(fd->nbelem > 1){
-      printf("feature %d is a complex feature, skipping it\n", i);
+      fprintf(stderr, "feature %d is a complex feature, skipping it\n", i);
     }
     else{
       sfd = fd->array[0];
diff --git a/maca_trans_parser/src/maca_tm_decoder.c b/maca_trans_parser/src/maca_tm_decoder.c
index ee5f975..f532ea1 100644
--- a/maca_trans_parser/src/maca_tm_decoder.c
+++ b/maca_trans_parser/src/maca_tm_decoder.c
@@ -263,7 +263,7 @@ void maca_tm_decoder(context *ctx)
       fprintf(stdout, "***********************************\n");
       fprintf(stdout, "%s   ", ctx->machine->state_array[c->current_state_nb]->name);
       config_print(stdout, c);
-      classifier_print_vcode_array(stderr, classif, c, 4);
+      classifier_print_vcode_array(stdout, classif, c, 4);
     }
     result = movement_apply(c, mvt_code, classifier_get_output_tagset(classif), root_label, ctx->machine);
 
@@ -272,8 +272,11 @@ void maca_tm_decoder(context *ctx)
 	/* it is bm1 rather than b0 because the machine changed state after applying the pos movement */
 	word_sprint_col_n(form_str, word_buffer_bm1(config_get_buffer(c)), mcd_get_form_col(ctx->mcd_struct));
 	pos_str = dico_int2string(dico_pos, word_get_pos(word_buffer_bm1(config_get_buffer(c))));
-	lemma_str = fplm_lookup_lemma(fplm, form_str, pos_str, ctx->verbose);
-	lemma_code = dico_string2int(dico_forms, lemma_str);
+	lemma_code = -1;
+	if(pos_str){
+	  lemma_str = fplm_lookup_lemma(fplm, form_str, pos_str, ctx->verbose);
+	  lemma_code = dico_string2int(dico_forms, lemma_str);
+	}
 	word_set_lemma(word_buffer_bm1(config_get_buffer(c)), lemma_code);
 	/* printf("--------> form = %s pos = %s lemma = %s code = %d\n", form_str, pos_str, lemma_str, lemma_code); */
       }
-- 
GitLab