您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

statistic.conf 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Please don't modify this file as your changes might be overwritten with
  2. # the next update.
  3. #
  4. # You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine
  5. # parameters defined on the top level
  6. #
  7. # You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add
  8. # parameters defined on the top level
  9. #
  10. # For specific modules or configuration you can also modify
  11. # '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults
  12. # '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults
  13. #
  14. # See https://rspamd.com/doc/tutorials/writing_rules.html for details
  15. # Rspamd statistic setup
  16. # Pre-built files could be loaded from:
  17. # http://rspamd.com/rspamd_statistics/bayes.spam.sqlite
  18. # - and -
  19. # http://rspamd.com/rspamd_statistics/bayes.ham.sqlite
  20. classifier "bayes" {
  21. tokenizer {
  22. name = "osb";
  23. }
  24. cache {
  25. path = "${DBDIR}/learn_cache.sqlite";
  26. }
  27. min_tokens = 11;
  28. backend = "sqlite3";
  29. languages_enabled = true;
  30. min_learns = 200;
  31. statfile {
  32. symbol = "BAYES_HAM";
  33. path = "${DBDIR}/bayes.ham.sqlite";
  34. spam = false;
  35. }
  36. statfile {
  37. symbol = "BAYES_SPAM";
  38. path = "${DBDIR}/bayes.spam.sqlite";
  39. spam = true;
  40. }
  41. learn_condition =<<EOD
  42. return function(task, is_spam, is_unlearn)
  43. local prob = task:get_mempool():get_variable('bayes_prob', 'double')
  44. if prob then
  45. local in_class = false
  46. local cl
  47. if is_spam then
  48. cl = 'spam'
  49. in_class = prob >= 0.95
  50. else
  51. cl = 'ham'
  52. in_class = prob <= 0.05
  53. end
  54. if in_class then
  55. return false,string.format('already in class %s; probability %.2f%%',
  56. cl, math.abs((prob - 0.5) * 200.0))
  57. end
  58. end
  59. return true
  60. end
  61. EOD
  62. .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/classifier-bayes.conf"
  63. .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/classifier-bayes.conf"
  64. }
  65. .include(try=true; priority=1) "$LOCAL_CONFDIR/local.d/statistic.conf"
  66. .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/statistic.conf"