diff --git a/maca_morpho/src/context.c b/maca_morpho/src/context.c index feed4972a06e4a7ff0ec4b8a2e2fd0ba255b4f7d..56516df6c963e3d4e314d605c1f30b8870be8f8e 100644 --- a/maca_morpho/src/context.c +++ b/maca_morpho/src/context.c @@ -29,6 +29,7 @@ context *context_new(void) ctx->fplm_filename = NULL; ctx->language = strdup("fr"); ctx->maca_data_path = NULL; + ctx->features_filename = NULL; return ctx; } @@ -48,6 +49,7 @@ void context_fplm_help_message(context *ctx){ void context_language_help_message(context *ctx){ fprintf(stderr, "\t-L --language : identifier of the language to use\n"); } + void context_maca_data_path_help_message(context *ctx){ fprintf(stderr, "\t-M --maca_data_path : path to maca_data directory\n"); } @@ -56,6 +58,10 @@ void context_fm_help_message(context *ctx){ fprintf(stderr, "\t-F --fm <file> : feature model file name\n"); } +void context_features_filename_help_message(context *ctx){ + fprintf(stderr, "\t-x --feat <file> : features dictionary file name\n"); +} + context *context_read_options(int argc, char *argv[]) { @@ -65,7 +71,7 @@ context *context_read_options(int argc, char *argv[]) ctx->program_name = strdup(argv[0]); - static struct option long_options[8] = + static struct option long_options[9] = { {"help", no_argument, 0, 'h'}, {"verbose", no_argument, 0, 'v'}, @@ -74,12 +80,13 @@ context *context_read_options(int argc, char *argv[]) {"language", required_argument, 0, 'L'}, {"fplm", required_argument, 0, 'f'}, {"maca_data_path", required_argument, 0, 'D'}, - {"fm", required_argument, 0, 'F'} + {"fm", required_argument, 0, 'F'}, + {"feat", required_argument, 0, 'x'} }; optind = 0; opterr = 0; - while ((c = getopt_long (argc, argv, "hvdf:L:M:D:F:", long_options, &option_index)) != -1){ + while ((c = getopt_long (argc, argv, "hvdf:L:M:D:F:x:", long_options, &option_index)) != -1){ switch (c) { case 'd': @@ -103,6 +110,9 @@ context *context_read_options(int argc, char *argv[]) case 'F': ctx->fm_filename = strdup(optarg); break; + case 'x': + ctx->features_filename = strdup(optarg); + break; } } diff --git a/maca_morpho/src/context.h b/maca_morpho/src/context.h index 14cdfb70fd61334f10f8ecf99ee0d0979985a791..c0621bda99bdce9bb211be01be76771c6b817553 100644 --- a/maca_morpho/src/context.h +++ b/maca_morpho/src/context.h @@ -17,6 +17,7 @@ typedef struct { char *language; char *maca_data_path; char *fm_filename; + char *features_filename; } context; @@ -26,12 +27,8 @@ void context_free(context *ctx); context *context_read_options(int argc, char *argv[]); void context_general_help_message(context *ctx); -void context_conll_help_message(context *ctx); void context_language_help_message(context *ctx); void context_fplm_help_message(context *ctx); void context_maca_data_path_help_message(context *ctx); -void context_mcd_help_message(context *ctx); -void context_form_column_help_message(context *ctx); -void context_pos_column_help_message(context *ctx); - +void context_features_filename_help_message(context *ctx); #endif diff --git a/maca_morpho/src/fplm2cff.c b/maca_morpho/src/fplm2cff.c index 52aa4df48a14cec584c70834dee9e3f99a4797b7..92c10f8ce5186919c646bdd4b209e3ac45592097 100644 --- a/maca_morpho/src/fplm2cff.c +++ b/maca_morpho/src/fplm2cff.c @@ -49,6 +49,14 @@ feat_vec *form2fv(char *form, feat_vec *fv, feat_model *fm, dico *dico_features) int main(int argc, char *argv[]) { context *ctx = context_read_options(argc, argv); + if(ctx->help){ + context_general_help_message(ctx); + context_language_help_message(ctx); + context_fplm_help_message(ctx); + context_maca_data_path_help_message(ctx); + context_features_filename_help_message(ctx); + exit(1); + } feat_vec *fv = feat_vec_new(10); dico *dico_features = dico_new("dico_features", 1000); feat_model *fm = feat_model_read(ctx->fm_filename, feat_lib_build(), ctx->verbose); @@ -61,7 +69,8 @@ int main(int argc, char *argv[]) feat_vec_print(stdout, fv); } /* dico_print_fh(stdout, dico_features); */ - dico_print("xx", dico_features); + if(ctx->features_filename) + dico_print(ctx->features_filename, dico_features);