diff --git a/CMakeLists.txt b/CMakeLists.txt
index a94a43c37b96a18c5b65627e3d311e8fdde884d0..36a4ce1bf623f5917eeed906f80c4b64813a074a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,8 +4,10 @@ project(macaon2)
 add_definitions("-Wall")
 
 include_directories(maca_common/include)
+include_directories(perceptron/lib/include)
 
 add_subdirectory(maca_common)
+add_subdirectory(perceptron)
 add_subdirectory(maca_lemmatizer)
 add_subdirectory(maca_trans_parser)
 add_subdirectory(maca_crf_tagger)
diff --git a/maca_trans_parser/CMakeLists.txt b/maca_trans_parser/CMakeLists.txt
index 92a86211e3bf139d8b0fbf51b5de95e4e34a689b..f0b58d06b9071b3dcbe9d2516056a8d9212c79c3 100644
--- a/maca_trans_parser/CMakeLists.txt
+++ b/maca_trans_parser/CMakeLists.txt
@@ -1,19 +1,15 @@
 set(SOURCES src/context.c
  src/feat_desc.c
- src/feature_table.c
  src/movement_parser.c
  src/movement_tagger.c
  src/feat_fct.c
- src/feat_vec.c
  src/global_feat_vec.c
  src/oracle_parser.c
  src/oracle_tagger.c
  src/simple_decoder_parser.c
  src/simple_decoder_forrest.c
  src/simple_decoder_tagger.c
- src/cf_file.c
  src/feat_lib.c
- src/perceptron.c
  src/stack.c
  src/config2feat_vec.c
  src/depset.c
@@ -27,61 +23,53 @@ set(SOURCES src/context.c
 #compiling library
 include_directories(src)
 add_library(transparse STATIC ${SOURCES})
+target_link_libraries(transparse perceptron)
 
 #compiling, linking and installing executables
 
 add_executable(maca_trans_tagger_mcf2cff ./src/maca_trans_tagger_mcf2cff.c)
+target_link_libraries(maca_trans_tagger_mcf2cff perceptron)
 target_link_libraries(maca_trans_tagger_mcf2cff transparse)
 target_link_libraries(maca_trans_tagger_mcf2cff maca_common)
 install (TARGETS maca_trans_tagger_mcf2cff DESTINATION bin)
 
 add_executable(maca_trans_parser_mcf2fann ./src/maca_trans_parser_mcf2fann.c)
+target_link_libraries(maca_trans_parser_mcf2fann perceptron)
 target_link_libraries(maca_trans_parser_mcf2fann transparse)
 target_link_libraries(maca_trans_parser_mcf2fann maca_common)
 install (TARGETS maca_trans_parser_mcf2fann DESTINATION bin)
 
 add_executable(maca_trans_parser_mcf2cff ./src/maca_trans_parser_mcf2cff.c)
+target_link_libraries(maca_trans_parser_mcf2cff perceptron)
 target_link_libraries(maca_trans_parser_mcf2cff transparse)
 target_link_libraries(maca_trans_parser_mcf2cff maca_common)
 install (TARGETS maca_trans_parser_mcf2cff DESTINATION bin)
 
 add_executable(maca_trans_parser ./src/maca_trans_parser.c)
+target_link_libraries(maca_trans_parser perceptron)
 target_link_libraries(maca_trans_parser transparse)
 target_link_libraries(maca_trans_parser maca_common)
 install (TARGETS maca_trans_parser DESTINATION bin)
 
 add_executable(maca_trans_parser_forrest ./src/decode_forrest.c)
+target_link_libraries(maca_trans_parser_forrest perceptron)
 target_link_libraries(maca_trans_parser_forrest transparse)
 target_link_libraries(maca_trans_parser_forrest maca_common)
 install (TARGETS maca_trans_parser_forrest DESTINATION bin)
 
 add_executable(maca_trans_tagger ./src/maca_trans_tagger.c)
+target_link_libraries(maca_trans_tagger perceptron)
 target_link_libraries(maca_trans_tagger transparse)
 target_link_libraries(maca_trans_tagger maca_common)
 install (TARGETS maca_trans_tagger DESTINATION bin)
 
 add_executable(maca_trans_parser_train ./src/train_perceptron.c)
 target_compile_options(maca_trans_parser_train INTERFACE -Wall)
+target_link_libraries(maca_trans_parser_train perceptron)
 target_link_libraries(maca_trans_parser_train transparse)
 target_link_libraries(maca_trans_parser_train maca_common)
 install (TARGETS maca_trans_parser_train DESTINATION bin)
 
-add_executable(maca_trans_parser_train_from_cff ./src/train.c)
-target_link_libraries(maca_trans_parser_train_from_cff transparse)
-target_link_libraries(maca_trans_parser_train_from_cff maca_common)
-install (TARGETS maca_trans_parser_train_from_cff DESTINATION bin)
-
-add_executable(maca_trans_parser_cff_cutoff ./src/cff_cutoff.c)
-target_link_libraries(maca_trans_parser_cff_cutoff transparse)
-target_link_libraries(maca_trans_parser_cff_cutoff maca_common)
-install (TARGETS maca_trans_parser_cff_cutoff DESTINATION bin)
-
-add_executable(eval_classifier ./src/eval_classifier.c)
-target_link_libraries(eval_classifier transparse)
-target_link_libraries(eval_classifier maca_common)
-install (TARGETS eval_classifier DESTINATION bin)
-
-
 
 #add_executable(test_w2v ./src/test_w2v.c)
 #target_link_libraries(test_w2v transparse)
diff --git a/maca_trans_parser/src/feat_vec.c b/maca_trans_parser/src/feat_vec.c
deleted file mode 100644
index f63b30c5d3d45776dfcb3cfe1b74843e4a59361b..0000000000000000000000000000000000000000
--- a/maca_trans_parser/src/feat_vec.c
+++ /dev/null
@@ -1,167 +0,0 @@
-#include<stdio.h>
-#include<stdlib.h>
-#include"feat_vec.h"
-#include"util.h"
-#include "feat_types.h"
-#include "feat_model.h"
-
-void feat_vec_concat(feat_vec *fv1, feat_vec *fv2)
-{
-  int i;
-  for(i=0; i < fv2->nb; i++)
-    if(fv2->t[i] != -1)
-      feat_vec_add(fv1, fv2->t[i]);
-}
-
-
-feat_vec *feat_vec_new(int size)
-{
-  feat_vec *fv = (feat_vec *)memalloc(sizeof(feat_vec));
-  fv->size = size;
-  fv->nb = 0;
-  fv->t = (int *)memalloc(size * sizeof(int));
-  return fv;
-}
-
-void feat_vec_free(feat_vec *fv)
-{
-  if(fv){
-    if(fv->t)
-      free(fv->t);
-    free(fv);
-  }
-}
-
-feat_vec *feat_vec_copy(feat_vec *fv)
-{
-  feat_vec *copy = feat_vec_new(fv->size);
-  int i;
-  for(i=0; i < fv->nb; i++){
-    feat_vec_add(copy, fv->t[i]);
-  }
-  return copy;
-}
-
-int feat_vec_add(feat_vec *fv, int feat)
-{
-  if(fv->nb == fv->size -1){
-    fv->size = 2 * (fv->size + 1);
-    fv->t = (int *)realloc(fv->t, fv->size * sizeof(int));
-  }
-  fv->t[fv->nb] = feat;
-  fv->nb++;
-  return fv->nb;
-}
-
-void feat_vec_empty(feat_vec *fv)
-{
-  fv->nb = 0;
-}
-
-void feat_vec_print_string(feat_vec *fv, dico *dico_features)
-{
-  int i;
-  for(i=0; i < fv->nb; i++){
-    if(fv->t[i] != -1)
-      printf("\t%s", dico_int2string(dico_features, fv->t[i]));
-    else
-      printf("\tNULL");
-  }
-  printf("\n");
-}
-
-void feat_vec_print(FILE *f, feat_vec *fv)
-{
-  int i;
-  for(i=0; i < fv->nb; i++)
-    fprintf(f, "\t%d", fv->t[i]);
-  fprintf(f, "\n");
-}
-
-void feat_vec_print_dnn(FILE *f, feat_vec *fv, feat_model *fm, mcd *m)
-{
-  int i,j;
-  feat_desc *fd;
-  simple_feat_desc *sfd;
-  int mcd_representation;
-  int column;
-
-  for(i=0; i < fm->nbelem; i++){
-    fd = fm->array[i];
-    sfd = fd->array[0];
-    
-    if((sfd->type <= FEAT_TYPE_INT_16) && (sfd->type >= FEAT_TYPE_INT_1)){
-      int range = sfd->type - FEAT_TYPE_INT_0;
-      for(j=0; j < range; j++){
-	/* if(i + j != 0) fprintf(f, " "); */
-	if(j == fv->t[i])
-	  fprintf(f, "1 ");
-	else
-	  fprintf(f, "0 ");
-      }
-    }
-    else{
-      column = m->wf2col[sfd->type];
-      mcd_representation = m->representation[column];
-      if(mcd_representation == MCD_REPRESENTATION_EMB){
-	/* if(i != 0) fprintf(f, " "); */
-	word_emb_print(f, m->word_emb_array[column], fv->t[i]);
-      }
-      else if(mcd_representation == MCD_REPRESENTATION_VOCAB){
-	for(j=0; j < m->dico_array[column]->nbelem; j++){
-	  /* if(i + j != 0) fprintf(f, " "); */
-	  if(j == fv->t[i])
-	    fprintf(f, "1 ");
-	  else
-	    fprintf(f, "0 ");
-	}
-      }
-    }
-  fprintf(f, "\n");
-
-  }
-  fprintf(f, "\n");
-}
-
-/* void feat_vec_fill_input_array_dnn(fann_type *input_array, feat_vec *fv, feat_model *fm, mcd *m) */
-void feat_vec_fill_input_array_dnn(float *input_array, feat_vec *fv, feat_model *fm, mcd *m)
-{
-  int i,j;
-  feat_desc *fd;
-  simple_feat_desc *sfd;
-  int mcd_representation;
-  int current_index = 0;
-  int column;
-
-  for(i=0; i < fm->nbelem; i++){
-    fd = fm->array[i];
-    sfd = fd->array[0];
-
-    if((sfd->type <= FEAT_TYPE_INT_16) && (sfd->type >= FEAT_TYPE_INT_1)){
-      int range = sfd->type - FEAT_TYPE_INT_0;
-      for(j=0; j < range; j++){
-	if(j == fv->t[i])
-	  input_array[current_index++] = 1;
-	else
-	  input_array[current_index++] = 0;
-      }
-    }
-    else{
-      column = m->wf2col[sfd->type];
-      mcd_representation = m->representation[column];
-      if(mcd_representation == MCD_REPRESENTATION_EMB){
-	current_index =  word_emb_fill_input_array_dnn(input_array, m->word_emb_array[column], fv->t[i], current_index);
-      }
-      else if(mcd_representation == MCD_REPRESENTATION_VOCAB){
-	for(j=0; j < m->dico_array[column]->nbelem; j++){
-	  if(j == fv->t[i])
-	    input_array[current_index++] = 1;
-	  else
-	    input_array[current_index++] = 0;
-	}
-      }
-    }
- 
-  }
-}
-
diff --git a/maca_trans_parser/src/maca_trans_parser_mcf2fann.c b/maca_trans_parser/src/maca_trans_parser_mcf2fann.c
index aa3eb8a0db816b483da9dad83f0a09e45d67bd96..ed3991282fcfc90f51b8bd9581e2c49dc2514806 100644
--- a/maca_trans_parser/src/maca_trans_parser_mcf2fann.c
+++ b/maca_trans_parser/src/maca_trans_parser_mcf2fann.c
@@ -7,6 +7,7 @@
 #include"oracle_parser.h"
 #include"feat_fct.h"
 #include"context.h"
+#include"feat_types.h"
 #include"feat_vec.h"
 #include"dico_vec.h"
 #include"word_emb.h"
@@ -169,3 +170,94 @@ int main(int argc, char *argv[])
   return 0;
 }
 
+
+
+
+void feat_vec_print_dnn(FILE *f, feat_vec *fv, feat_model *fm, mcd *m)
+{
+  int i,j;
+  feat_desc *fd;
+  simple_feat_desc *sfd;
+  int mcd_representation;
+  int column;
+
+  for(i=0; i < fm->nbelem; i++){
+    fd = fm->array[i];
+    sfd = fd->array[0];
+    
+    if((sfd->type <= FEAT_TYPE_INT_16) && (sfd->type >= FEAT_TYPE_INT_1)){
+      int range = sfd->type - FEAT_TYPE_INT_0;
+      for(j=0; j < range; j++){
+	/* if(i + j != 0) fprintf(f, " "); */
+	if(j == fv->t[i])
+	  fprintf(f, "1 ");
+	else
+	  fprintf(f, "0 ");
+      }
+    }
+    else{
+      column = m->wf2col[sfd->type];
+      mcd_representation = m->representation[column];
+      if(mcd_representation == MCD_REPRESENTATION_EMB){
+	/* if(i != 0) fprintf(f, " "); */
+	word_emb_print(f, m->word_emb_array[column], fv->t[i]);
+      }
+      else if(mcd_representation == MCD_REPRESENTATION_VOCAB){
+	for(j=0; j < m->dico_array[column]->nbelem; j++){
+	  /* if(i + j != 0) fprintf(f, " "); */
+	  if(j == fv->t[i])
+	    fprintf(f, "1 ");
+	  else
+	    fprintf(f, "0 ");
+	}
+      }
+    }
+  fprintf(f, "\n");
+
+  }
+  fprintf(f, "\n");
+}
+
+/* void feat_vec_fill_input_array_dnn(fann_type *input_array, feat_vec *fv, feat_model *fm, mcd *m) */
+void feat_vec_fill_input_array_dnn(float *input_array, feat_vec *fv, feat_model *fm, mcd *m)
+{
+  int i,j;
+  feat_desc *fd;
+  simple_feat_desc *sfd;
+  int mcd_representation;
+  int current_index = 0;
+  int column;
+
+  for(i=0; i < fm->nbelem; i++){
+    fd = fm->array[i];
+    sfd = fd->array[0];
+
+    if((sfd->type <= FEAT_TYPE_INT_16) && (sfd->type >= FEAT_TYPE_INT_1)){
+      int range = sfd->type - FEAT_TYPE_INT_0;
+      for(j=0; j < range; j++){
+	if(j == fv->t[i])
+	  input_array[current_index++] = 1;
+	else
+	  input_array[current_index++] = 0;
+      }
+    }
+    else{
+      column = m->wf2col[sfd->type];
+      mcd_representation = m->representation[column];
+      if(mcd_representation == MCD_REPRESENTATION_EMB){
+	current_index =  word_emb_fill_input_array_dnn(input_array, m->word_emb_array[column], fv->t[i], current_index);
+      }
+      else if(mcd_representation == MCD_REPRESENTATION_VOCAB){
+	for(j=0; j < m->dico_array[column]->nbelem; j++){
+	  if(j == fv->t[i])
+	    input_array[current_index++] = 1;
+	  else
+	    input_array[current_index++] = 0;
+	}
+      }
+    }
+ 
+  }
+}
+
+
diff --git a/perceptron/CMakeLists.txt b/perceptron/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8d88845ff41615e3c2531bcc8c7fd6dca67e2222
--- /dev/null
+++ b/perceptron/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(lib)
+add_subdirectory(exec)
diff --git a/perceptron/exec/CMakeLists.txt b/perceptron/exec/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..ad4c79a4e79e6cfea0fea777521517242b628f9c
--- /dev/null
+++ b/perceptron/exec/CMakeLists.txt
@@ -0,0 +1,16 @@
+#compiling, linking and installing executables
+
+add_executable(perceptron_train perceptron_train.c)
+target_link_libraries(perceptron_train perceptron)
+target_link_libraries(perceptron_train maca_common)
+install (TARGETS perceptron_train DESTINATION bin)
+
+#add_executable(maca_trans_parser_cff_cutoff cff_cutoff.c)
+#target_link_libraries(maca_trans_parser_cff_cutoff perceptron)
+#target_link_libraries(maca_trans_parser_cff_cutoff maca_common)
+#install (TARGETS maca_trans_parser_cff_cutoff DESTINATION bin)
+
+add_executable(perceptron_eval perceptron_eval.c)
+target_link_libraries(perceptron_eval perceptron)
+target_link_libraries(perceptron_eval maca_common)
+install (TARGETS perceptron_eval DESTINATION bin)
diff --git a/maca_trans_parser/src/cff_cutoff.c b/perceptron/exec/cff_cutoff.c
similarity index 91%
rename from maca_trans_parser/src/cff_cutoff.c
rename to perceptron/exec/cff_cutoff.c
index 5801501c9ca40a8525207df0d309b0ee9adafb8d..916df6e35061bd319cf2f5fd0de3d8404cc32aad 100644
--- a/maca_trans_parser/src/cff_cutoff.c
+++ b/perceptron/exec/cff_cutoff.c
@@ -3,21 +3,18 @@
 #include<string.h>
 #include<unistd.h>
 #include<getopt.h>
-#include"movement_parser.h"
-#include"oracle_parser.h"
 #include"feature_table.h"
 #include"dico.h"
 #include"perceptron.h"
-#include"context.h"
+#include"perceptron_context.h"
 #include"cf_file.h"
 
-void cff_cutoff_help_message(context *ctx)
+void cff_cutoff_help_message(perceptron_context *ctx)
 {
-  context_general_help_message(ctx);
+  perceptron_context_help_message(ctx);
   fprintf(stderr, "INPUT\n");
-  context_cutoff_help_message(ctx);
-  context_cff_help_message(ctx);
-  fprintf(stderr, "INPUT/OUTPUT\n");
+  perceptron_context_cutoff_help_message(ctx);
+
 }
 
 void cff_cutoff_check_options(context *ctx)
diff --git a/maca_trans_parser/src/eval_classifier.c b/perceptron/exec/perceptron_eval.c
similarity index 75%
rename from maca_trans_parser/src/eval_classifier.c
rename to perceptron/exec/perceptron_eval.c
index c5fd0a81e3da92987ab0a702fdb3eba27c10aada..4d25239b2e2b654e0802a9aa319b9a46f63e6d13 100644
--- a/maca_trans_parser/src/eval_classifier.c
+++ b/perceptron/exec/perceptron_eval.c
@@ -3,19 +3,20 @@
 #include<string.h>
 #include<unistd.h>
 #include<getopt.h>
+#include"util.h"
 #include"feature_table.h"
 #include"perceptron.h"
-#include"context.h"
+#include"perceptron_context.h"
 
-void eval_classifier_help_message(context *ctx)
+void eval_classifier_help_message(perceptron_context *ctx)
 {
-  context_general_help_message(ctx);
-  fprintf(stderr, "INPUT\n");
-  context_model_help_message(ctx);
-  context_cff_help_message(ctx);
+  perceptron_context_help_message(ctx);
+  /* fprintf(stderr, "INPUT\n"); */
+  /* perceptron_context_model_help_message(ctx); */
+  /* perceptron_context_cff_help_message(ctx); */
 }
 
-void eval_classifier_check_options(context *ctx)
+void eval_classifier_check_options(perceptron_context *ctx)
 {
   if(!ctx->cff_filename
      || !ctx->perc_model_filename
@@ -37,10 +38,10 @@ int main(int argc, char *argv[])
   feat_vec *fv = feat_vec_new(2);
   char *token;
   float accuracy;
-  context *ctx;
+  perceptron_context *ctx;
   float score;
 
-  ctx = context_read_options(argc, argv);
+  ctx = perceptron_context_read_options(argc, argv);
   eval_classifier_check_options(ctx);
 
   ft = feature_table_load(ctx->perc_model_filename, ctx->verbose);
diff --git a/maca_trans_parser/src/train.c b/perceptron/exec/perceptron_train.c
similarity index 62%
rename from maca_trans_parser/src/train.c
rename to perceptron/exec/perceptron_train.c
index e084359b4ae9e6e25922cabcb00f959045f96b37..ba5b91823b74dbea752f810560cadde290a38bcb 100644
--- a/maca_trans_parser/src/train.c
+++ b/perceptron/exec/perceptron_train.c
@@ -3,26 +3,18 @@
 #include<string.h>
 #include<unistd.h>
 #include<getopt.h>
-#include"movement_parser.h"
-#include"oracle_parser.h"
-#include"feat_fct.h"
 #include"feature_table.h"
 #include"dico.h"
 #include"perceptron.h"
-#include"context.h"
+#include"perceptron_context.h"
 #include"cf_file.h"
 
-void train_help_message(context *ctx)
+void train_help_message(perceptron_context *ctx)
 {
-  context_general_help_message(ctx);
-  context_iterations_help_message(ctx);
-  fprintf(stderr, "INPUT\n");
-  context_cff_help_message(ctx);
-  fprintf(stderr, "OUTPUT\n");
-  context_model_help_message(ctx);
+  perceptron_context_help_message(ctx);
 }
 
-void train_check_options(context *ctx)
+void train_check_options(perceptron_context *ctx)
 {
   if(!ctx->cff_filename
      || !ctx->perc_model_filename
@@ -37,9 +29,9 @@ int main(int argc, char *argv[])
 {
   int nb_feat, nb_class;
   feature_table *ft;
-  context *ctx;
+  perceptron_context *ctx;
 
-  ctx = context_read_options(argc, argv);
+  ctx = perceptron_context_read_options(argc, argv);
   train_check_options(ctx);
 
   look_for_number_of_features_and_classes(ctx->cff_filename, &nb_feat, &nb_class);
@@ -49,7 +41,7 @@ int main(int argc, char *argv[])
   perceptron_avg(ctx->cff_filename, ft, ctx->iteration_nb);
   feature_table_dump(ctx->perc_model_filename, ft);
   
-  context_free(ctx);
+  perceptron_context_free(ctx);
 
   return 0;
 }
diff --git a/maca_trans_parser/src/print_model.c b/perceptron/exec/print_model.c
similarity index 100%
rename from maca_trans_parser/src/print_model.c
rename to perceptron/exec/print_model.c
diff --git a/perceptron/lib/CMakeLists.txt b/perceptron/lib/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a8e202fe53bb90840051343bb4551f96d5a73665
--- /dev/null
+++ b/perceptron/lib/CMakeLists.txt
@@ -0,0 +1,10 @@
+set(SOURCES  src/cf_file.c
+  src/feature_table.c
+  src/perceptron.c
+  src/feat_vec.c
+  src/perceptron_context.c
+)
+
+#compiling library
+include_directories(src)
+add_library(perceptron STATIC ${SOURCES})
diff --git a/maca_trans_parser/src/cf_file.h b/perceptron/lib/include/cf_file.h
similarity index 100%
rename from maca_trans_parser/src/cf_file.h
rename to perceptron/lib/include/cf_file.h
diff --git a/maca_trans_parser/src/feat_vec.h b/perceptron/lib/include/feat_vec.h
similarity index 100%
rename from maca_trans_parser/src/feat_vec.h
rename to perceptron/lib/include/feat_vec.h
diff --git a/maca_trans_parser/src/feature_table.h b/perceptron/lib/include/feature_table.h
similarity index 100%
rename from maca_trans_parser/src/feature_table.h
rename to perceptron/lib/include/feature_table.h
diff --git a/maca_trans_parser/src/perceptron.h b/perceptron/lib/include/perceptron.h
similarity index 100%
rename from maca_trans_parser/src/perceptron.h
rename to perceptron/lib/include/perceptron.h
diff --git a/perceptron/lib/include/perceptron_context.h b/perceptron/lib/include/perceptron_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6bf4549cdee25dcd0b25fdcc2668ab9539a65a1
--- /dev/null
+++ b/perceptron/lib/include/perceptron_context.h
@@ -0,0 +1,22 @@
+#ifndef __PERCEPTRON_CONTEXT__
+#define __PERCEPTRON_CONTEXT__
+
+#include "dico_vec.h"
+#include<stdlib.h>
+
+typedef struct {
+  int help;
+  int verbose;
+  char *program_name;
+  char *cff_filename;
+  char *perc_model_filename;
+  int iteration_nb;
+} perceptron_context;
+
+perceptron_context *perceptron_context_new(void);
+void perceptron_context_free(perceptron_context *ctx);
+perceptron_context *perceptron_context_read_options(int argc, char *argv[]);
+void perceptron_context_help_message(perceptron_context *ctx);
+
+
+#endif
diff --git a/maca_trans_parser/src/cf_file.c b/perceptron/lib/src/cf_file.c
similarity index 100%
rename from maca_trans_parser/src/cf_file.c
rename to perceptron/lib/src/cf_file.c
diff --git a/perceptron/lib/src/feat_vec.c b/perceptron/lib/src/feat_vec.c
new file mode 100644
index 0000000000000000000000000000000000000000..ef3f844494f2166fd46ff71d333b81f747fe8d83
--- /dev/null
+++ b/perceptron/lib/src/feat_vec.c
@@ -0,0 +1,80 @@
+#include<stdio.h>
+#include<stdlib.h>
+#include"feat_vec.h"
+#include"util.h"
+/* #include "feat_types.h" */
+/* #include "feat_model.h" */
+
+void feat_vec_concat(feat_vec *fv1, feat_vec *fv2)
+{
+  int i;
+  for(i=0; i < fv2->nb; i++)
+    if(fv2->t[i] != -1)
+      feat_vec_add(fv1, fv2->t[i]);
+}
+
+
+feat_vec *feat_vec_new(int size)
+{
+  feat_vec *fv = (feat_vec *)memalloc(sizeof(feat_vec));
+  fv->size = size;
+  fv->nb = 0;
+  fv->t = (int *)memalloc(size * sizeof(int));
+  return fv;
+}
+
+void feat_vec_free(feat_vec *fv)
+{
+  if(fv){
+    if(fv->t)
+      free(fv->t);
+    free(fv);
+  }
+}
+
+feat_vec *feat_vec_copy(feat_vec *fv)
+{
+  feat_vec *copy = feat_vec_new(fv->size);
+  int i;
+  for(i=0; i < fv->nb; i++){
+    feat_vec_add(copy, fv->t[i]);
+  }
+  return copy;
+}
+
+int feat_vec_add(feat_vec *fv, int feat)
+{
+  if(fv->nb == fv->size -1){
+    fv->size = 2 * (fv->size + 1);
+    fv->t = (int *)realloc(fv->t, fv->size * sizeof(int));
+  }
+  fv->t[fv->nb] = feat;
+  fv->nb++;
+  return fv->nb;
+}
+
+void feat_vec_empty(feat_vec *fv)
+{
+  fv->nb = 0;
+}
+
+void feat_vec_print_string(feat_vec *fv, dico *dico_features)
+{
+  int i;
+  for(i=0; i < fv->nb; i++){
+    if(fv->t[i] != -1)
+      printf("\t%s", dico_int2string(dico_features, fv->t[i]));
+    else
+      printf("\tNULL");
+  }
+  printf("\n");
+}
+
+void feat_vec_print(FILE *f, feat_vec *fv)
+{
+  int i;
+  for(i=0; i < fv->nb; i++)
+    fprintf(f, "\t%d", fv->t[i]);
+  fprintf(f, "\n");
+}
+
diff --git a/maca_trans_parser/src/feature_table.c b/perceptron/lib/src/feature_table.c
similarity index 100%
rename from maca_trans_parser/src/feature_table.c
rename to perceptron/lib/src/feature_table.c
diff --git a/maca_trans_parser/src/perceptron.c b/perceptron/lib/src/perceptron.c
similarity index 100%
rename from maca_trans_parser/src/perceptron.c
rename to perceptron/lib/src/perceptron.c
diff --git a/perceptron/lib/src/perceptron_context.c b/perceptron/lib/src/perceptron_context.c
new file mode 100644
index 0000000000000000000000000000000000000000..2013181d9db01d57d0f5db6d1f078804ae31be8f
--- /dev/null
+++ b/perceptron/lib/src/perceptron_context.c
@@ -0,0 +1,86 @@
+#include<stdlib.h>
+#include<stdio.h>
+#include<string.h>
+#include<unistd.h>
+#include<getopt.h>
+#include "perceptron_context.h"
+#include "util.h"
+
+void perceptron_context_free(perceptron_context *ctx)
+{
+  if(ctx->program_name)            free(ctx->program_name);
+  if(ctx->cff_filename)            free(ctx->cff_filename);
+  if(ctx->perc_model_filename)     free(ctx->perc_model_filename);
+
+  free(ctx);
+}
+
+perceptron_context *perceptron_context_new(void)
+{
+  perceptron_context *ctx = (perceptron_context *)memalloc(sizeof(perceptron_context));
+
+  ctx->verbose = 0;
+  ctx->program_name = NULL;
+  ctx->perc_model_filename = NULL;
+  ctx->cff_filename = NULL;
+  ctx->iteration_nb = 4;
+
+  return ctx;
+}
+
+void perceptron_context_help_message(perceptron_context *ctx)
+{
+    fprintf(stderr, "usage: %s [options]\n", ctx->program_name);
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "\t-h --help                 : print this message\n");
+    fprintf(stderr, "\t-v --verbose              : activate verbose mode\n");
+    fprintf(stderr, "\t-n --iter           <int> : number of iterations  (default is 4)\n");
+    fprintf(stderr, "\t-c --cff           <file> : CFF format file name\n");
+    fprintf(stderr, "\t-m --model         <file> : model file name\n");
+}
+
+perceptron_context *perceptron_context_read_options(int argc, char *argv[])
+{
+  int c;
+  int option_index = 0;
+  perceptron_context *ctx = perceptron_context_new();
+
+  ctx->program_name = strdup(argv[0]);
+
+  static struct option long_options[5] =
+    {
+      {"help",                no_argument,       0, 'h'},
+      {"verbose",             no_argument,       0, 'v'},
+      {"model",               required_argument, 0, 'm'}, 
+      {"iter",                required_argument, 0, 'n'},
+      {"cff",                 required_argument, 0, 'c'}
+    };
+  optind = 0;
+  opterr = 0;
+  
+  
+  while ((c = getopt_long (argc, argv, "hvm:n:c:", long_options, &option_index)) != -1){ 
+    switch (c)
+      {
+      case 'h':
+	ctx->help = 1;
+	break;
+      case 'v':
+	ctx->verbose = 1;
+	break;
+      case 'm':
+	ctx->perc_model_filename = strdup(optarg);
+	break;
+      case 'n':
+	ctx->iteration_nb = atoi(optarg);
+	break;
+      case 'c':
+	ctx->cff_filename = strdup(optarg);
+	break;
+      }
+  }
+
+  return ctx;
+}
+
+