Revision f8d23451

b/lib/filters/bayes-filter.c
257 257
	}
258 258

  
259 259
	cmb_prob = prod / (prod + prod_rev);
260
	xfilter_debug_print("\ncombined probability: %4f\n", cmb_prob);
260
	xfilter_debug_print("\ncombined probability (Paul/Naive): %4f\n", cmb_prob);
261 261

  
262 262
	g_array_free(pdata->array, TRUE);
263 263
	g_hash_table_destroy(table);
......
386 386
	P = chi2q(-2 * sum_rev, 2 * N);
387 387
	Q = chi2q(-2 * sum, 2 * N);
388 388
	cmb_prob = (1 + Q - P) / 2;
389
	xfilter_debug_print("\ncombined probability: %4f\n", cmb_prob);
389
	xfilter_debug_print("\ncombined probability (Robinson-Fisher): %4f\n", cmb_prob);
390 390

  
391 391
	g_array_free(pdata->array, TRUE);
392 392
	g_hash_table_destroy(table);
......
400 400
	XFilterBayesProbData pdata;
401 401
	double cmb_prob;
402 402
	XFilterStatus status;
403
	int method_type = 1;
403
	const char *method;
404 404

  
405 405
	g_return_val_if_fail(result != NULL, XF_ERROR);
406 406

  
......
418 418

  
419 419
	xfilter_debug_print("bayes-guessing message\n");
420 420

  
421
	method = xfilter_get_conf_value("method");
422

  
421 423
	xfilter_bayes_get_learn_status(&pdata.status);
422 424
	if (pdata.status.junk_learned_num < 1) {
423 425
		xfilter_debug_print("junk message not learned yet\n");
......
426 428
		xfilter_debug_print("clean message not learned yet\n");
427 429
		cmb_prob = 0.5;
428 430
	} else {
429
		if (method_type == 1)
430
			cmb_prob = xfilter_get_combined_prob_fisher(data, &pdata);
431
		else
431
		if (method && method[0] == 'n')
432 432
			cmb_prob = xfilter_get_combined_prob_naive(data, &pdata);
433
		else
434
			cmb_prob = xfilter_get_combined_prob_fisher(data, &pdata);
433 435
	}
434 436

  
435 437
	xfilter_result_set_probability(result, cmb_prob);
b/src/sylfilter.c
60 60
	int mode = MODE_TEST_JUNK;
61 61
	int learn_mode = MODE_LEARN_NONE;
62 62
	int no_bias = 0;
63
	char *method = NULL;
63 64
	int count = 0;
64 65
	const char *dbpath;
65 66
#ifdef USE_QDBM
......
102 103
			engine = argv[i];
103 104
		} else if (!strcmp(argv[i], "-B")) {
104 105
			no_bias = 1;
106
		} else if (!strcmp(argv[i], "-m")) {
107
			i++;
108
			if (i >= argc) {
109
				usage();
110
				return 1;
111
			}
112
			if (argv[i][0] == 'n')
113
				method = "n";
105 114
		} else if (!strcmp(argv[i], "-h")) {
106 115
			usage();
107 116
			return 0;
......
137 146
	if (verbose)
138 147
		printf("engine %s has been selected\n", engine);
139 148

  
140
	/* set global config value */
149
	/* set global config values */
141 150
	if (no_bias)
142 151
		xfilter_set_conf_value("no-bias", "t");
152
	if (method)
153
		xfilter_set_conf_value("method", method);
143 154

  
144 155
	xfilter_utils_set_base_dir(NULL);
145 156

  
......
154 165
		retval = xfilter_bayes_db_show_contents(verbose);
155 166
	} else if (mode == MODE_LEARN) {
156 167
		for (i = 1; i < argc; i++) {
157
			if (!strcmp(argv[i], "-E")) {
168
			if (!strcmp(argv[i], "-E") || !strcmp(argv[i], "-m")) {
158 169
				i++;
159 170
				if (i >= argc)
160 171
					break;
......
167 178
		}
168 179
	} else {
169 180
		for (i = 1; i < argc; i++) {
170
			if (!strcmp(argv[i], "-E")) {
181
			if (!strcmp(argv[i], "-E") || !strcmp(argv[i], "-m")) {
171 182
				i++;
172 183
				if (i >= argc)
173 184
					break;
......
353 364
	printf("  -d  show debug messages\n");
354 365
	printf("  -B  do not bias probability for clean mail\n");
355 366
	printf("      (may increase false-positive)\n");
367
	printf("  -m n|r\n");
368
	printf("      specify filtering method\n");
369
	printf("      n : Paul Graham (Naive Bayes) method\n");
370
	printf("      r : Gary Robinson (Robinson-Fisher) method (default)\n");
356 371
	printf("  -h  print this help message\n");
357 372
	printf("\n");
358 373
	printf("  -E <engine_name>\n");
359
	printf("      Specify key-value store engine (show below)\n");
374
	printf("      specify key-value store engine (show below)\n");
360 375
	printf("\n");
361 376
	printf("Return values:\n");
362 377
	printf("  0   junk (spam)\n");

Also available in: Unified diff