Revision fbcd41fa
| b/lib/filters/bayes-filter.c | ||
|---|---|---|
| 329 | 329 |
const char *type; |
| 330 | 330 |
GHashTable *table; |
| 331 | 331 |
XFilterKVS *kvs; |
| 332 |
int sum_add; |
|
| 332 | 333 |
|
| 333 | 334 |
g_return_val_if_fail(result != NULL, XF_ERROR); |
| 334 | 335 |
|
| ... | ... | |
| 356 | 357 |
XFilterLearnWalkData lwd = {kvs, 0};
|
| 357 | 358 |
|
| 358 | 359 |
g_hash_table_foreach(table, learn_walk_func, &lwd); |
| 360 |
sum_add = lwd.sum; |
|
| 361 |
} else {
|
|
| 362 |
g_hash_table_foreach(table, unlearn_walk_func, kvs); |
|
| 363 |
sum_add = xfilter_kvs_count_sum(kvs); |
|
| 364 |
} |
|
| 365 |
xfilter_kvs_end(kvs); |
|
| 366 |
g_hash_table_destroy(table); |
|
| 367 |
|
|
| 368 |
xfilter_kvs_begin(prob_kvs); |
|
| 369 |
if (is_register) {
|
|
| 359 | 370 |
if (is_junk) {
|
| 360 |
xfilter_kvs_increment(prob_kvs, "@junk_words_sum", lwd.sum);
|
|
| 371 |
xfilter_kvs_increment(prob_kvs, "@junk_words_sum", sum_add);
|
|
| 361 | 372 |
xfilter_kvs_increment(prob_kvs, "@junk_learn_count", 1); |
| 362 | 373 |
} else {
|
| 363 |
xfilter_kvs_increment(prob_kvs, "@clean_words_sum", lwd.sum);
|
|
| 374 |
xfilter_kvs_increment(prob_kvs, "@clean_words_sum", sum_add);
|
|
| 364 | 375 |
xfilter_kvs_increment(prob_kvs, "@clean_learn_count", 1); |
| 365 | 376 |
} |
| 366 | 377 |
} else {
|
| 367 |
g_hash_table_foreach(table, unlearn_walk_func, kvs); |
|
| 368 | 378 |
if (is_junk) {
|
| 369 |
xfilter_kvs_set_int(prob_kvs, "@junk_words_sum", xfilter_kvs_count_sum(kvs));
|
|
| 379 |
xfilter_kvs_set_int(prob_kvs, "@junk_words_sum", sum_add);
|
|
| 370 | 380 |
xfilter_kvs_decrement(prob_kvs, "@junk_learn_count", 1); |
| 371 | 381 |
} else {
|
| 372 |
xfilter_kvs_set_int(prob_kvs, "@clean_words_sum", xfilter_kvs_count_sum(kvs));
|
|
| 382 |
xfilter_kvs_set_int(prob_kvs, "@clean_words_sum", sum_add);
|
|
| 373 | 383 |
xfilter_kvs_decrement(prob_kvs, "@clean_learn_count", 1); |
| 374 | 384 |
} |
| 375 | 385 |
} |
| 376 |
xfilter_kvs_end(kvs); |
|
| 377 |
g_hash_table_destroy(table); |
|
| 386 |
xfilter_kvs_end(prob_kvs); |
|
| 378 | 387 |
|
| 379 | 388 |
xfilter_result_set_status(result, XF_NONE); |
| 380 | 389 |
|
Also available in: Unified diff