despamilator 0.8 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +47 -0
- data/History.txt +14 -0
- data/Manifest.txt +9 -605
- data/README.rdoc +37 -37
- data/Rakefile +10 -3
- data/despamilator.gemspec +8 -11
- data/lib/despamilator.rb +26 -1
- data/lib/despamilator/filter.rb +15 -26
- data/lib/despamilator/filter/funky_consonant.rb +25 -15
- data/lib/despamilator/filter/html_tags.rb +122 -111
- data/lib/despamilator/filter/ip_address_url.rb +18 -8
- data/lib/despamilator/filter/long_words.rb +20 -10
- data/lib/despamilator/filter/naughty_q.rb +24 -14
- data/lib/despamilator/filter/naughty_words.rb +25 -16
- data/lib/despamilator/filter/numbers_and_words.rb +39 -29
- data/lib/despamilator/filter/script_tag.rb +18 -10
- data/lib/despamilator/filter/shouting.rb +25 -15
- data/lib/despamilator/filter/square_brackets.rb +19 -9
- data/lib/despamilator/filter/urls.rb +24 -8
- data/lib/despamilator/filter_base.rb +54 -9
- data/spec/despamilator_spec.rb +0 -2
- data/spec/filter_base_spec.rb +30 -0
- data/spec/filters/funky_consonant_spec.rb +6 -36
- data/spec/filters/html_tags_spec.rb +120 -138
- data/spec/filters/ip_address_url_spec.rb +6 -24
- data/spec/filters/long_words_spec.rb +6 -29
- data/spec/filters/naughty_q_spec.rb +6 -34
- data/spec/filters/naughty_words_spec.rb +6 -34
- data/spec/filters/numbers_and_words_spec.rb +21 -46
- data/spec/filters/script_tag_spec.rb +10 -20
- data/spec/filters/shouting_spec.rb +28 -33
- data/spec/filters/square_brackets_spec.rb +6 -30
- data/spec/filters/urls_spec.rb +6 -34
- data/spec/helpers/corpus_helper.rb +5 -0
- data/spec/helpers/filter_helper.rb +59 -0
- data/spec/helpers/spec_helper.rb +6 -0
- data/tasks/test.rake +6 -0
- metadata +19 -611
- data/lib/despamilator/validation.rb +0 -12
- data/spec/clean_corpus/101.txt.gz +0 -0
- data/spec/clean_corpus/103.txt.gz +0 -0
- data/spec/clean_corpus/105.txt.gz +0 -0
- data/spec/clean_corpus/107.txt.gz +0 -0
- data/spec/clean_corpus/109.txt.gz +0 -0
- data/spec/clean_corpus/111.txt.gz +0 -0
- data/spec/clean_corpus/113.txt.gz +0 -0
- data/spec/clean_corpus/115.txt.gz +0 -0
- data/spec/clean_corpus/117.txt.gz +0 -0
- data/spec/clean_corpus/119.txt.gz +0 -0
- data/spec/clean_corpus/121.txt.gz +0 -0
- data/spec/clean_corpus/123.txt.gz +0 -0
- data/spec/clean_corpus/125.txt.gz +0 -0
- data/spec/clean_corpus/127.txt.gz +0 -0
- data/spec/clean_corpus/129.txt.gz +0 -0
- data/spec/clean_corpus/131.txt.gz +0 -0
- data/spec/clean_corpus/133.txt.gz +0 -0
- data/spec/clean_corpus/135.txt.gz +0 -0
- data/spec/clean_corpus/137.txt.gz +0 -0
- data/spec/clean_corpus/139.txt.gz +0 -0
- data/spec/clean_corpus/141.txt.gz +0 -0
- data/spec/clean_corpus/143.txt.gz +0 -0
- data/spec/clean_corpus/145.txt.gz +0 -0
- data/spec/clean_corpus/147.txt.gz +0 -0
- data/spec/clean_corpus/149.txt.gz +0 -0
- data/spec/clean_corpus/151.txt.gz +0 -0
- data/spec/clean_corpus/153.txt.gz +0 -0
- data/spec/clean_corpus/155.txt.gz +0 -0
- data/spec/clean_corpus/157.txt.gz +0 -0
- data/spec/clean_corpus/159.txt.gz +0 -0
- data/spec/clean_corpus/161.txt.gz +0 -0
- data/spec/clean_corpus/163.txt.gz +0 -0
- data/spec/clean_corpus/165.txt.gz +0 -0
- data/spec/clean_corpus/167.txt.gz +0 -0
- data/spec/clean_corpus/169.txt.gz +0 -0
- data/spec/clean_corpus/171.txt.gz +0 -0
- data/spec/clean_corpus/173.txt.gz +0 -0
- data/spec/clean_corpus/175.txt.gz +0 -0
- data/spec/clean_corpus/177.txt.gz +0 -0
- data/spec/clean_corpus/179.txt.gz +0 -0
- data/spec/clean_corpus/18.txt.gz +0 -0
- data/spec/clean_corpus/181.txt.gz +0 -0
- data/spec/clean_corpus/183.txt.gz +0 -0
- data/spec/clean_corpus/185.txt.gz +0 -0
- data/spec/clean_corpus/187.txt.gz +0 -0
- data/spec/clean_corpus/189.txt.gz +0 -0
- data/spec/clean_corpus/191.txt.gz +0 -0
- data/spec/clean_corpus/193.txt.gz +0 -0
- data/spec/clean_corpus/195.txt.gz +0 -0
- data/spec/clean_corpus/197.txt.gz +0 -0
- data/spec/clean_corpus/199.txt.gz +0 -0
- data/spec/clean_corpus/20.txt.gz +0 -0
- data/spec/clean_corpus/201.txt.gz +0 -0
- data/spec/clean_corpus/203.txt.gz +0 -0
- data/spec/clean_corpus/205.txt.gz +0 -0
- data/spec/clean_corpus/207.txt.gz +0 -0
- data/spec/clean_corpus/209.txt.gz +0 -0
- data/spec/clean_corpus/211.txt.gz +0 -0
- data/spec/clean_corpus/213.txt.gz +0 -0
- data/spec/clean_corpus/215.txt.gz +0 -0
- data/spec/clean_corpus/217.txt.gz +0 -0
- data/spec/clean_corpus/219.txt.gz +0 -0
- data/spec/clean_corpus/22.txt.gz +0 -0
- data/spec/clean_corpus/221.txt.gz +0 -0
- data/spec/clean_corpus/223.txt.gz +0 -0
- data/spec/clean_corpus/225.txt.gz +0 -0
- data/spec/clean_corpus/24.txt.gz +0 -0
- data/spec/clean_corpus/26.txt.gz +0 -0
- data/spec/clean_corpus/27.txt.gz +0 -0
- data/spec/clean_corpus/29.txt.gz +0 -0
- data/spec/clean_corpus/31.txt.gz +0 -0
- data/spec/clean_corpus/33.txt.gz +0 -0
- data/spec/clean_corpus/35.txt.gz +0 -0
- data/spec/clean_corpus/37.txt.gz +0 -0
- data/spec/clean_corpus/39.txt.gz +0 -0
- data/spec/clean_corpus/41.txt.gz +0 -0
- data/spec/clean_corpus/43.txt.gz +0 -0
- data/spec/clean_corpus/45.txt.gz +0 -0
- data/spec/clean_corpus/47.txt.gz +0 -0
- data/spec/clean_corpus/49.txt.gz +0 -0
- data/spec/clean_corpus/51.txt.gz +0 -0
- data/spec/clean_corpus/53.txt.gz +0 -0
- data/spec/clean_corpus/55.txt.gz +0 -0
- data/spec/clean_corpus/57.txt.gz +0 -0
- data/spec/clean_corpus/59.txt.gz +0 -0
- data/spec/clean_corpus/61.txt.gz +0 -0
- data/spec/clean_corpus/63.txt.gz +0 -0
- data/spec/clean_corpus/65.txt.gz +0 -0
- data/spec/clean_corpus/67.txt.gz +0 -0
- data/spec/clean_corpus/69.txt.gz +0 -0
- data/spec/clean_corpus/71.txt.gz +0 -0
- data/spec/clean_corpus/73.txt.gz +0 -0
- data/spec/clean_corpus/75.txt.gz +0 -0
- data/spec/clean_corpus/77.txt.gz +0 -0
- data/spec/clean_corpus/79.txt.gz +0 -0
- data/spec/clean_corpus/81.txt.gz +0 -0
- data/spec/clean_corpus/83.txt.gz +0 -0
- data/spec/clean_corpus/85.txt.gz +0 -0
- data/spec/clean_corpus/87.txt.gz +0 -0
- data/spec/clean_corpus/89.txt.gz +0 -0
- data/spec/clean_corpus/91.txt.gz +0 -0
- data/spec/clean_corpus/93.txt.gz +0 -0
- data/spec/clean_corpus/95.txt.gz +0 -0
- data/spec/clean_corpus/97.txt.gz +0 -0
- data/spec/clean_corpus/99.txt.gz +0 -0
- data/spec/clean_corpus_spec.rb +0 -11
- data/spec/despamilator_validation_spec.rb +0 -27
- data/spec/spam_corpus/0.txt.gz +0 -0
- data/spec/spam_corpus/1.txt.gz +0 -0
- data/spec/spam_corpus/10.txt.gz +0 -0
- data/spec/spam_corpus/100.txt.gz +0 -0
- data/spec/spam_corpus/102.txt.gz +0 -0
- data/spec/spam_corpus/104.txt.gz +0 -0
- data/spec/spam_corpus/106.txt.gz +0 -0
- data/spec/spam_corpus/108.txt.gz +0 -0
- data/spec/spam_corpus/11.txt.gz +0 -0
- data/spec/spam_corpus/110.txt.gz +0 -0
- data/spec/spam_corpus/112.txt.gz +0 -0
- data/spec/spam_corpus/114.txt.gz +0 -0
- data/spec/spam_corpus/116.txt.gz +0 -0
- data/spec/spam_corpus/118.txt.gz +0 -0
- data/spec/spam_corpus/12.txt.gz +0 -0
- data/spec/spam_corpus/120.txt.gz +0 -0
- data/spec/spam_corpus/122.txt.gz +0 -0
- data/spec/spam_corpus/124.txt.gz +0 -0
- data/spec/spam_corpus/126.txt.gz +0 -0
- data/spec/spam_corpus/128.txt.gz +0 -0
- data/spec/spam_corpus/13.txt.gz +0 -0
- data/spec/spam_corpus/130.txt.gz +0 -0
- data/spec/spam_corpus/132.txt.gz +0 -0
- data/spec/spam_corpus/134.txt.gz +0 -0
- data/spec/spam_corpus/136.txt.gz +0 -0
- data/spec/spam_corpus/138.txt.gz +0 -0
- data/spec/spam_corpus/14.txt.gz +0 -0
- data/spec/spam_corpus/140.txt.gz +0 -0
- data/spec/spam_corpus/142.txt.gz +0 -0
- data/spec/spam_corpus/144.txt.gz +0 -0
- data/spec/spam_corpus/146.txt.gz +0 -0
- data/spec/spam_corpus/148.txt.gz +0 -0
- data/spec/spam_corpus/15.txt.gz +0 -0
- data/spec/spam_corpus/150.txt.gz +0 -0
- data/spec/spam_corpus/152.txt.gz +0 -0
- data/spec/spam_corpus/154.txt.gz +0 -0
- data/spec/spam_corpus/156.txt.gz +0 -0
- data/spec/spam_corpus/158.txt.gz +0 -0
- data/spec/spam_corpus/16.txt.gz +0 -0
- data/spec/spam_corpus/160.txt.gz +0 -0
- data/spec/spam_corpus/162.txt.gz +0 -0
- data/spec/spam_corpus/164.txt.gz +0 -0
- data/spec/spam_corpus/166.txt.gz +0 -0
- data/spec/spam_corpus/168.txt.gz +0 -0
- data/spec/spam_corpus/170.txt.gz +0 -0
- data/spec/spam_corpus/172.txt.gz +0 -0
- data/spec/spam_corpus/174.txt.gz +0 -0
- data/spec/spam_corpus/176.txt.gz +0 -0
- data/spec/spam_corpus/178.txt.gz +0 -0
- data/spec/spam_corpus/180.txt.gz +0 -0
- data/spec/spam_corpus/182.txt.gz +0 -0
- data/spec/spam_corpus/184.txt.gz +0 -0
- data/spec/spam_corpus/186.txt.gz +0 -0
- data/spec/spam_corpus/188.txt.gz +0 -0
- data/spec/spam_corpus/190.txt.gz +0 -0
- data/spec/spam_corpus/192.txt.gz +0 -0
- data/spec/spam_corpus/194.txt.gz +0 -0
- data/spec/spam_corpus/196.txt.gz +0 -0
- data/spec/spam_corpus/198.txt.gz +0 -0
- data/spec/spam_corpus/2.txt.gz +0 -0
- data/spec/spam_corpus/200.txt.gz +0 -0
- data/spec/spam_corpus/202.txt.gz +0 -0
- data/spec/spam_corpus/204.txt.gz +0 -0
- data/spec/spam_corpus/206.txt.gz +0 -0
- data/spec/spam_corpus/208.txt.gz +0 -0
- data/spec/spam_corpus/210.txt.gz +0 -0
- data/spec/spam_corpus/212.txt.gz +0 -0
- data/spec/spam_corpus/214.txt.gz +0 -0
- data/spec/spam_corpus/216.txt.gz +0 -0
- data/spec/spam_corpus/218.txt.gz +0 -0
- data/spec/spam_corpus/220.txt.gz +0 -0
- data/spec/spam_corpus/222.txt.gz +0 -0
- data/spec/spam_corpus/224.txt.gz +0 -0
- data/spec/spam_corpus/226.txt.gz +0 -0
- data/spec/spam_corpus/228.txt.gz +0 -0
- data/spec/spam_corpus/230.txt.gz +0 -0
- data/spec/spam_corpus/232.txt.gz +0 -0
- data/spec/spam_corpus/234.txt.gz +0 -0
- data/spec/spam_corpus/236.txt.gz +0 -0
- data/spec/spam_corpus/238.txt.gz +0 -0
- data/spec/spam_corpus/240.txt.gz +0 -0
- data/spec/spam_corpus/242.txt.gz +0 -0
- data/spec/spam_corpus/244.txt.gz +0 -0
- data/spec/spam_corpus/246.txt.gz +0 -0
- data/spec/spam_corpus/248.txt.gz +0 -0
- data/spec/spam_corpus/250.txt.gz +0 -0
- data/spec/spam_corpus/252.txt.gz +0 -0
- data/spec/spam_corpus/254.txt.gz +0 -0
- data/spec/spam_corpus/256.txt.gz +0 -0
- data/spec/spam_corpus/258.txt.gz +0 -0
- data/spec/spam_corpus/260.txt.gz +0 -0
- data/spec/spam_corpus/262.txt.gz +0 -0
- data/spec/spam_corpus/264.txt.gz +0 -0
- data/spec/spam_corpus/266.txt.gz +0 -0
- data/spec/spam_corpus/268.txt.gz +0 -0
- data/spec/spam_corpus/270.txt.gz +0 -0
- data/spec/spam_corpus/272.txt.gz +0 -0
- data/spec/spam_corpus/274.txt.gz +0 -0
- data/spec/spam_corpus/276.txt.gz +0 -0
- data/spec/spam_corpus/278.txt.gz +0 -0
- data/spec/spam_corpus/28.txt.gz +0 -0
- data/spec/spam_corpus/280.txt.gz +0 -0
- data/spec/spam_corpus/282.txt.gz +0 -0
- data/spec/spam_corpus/284.txt.gz +0 -0
- data/spec/spam_corpus/286.txt.gz +0 -0
- data/spec/spam_corpus/288.txt.gz +0 -0
- data/spec/spam_corpus/290.txt.gz +0 -0
- data/spec/spam_corpus/292.txt.gz +0 -0
- data/spec/spam_corpus/294.txt.gz +0 -0
- data/spec/spam_corpus/296.txt.gz +0 -0
- data/spec/spam_corpus/298.txt.gz +0 -0
- data/spec/spam_corpus/3.txt.gz +0 -0
- data/spec/spam_corpus/30.txt.gz +0 -0
- data/spec/spam_corpus/300.txt.gz +0 -0
- data/spec/spam_corpus/302.txt.gz +0 -0
- data/spec/spam_corpus/304.txt.gz +0 -0
- data/spec/spam_corpus/306.txt.gz +0 -0
- data/spec/spam_corpus/308.txt.gz +0 -0
- data/spec/spam_corpus/310.txt.gz +0 -0
- data/spec/spam_corpus/312.txt.gz +0 -0
- data/spec/spam_corpus/314.txt.gz +0 -0
- data/spec/spam_corpus/316.txt.gz +0 -0
- data/spec/spam_corpus/318.txt.gz +0 -0
- data/spec/spam_corpus/32.txt.gz +0 -0
- data/spec/spam_corpus/320.txt.gz +0 -0
- data/spec/spam_corpus/322.txt.gz +0 -0
- data/spec/spam_corpus/324.txt.gz +0 -0
- data/spec/spam_corpus/326.txt.gz +0 -0
- data/spec/spam_corpus/328.txt.gz +0 -0
- data/spec/spam_corpus/330.txt.gz +0 -0
- data/spec/spam_corpus/332.txt.gz +0 -0
- data/spec/spam_corpus/334.txt.gz +0 -0
- data/spec/spam_corpus/336.txt.gz +0 -0
- data/spec/spam_corpus/338.txt.gz +0 -0
- data/spec/spam_corpus/34.txt.gz +0 -0
- data/spec/spam_corpus/340.txt.gz +0 -0
- data/spec/spam_corpus/342.txt.gz +0 -0
- data/spec/spam_corpus/344.txt.gz +0 -0
- data/spec/spam_corpus/346.txt.gz +0 -0
- data/spec/spam_corpus/348.txt.gz +0 -0
- data/spec/spam_corpus/350.txt.gz +0 -0
- data/spec/spam_corpus/352.txt.gz +0 -0
- data/spec/spam_corpus/354.txt.gz +0 -0
- data/spec/spam_corpus/356.txt.gz +0 -0
- data/spec/spam_corpus/358.txt.gz +0 -0
- data/spec/spam_corpus/36.txt.gz +0 -0
- data/spec/spam_corpus/360.txt.gz +0 -0
- data/spec/spam_corpus/362.txt.gz +0 -0
- data/spec/spam_corpus/364.txt.gz +0 -0
- data/spec/spam_corpus/366.txt.gz +0 -0
- data/spec/spam_corpus/368.txt.gz +0 -0
- data/spec/spam_corpus/370.txt.gz +0 -0
- data/spec/spam_corpus/372.txt.gz +0 -0
- data/spec/spam_corpus/374.txt.gz +0 -0
- data/spec/spam_corpus/376.txt.gz +0 -0
- data/spec/spam_corpus/378.txt.gz +0 -0
- data/spec/spam_corpus/38.txt.gz +0 -0
- data/spec/spam_corpus/380.txt.gz +0 -0
- data/spec/spam_corpus/382.txt.gz +0 -0
- data/spec/spam_corpus/384.txt.gz +0 -0
- data/spec/spam_corpus/386.txt.gz +0 -0
- data/spec/spam_corpus/388.txt.gz +0 -0
- data/spec/spam_corpus/390.txt.gz +0 -0
- data/spec/spam_corpus/392.txt.gz +0 -0
- data/spec/spam_corpus/394.txt.gz +0 -0
- data/spec/spam_corpus/396.txt.gz +0 -0
- data/spec/spam_corpus/398.txt.gz +0 -0
- data/spec/spam_corpus/4.txt.gz +0 -0
- data/spec/spam_corpus/40.txt.gz +0 -0
- data/spec/spam_corpus/400.txt.gz +0 -0
- data/spec/spam_corpus/402.txt.gz +0 -0
- data/spec/spam_corpus/404.txt.gz +0 -0
- data/spec/spam_corpus/406.txt.gz +0 -0
- data/spec/spam_corpus/408.txt.gz +0 -0
- data/spec/spam_corpus/410.txt.gz +0 -0
- data/spec/spam_corpus/412.txt.gz +0 -0
- data/spec/spam_corpus/414.txt.gz +0 -0
- data/spec/spam_corpus/416.txt.gz +0 -0
- data/spec/spam_corpus/418.txt.gz +0 -0
- data/spec/spam_corpus/42.txt.gz +0 -0
- data/spec/spam_corpus/420.txt.gz +0 -0
- data/spec/spam_corpus/422.txt.gz +0 -0
- data/spec/spam_corpus/424.txt.gz +0 -0
- data/spec/spam_corpus/426.txt.gz +0 -0
- data/spec/spam_corpus/428.txt.gz +0 -0
- data/spec/spam_corpus/430.txt.gz +0 -0
- data/spec/spam_corpus/432.txt.gz +0 -0
- data/spec/spam_corpus/434.txt.gz +0 -0
- data/spec/spam_corpus/436.txt.gz +0 -0
- data/spec/spam_corpus/438.txt.gz +0 -0
- data/spec/spam_corpus/44.txt.gz +0 -0
- data/spec/spam_corpus/440.txt.gz +0 -0
- data/spec/spam_corpus/442.txt.gz +0 -0
- data/spec/spam_corpus/444.txt.gz +0 -0
- data/spec/spam_corpus/446.txt.gz +0 -0
- data/spec/spam_corpus/448.txt.gz +0 -0
- data/spec/spam_corpus/450.txt.gz +0 -0
- data/spec/spam_corpus/452.txt.gz +0 -0
- data/spec/spam_corpus/454.txt.gz +0 -0
- data/spec/spam_corpus/456.txt.gz +0 -0
- data/spec/spam_corpus/458.txt.gz +0 -0
- data/spec/spam_corpus/46.txt.gz +0 -0
- data/spec/spam_corpus/460.txt.gz +0 -0
- data/spec/spam_corpus/462.txt.gz +0 -0
- data/spec/spam_corpus/464.txt.gz +0 -0
- data/spec/spam_corpus/466.txt.gz +0 -0
- data/spec/spam_corpus/468.txt.gz +0 -0
- data/spec/spam_corpus/470.txt.gz +0 -0
- data/spec/spam_corpus/472.txt.gz +0 -0
- data/spec/spam_corpus/474.txt.gz +0 -0
- data/spec/spam_corpus/476.txt.gz +0 -0
- data/spec/spam_corpus/478.txt.gz +0 -0
- data/spec/spam_corpus/48.txt.gz +0 -0
- data/spec/spam_corpus/480.txt.gz +0 -0
- data/spec/spam_corpus/482.txt.gz +0 -0
- data/spec/spam_corpus/484.txt.gz +0 -0
- data/spec/spam_corpus/486.txt.gz +0 -0
- data/spec/spam_corpus/488.txt.gz +0 -0
- data/spec/spam_corpus/490.txt.gz +0 -0
- data/spec/spam_corpus/492.txt.gz +0 -0
- data/spec/spam_corpus/494.txt.gz +0 -0
- data/spec/spam_corpus/496.txt.gz +0 -0
- data/spec/spam_corpus/498.txt.gz +0 -0
- data/spec/spam_corpus/5.txt.gz +0 -0
- data/spec/spam_corpus/50.txt.gz +0 -0
- data/spec/spam_corpus/500.txt.gz +0 -0
- data/spec/spam_corpus/502.txt.gz +0 -0
- data/spec/spam_corpus/504.txt.gz +0 -0
- data/spec/spam_corpus/506.txt.gz +0 -0
- data/spec/spam_corpus/508.txt.gz +0 -0
- data/spec/spam_corpus/510.txt.gz +0 -0
- data/spec/spam_corpus/512.txt.gz +0 -0
- data/spec/spam_corpus/514.txt.gz +0 -0
- data/spec/spam_corpus/516.txt.gz +0 -0
- data/spec/spam_corpus/518.txt.gz +0 -0
- data/spec/spam_corpus/52.txt.gz +0 -0
- data/spec/spam_corpus/520.txt.gz +0 -0
- data/spec/spam_corpus/522.txt.gz +0 -0
- data/spec/spam_corpus/524.txt.gz +0 -0
- data/spec/spam_corpus/526.txt.gz +0 -0
- data/spec/spam_corpus/528.txt.gz +0 -0
- data/spec/spam_corpus/530.txt.gz +0 -0
- data/spec/spam_corpus/532.txt.gz +0 -0
- data/spec/spam_corpus/534.txt.gz +0 -0
- data/spec/spam_corpus/536.txt.gz +0 -0
- data/spec/spam_corpus/538.txt.gz +0 -0
- data/spec/spam_corpus/54.txt.gz +0 -0
- data/spec/spam_corpus/540.txt.gz +0 -0
- data/spec/spam_corpus/542.txt.gz +0 -0
- data/spec/spam_corpus/544.txt.gz +0 -0
- data/spec/spam_corpus/546.txt.gz +0 -0
- data/spec/spam_corpus/548.txt.gz +0 -0
- data/spec/spam_corpus/550.txt.gz +0 -0
- data/spec/spam_corpus/552.txt.gz +0 -0
- data/spec/spam_corpus/554.txt.gz +0 -0
- data/spec/spam_corpus/556.txt.gz +0 -0
- data/spec/spam_corpus/558.txt.gz +0 -0
- data/spec/spam_corpus/56.txt.gz +0 -0
- data/spec/spam_corpus/560.txt.gz +0 -0
- data/spec/spam_corpus/562.txt.gz +0 -0
- data/spec/spam_corpus/564.txt.gz +0 -0
- data/spec/spam_corpus/566.txt.gz +0 -0
- data/spec/spam_corpus/568.txt.gz +0 -0
- data/spec/spam_corpus/570.txt.gz +0 -0
- data/spec/spam_corpus/572.txt.gz +0 -0
- data/spec/spam_corpus/574.txt.gz +0 -0
- data/spec/spam_corpus/576.txt.gz +0 -0
- data/spec/spam_corpus/578.txt.gz +0 -0
- data/spec/spam_corpus/58.txt.gz +0 -0
- data/spec/spam_corpus/580.txt.gz +0 -0
- data/spec/spam_corpus/582.txt.gz +0 -0
- data/spec/spam_corpus/584.txt.gz +0 -0
- data/spec/spam_corpus/586.txt.gz +0 -0
- data/spec/spam_corpus/588.txt.gz +0 -0
- data/spec/spam_corpus/590.txt.gz +0 -0
- data/spec/spam_corpus/592.txt.gz +0 -0
- data/spec/spam_corpus/594.txt.gz +0 -0
- data/spec/spam_corpus/596.txt.gz +0 -0
- data/spec/spam_corpus/598.txt.gz +0 -0
- data/spec/spam_corpus/6.txt.gz +0 -0
- data/spec/spam_corpus/60.txt.gz +0 -0
- data/spec/spam_corpus/600.txt.gz +0 -0
- data/spec/spam_corpus/602.txt.gz +0 -0
- data/spec/spam_corpus/604.txt.gz +0 -0
- data/spec/spam_corpus/606.txt.gz +0 -0
- data/spec/spam_corpus/608.txt.gz +0 -0
- data/spec/spam_corpus/610.txt.gz +0 -0
- data/spec/spam_corpus/612.txt.gz +0 -0
- data/spec/spam_corpus/614.txt.gz +0 -0
- data/spec/spam_corpus/616.txt.gz +0 -0
- data/spec/spam_corpus/618.txt.gz +0 -0
- data/spec/spam_corpus/62.txt.gz +0 -0
- data/spec/spam_corpus/620.txt.gz +0 -0
- data/spec/spam_corpus/622.txt.gz +0 -0
- data/spec/spam_corpus/624.txt.gz +0 -0
- data/spec/spam_corpus/626.txt.gz +0 -0
- data/spec/spam_corpus/628.txt.gz +0 -0
- data/spec/spam_corpus/630.txt.gz +0 -0
- data/spec/spam_corpus/632.txt.gz +0 -0
- data/spec/spam_corpus/634.txt.gz +0 -0
- data/spec/spam_corpus/636.txt.gz +0 -0
- data/spec/spam_corpus/638.txt.gz +0 -0
- data/spec/spam_corpus/64.txt.gz +0 -0
- data/spec/spam_corpus/640.txt.gz +0 -0
- data/spec/spam_corpus/642.txt.gz +0 -0
- data/spec/spam_corpus/644.txt.gz +0 -0
- data/spec/spam_corpus/646.txt.gz +0 -0
- data/spec/spam_corpus/648.txt.gz +0 -0
- data/spec/spam_corpus/650.txt.gz +0 -0
- data/spec/spam_corpus/652.txt.gz +0 -0
- data/spec/spam_corpus/654.txt.gz +0 -0
- data/spec/spam_corpus/656.txt.gz +0 -0
- data/spec/spam_corpus/658.txt.gz +0 -0
- data/spec/spam_corpus/66.txt.gz +0 -0
- data/spec/spam_corpus/660.txt.gz +0 -0
- data/spec/spam_corpus/662.txt.gz +0 -0
- data/spec/spam_corpus/664.txt.gz +0 -0
- data/spec/spam_corpus/666.txt.gz +0 -0
- data/spec/spam_corpus/668.txt.gz +0 -0
- data/spec/spam_corpus/670.txt.gz +0 -0
- data/spec/spam_corpus/672.txt.gz +0 -0
- data/spec/spam_corpus/674.txt.gz +0 -0
- data/spec/spam_corpus/676.txt.gz +0 -0
- data/spec/spam_corpus/678.txt.gz +0 -0
- data/spec/spam_corpus/68.txt.gz +0 -0
- data/spec/spam_corpus/680.txt.gz +0 -0
- data/spec/spam_corpus/682.txt.gz +0 -0
- data/spec/spam_corpus/684.txt.gz +0 -0
- data/spec/spam_corpus/686.txt.gz +0 -0
- data/spec/spam_corpus/688.txt.gz +0 -0
- data/spec/spam_corpus/690.txt.gz +0 -0
- data/spec/spam_corpus/692.txt.gz +0 -0
- data/spec/spam_corpus/694.txt.gz +0 -0
- data/spec/spam_corpus/696.txt.gz +0 -0
- data/spec/spam_corpus/698.txt.gz +0 -0
- data/spec/spam_corpus/7.txt.gz +0 -0
- data/spec/spam_corpus/70.txt.gz +0 -0
- data/spec/spam_corpus/700.txt.gz +0 -0
- data/spec/spam_corpus/702.txt.gz +0 -0
- data/spec/spam_corpus/704.txt.gz +0 -0
- data/spec/spam_corpus/706.txt.gz +0 -0
- data/spec/spam_corpus/708.txt.gz +0 -0
- data/spec/spam_corpus/710.txt.gz +0 -0
- data/spec/spam_corpus/712.txt.gz +0 -0
- data/spec/spam_corpus/714.txt.gz +0 -0
- data/spec/spam_corpus/716.txt.gz +0 -0
- data/spec/spam_corpus/718.txt.gz +0 -0
- data/spec/spam_corpus/72.txt.gz +0 -0
- data/spec/spam_corpus/720.txt.gz +0 -0
- data/spec/spam_corpus/722.txt.gz +0 -0
- data/spec/spam_corpus/724.txt.gz +0 -0
- data/spec/spam_corpus/726.txt.gz +0 -0
- data/spec/spam_corpus/728.txt.gz +0 -0
- data/spec/spam_corpus/730.txt.gz +0 -0
- data/spec/spam_corpus/732.txt.gz +0 -0
- data/spec/spam_corpus/734.txt.gz +0 -0
- data/spec/spam_corpus/736.txt.gz +0 -0
- data/spec/spam_corpus/738.txt.gz +0 -0
- data/spec/spam_corpus/74.txt.gz +0 -0
- data/spec/spam_corpus/740.txt.gz +0 -0
- data/spec/spam_corpus/742.txt.gz +0 -0
- data/spec/spam_corpus/744.txt.gz +0 -0
- data/spec/spam_corpus/746.txt.gz +0 -0
- data/spec/spam_corpus/748.txt.gz +0 -0
- data/spec/spam_corpus/750.txt.gz +0 -0
- data/spec/spam_corpus/752.txt.gz +0 -0
- data/spec/spam_corpus/754.txt.gz +0 -0
- data/spec/spam_corpus/756.txt.gz +0 -0
- data/spec/spam_corpus/758.txt.gz +0 -0
- data/spec/spam_corpus/76.txt.gz +0 -0
- data/spec/spam_corpus/760.txt.gz +0 -0
- data/spec/spam_corpus/762.txt.gz +0 -0
- data/spec/spam_corpus/764.txt.gz +0 -0
- data/spec/spam_corpus/766.txt.gz +0 -0
- data/spec/spam_corpus/768.txt.gz +0 -0
- data/spec/spam_corpus/770.txt.gz +0 -0
- data/spec/spam_corpus/772.txt.gz +0 -0
- data/spec/spam_corpus/774.txt.gz +0 -0
- data/spec/spam_corpus/776.txt.gz +0 -0
- data/spec/spam_corpus/778.txt.gz +0 -0
- data/spec/spam_corpus/78.txt.gz +0 -0
- data/spec/spam_corpus/780.txt.gz +0 -0
- data/spec/spam_corpus/782.txt.gz +0 -0
- data/spec/spam_corpus/784.txt.gz +0 -0
- data/spec/spam_corpus/786.txt.gz +0 -0
- data/spec/spam_corpus/788.txt.gz +0 -0
- data/spec/spam_corpus/790.txt.gz +0 -0
- data/spec/spam_corpus/792.txt.gz +0 -0
- data/spec/spam_corpus/794.txt.gz +0 -0
- data/spec/spam_corpus/796.txt.gz +0 -0
- data/spec/spam_corpus/798.txt.gz +0 -0
- data/spec/spam_corpus/8.txt.gz +0 -0
- data/spec/spam_corpus/80.txt.gz +0 -0
- data/spec/spam_corpus/800.txt.gz +0 -0
- data/spec/spam_corpus/802.txt.gz +0 -0
- data/spec/spam_corpus/804.txt.gz +0 -0
- data/spec/spam_corpus/806.txt.gz +0 -0
- data/spec/spam_corpus/808.txt.gz +0 -0
- data/spec/spam_corpus/810.txt.gz +0 -0
- data/spec/spam_corpus/812.txt.gz +0 -0
- data/spec/spam_corpus/814.txt.gz +0 -0
- data/spec/spam_corpus/816.txt.gz +0 -0
- data/spec/spam_corpus/818.txt.gz +0 -0
- data/spec/spam_corpus/82.txt.gz +0 -0
- data/spec/spam_corpus/820.txt.gz +0 -0
- data/spec/spam_corpus/822.txt.gz +0 -0
- data/spec/spam_corpus/824.txt.gz +0 -0
- data/spec/spam_corpus/826.txt.gz +0 -0
- data/spec/spam_corpus/828.txt.gz +0 -0
- data/spec/spam_corpus/830.txt.gz +0 -0
- data/spec/spam_corpus/832.txt.gz +0 -0
- data/spec/spam_corpus/834.txt.gz +0 -0
- data/spec/spam_corpus/836.txt.gz +0 -0
- data/spec/spam_corpus/838.txt.gz +0 -0
- data/spec/spam_corpus/84.txt.gz +0 -0
- data/spec/spam_corpus/840.txt.gz +0 -0
- data/spec/spam_corpus/842.txt.gz +0 -0
- data/spec/spam_corpus/844.txt.gz +0 -0
- data/spec/spam_corpus/846.txt.gz +0 -0
- data/spec/spam_corpus/848.txt.gz +0 -0
- data/spec/spam_corpus/850.txt.gz +0 -0
- data/spec/spam_corpus/852.txt.gz +0 -0
- data/spec/spam_corpus/854.txt.gz +0 -0
- data/spec/spam_corpus/856.txt.gz +0 -0
- data/spec/spam_corpus/858.txt.gz +0 -0
- data/spec/spam_corpus/86.txt.gz +0 -0
- data/spec/spam_corpus/860.txt.gz +0 -0
- data/spec/spam_corpus/862.txt.gz +0 -0
- data/spec/spam_corpus/864.txt.gz +0 -0
- data/spec/spam_corpus/866.txt.gz +0 -0
- data/spec/spam_corpus/868.txt.gz +0 -0
- data/spec/spam_corpus/870.txt.gz +0 -0
- data/spec/spam_corpus/872.txt.gz +0 -0
- data/spec/spam_corpus/874.txt.gz +0 -0
- data/spec/spam_corpus/876.txt.gz +0 -0
- data/spec/spam_corpus/878.txt.gz +0 -0
- data/spec/spam_corpus/88.txt.gz +0 -0
- data/spec/spam_corpus/880.txt.gz +0 -0
- data/spec/spam_corpus/882.txt.gz +0 -0
- data/spec/spam_corpus/884.txt.gz +0 -0
- data/spec/spam_corpus/886.txt.gz +0 -0
- data/spec/spam_corpus/888.txt.gz +0 -0
- data/spec/spam_corpus/890.txt.gz +0 -0
- data/spec/spam_corpus/892.txt.gz +0 -0
- data/spec/spam_corpus/894.txt.gz +0 -0
- data/spec/spam_corpus/896.txt.gz +0 -0
- data/spec/spam_corpus/898.txt.gz +0 -0
- data/spec/spam_corpus/9.txt.gz +0 -0
- data/spec/spam_corpus/90.txt.gz +0 -0
- data/spec/spam_corpus/900.txt.gz +0 -0
- data/spec/spam_corpus/902.txt.gz +0 -0
- data/spec/spam_corpus/904.txt.gz +0 -0
- data/spec/spam_corpus/906.txt.gz +0 -0
- data/spec/spam_corpus/908.txt.gz +0 -0
- data/spec/spam_corpus/910.txt.gz +0 -0
- data/spec/spam_corpus/912.txt.gz +0 -0
- data/spec/spam_corpus/914.txt.gz +0 -0
- data/spec/spam_corpus/916.txt.gz +0 -0
- data/spec/spam_corpus/918.txt.gz +0 -0
- data/spec/spam_corpus/92.txt.gz +0 -0
- data/spec/spam_corpus/920.txt.gz +0 -0
- data/spec/spam_corpus/922.txt.gz +0 -0
- data/spec/spam_corpus/924.txt.gz +0 -0
- data/spec/spam_corpus/926.txt.gz +0 -0
- data/spec/spam_corpus/928.txt.gz +0 -0
- data/spec/spam_corpus/930.txt.gz +0 -0
- data/spec/spam_corpus/932.txt.gz +0 -0
- data/spec/spam_corpus/934.txt.gz +0 -0
- data/spec/spam_corpus/936.txt.gz +0 -0
- data/spec/spam_corpus/938.txt.gz +0 -0
- data/spec/spam_corpus/94.txt.gz +0 -0
- data/spec/spam_corpus/940.txt.gz +0 -0
- data/spec/spam_corpus/942.txt.gz +0 -0
- data/spec/spam_corpus/944.txt.gz +0 -0
- data/spec/spam_corpus/946.txt.gz +0 -0
- data/spec/spam_corpus/948.txt.gz +0 -0
- data/spec/spam_corpus/950.txt.gz +0 -0
- data/spec/spam_corpus/952.txt.gz +0 -0
- data/spec/spam_corpus/954.txt.gz +0 -0
- data/spec/spam_corpus/956.txt.gz +0 -0
- data/spec/spam_corpus/958.txt.gz +0 -0
- data/spec/spam_corpus/96.txt.gz +0 -0
- data/spec/spam_corpus/960.txt.gz +0 -0
- data/spec/spam_corpus/962.txt.gz +0 -0
- data/spec/spam_corpus/964.txt.gz +0 -0
- data/spec/spam_corpus/966.txt.gz +0 -0
- data/spec/spam_corpus/968.txt.gz +0 -0
- data/spec/spam_corpus/970.txt.gz +0 -0
- data/spec/spam_corpus/972.txt.gz +0 -0
- data/spec/spam_corpus/974.txt.gz +0 -0
- data/spec/spam_corpus/98.txt.gz +0 -0
- data/spec/spam_corpus/debugyouradd.com.txt.gz +0 -0
- data/spec/spam_corpus/humandesignconsulting.comm.txt.gz +0 -0
- data/spec/spam_corpus_spec.rb +0 -11
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -16
- data/tasks/rspec.rake +0 -21
@@ -1,11 +1,21 @@
|
|
1
|
-
|
2
|
-
'IP Address URL'
|
3
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module DespamilatorFilter
|
4
|
+
|
5
|
+
class IPAddressURL < Despamilator::FilterBase
|
6
|
+
|
7
|
+
def name
|
8
|
+
'IP Address URL'
|
9
|
+
end
|
10
|
+
|
11
|
+
def description
|
12
|
+
'Detects IP address URLs'
|
13
|
+
end
|
14
|
+
|
15
|
+
def parse text
|
16
|
+
self.append_score = 0.5 if text.downcase.scan(/http:\/\/\d+\.\d+\.\d+\.\d+/).length > 0
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
8
20
|
|
9
|
-
def parse
|
10
|
-
self.append_score = 0.5 if (self.text.downcase.scan(/http:\/\/\d+\.\d+\.\d+\.\d+/).length > 0)
|
11
21
|
end
|
@@ -1,13 +1,23 @@
|
|
1
|
-
|
2
|
-
'Long Words'
|
3
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module DespamilatorFilter
|
4
|
+
|
5
|
+
class LongWords < Despamilator::FilterBase
|
6
|
+
|
7
|
+
def name
|
8
|
+
'Long Words'
|
9
|
+
end
|
10
|
+
|
11
|
+
def description
|
12
|
+
'Detects long and unbroken strings'
|
13
|
+
end
|
14
|
+
|
15
|
+
def parse text
|
16
|
+
text.split(/\W+/).each do |word|
|
17
|
+
self.append_score = 0.1 if word.length > 20
|
18
|
+
end
|
19
|
+
end
|
8
20
|
|
9
|
-
def parse
|
10
|
-
self.text.split(/\W+/).each do |word|
|
11
|
-
self.append_score = 0.1 if word.length > 20
|
12
21
|
end
|
13
|
-
|
22
|
+
|
23
|
+
end
|
@@ -1,21 +1,31 @@
|
|
1
|
-
|
2
|
-
'Naughty Q'
|
3
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
4
2
|
|
5
|
-
|
6
|
-
'Detects possible misuse of the letter Q (English language)'
|
7
|
-
end
|
3
|
+
module DespamilatorFilter
|
8
4
|
|
9
|
-
|
10
|
-
post_matches = self.text.downcase.scan(/q(\w|\d)/)
|
11
|
-
pre_matches = self.text.downcase.scan(/(\w|\d)q/)
|
5
|
+
class NaughtyQ < Despamilator::FilterBase
|
12
6
|
|
13
|
-
|
7
|
+
def name
|
8
|
+
'Naughty Q'
|
9
|
+
end
|
14
10
|
|
15
|
-
|
11
|
+
def description
|
12
|
+
'Detects possible misuse of the letter Q (English language)'
|
13
|
+
end
|
14
|
+
|
15
|
+
def parse text
|
16
|
+
post_matches = text.downcase.scan(/q(\w|\d)/)
|
17
|
+
pre_matches = text.downcase.scan(/(\w|\d)q/)
|
18
|
+
|
19
|
+
matches = post_matches + pre_matches
|
20
|
+
|
21
|
+
return unless matches
|
22
|
+
|
23
|
+
matches.each do |match|
|
24
|
+
match = match.first
|
25
|
+
self.append_score = 0.2 unless match == 'u' or match == 'a' or match == 'k'
|
26
|
+
end
|
27
|
+
end
|
16
28
|
|
17
|
-
matches.each do |match|
|
18
|
-
match = match.first
|
19
|
-
self.append_score = 0.2 unless match == 'u' or match == 'a' or match == 'k'
|
20
29
|
end
|
30
|
+
|
21
31
|
end
|
@@ -1,21 +1,27 @@
|
|
1
|
-
|
2
|
-
'Naughty Words'
|
3
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
4
2
|
|
5
|
-
|
6
|
-
'Detects cheeky words'
|
7
|
-
end
|
3
|
+
module DespamilatorFilter
|
8
4
|
|
9
|
-
|
10
|
-
text = self.text.downcase
|
5
|
+
class NaughtyWords < Despamilator::FilterBase
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
def name
|
8
|
+
'Naughty Words'
|
9
|
+
end
|
10
|
+
|
11
|
+
def description
|
12
|
+
'Detects cheeky words'
|
13
|
+
end
|
16
14
|
|
17
|
-
def
|
18
|
-
|
15
|
+
def parse text
|
16
|
+
text.downcase!
|
17
|
+
|
18
|
+
naughty_words.each do |word|
|
19
|
+
self.append_score = 0.1 if text =~ /\b#{word}\b/
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def naughty_words
|
24
|
+
%w{
|
19
25
|
penis
|
20
26
|
viagra
|
21
27
|
bondage
|
@@ -33,5 +39,8 @@ def naughty_words
|
|
33
39
|
cock
|
34
40
|
pussy
|
35
41
|
clit
|
36
|
-
|
37
|
-
end
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -1,33 +1,43 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
1
|
+
require 'despamilator/filter_base'
|
2
|
+
|
3
|
+
module DespamilatorFilter
|
4
|
+
|
5
|
+
class NumbersAndWords < Despamilator::FilterBase
|
6
|
+
|
7
|
+
def parse text
|
8
|
+
text.downcase!
|
9
|
+
|
10
|
+
# strip out "good numbers"
|
11
|
+
text.gsub!(/h[1-6]/, '')
|
12
|
+
text.gsub!(/(^|\b)\d+($|\b)/, '')
|
13
|
+
text.gsub!(/(^|\b)\d+(,|\.)\d+($|\b)/, '')
|
14
|
+
text.gsub!(/(^|\b)\d+(st|nd|rd|th)($|\b)/, '')
|
15
|
+
|
16
|
+
[
|
17
|
+
/\w\d+/,
|
18
|
+
/\d+\w/,
|
19
|
+
/\d+($|\b)/
|
20
|
+
].each do |regexp|
|
21
|
+
matches = text.scan(regexp)
|
22
|
+
|
23
|
+
next if matches.empty?
|
24
|
+
|
25
|
+
matches.each do |to_remove|
|
26
|
+
to_remove = to_remove.to_s
|
27
|
+
text.sub!(to_remove, '') unless to_remove.empty?
|
28
|
+
self.append_score = 0.1
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def name
|
34
|
+
'Numbers next to words'
|
23
35
|
end
|
24
|
-
end
|
25
|
-
end
|
26
36
|
|
27
|
-
def
|
28
|
-
|
29
|
-
end
|
37
|
+
def description
|
38
|
+
'Detects unusual number/word combinations'
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
30
42
|
|
31
|
-
def description
|
32
|
-
'Detects unusual number/word combinations'
|
33
43
|
end
|
@@ -1,13 +1,21 @@
|
|
1
|
-
|
2
|
-
if self.text.downcase.match(/<\/?script(>|\s+|\n|\r)/)
|
3
|
-
self.append_score = 1
|
4
|
-
end
|
5
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module DespamilatorFilter
|
4
|
+
|
5
|
+
class ScriptTag < Despamilator::FilterBase
|
6
|
+
|
7
|
+
def parse text
|
8
|
+
self.append_score = 1 if text.downcase.match(/<\/?script(>|\s+|\n|\r)/)
|
9
|
+
end
|
10
|
+
|
11
|
+
def name
|
12
|
+
'Script tag'
|
13
|
+
end
|
14
|
+
|
15
|
+
def description
|
16
|
+
'Searches for variations for the HTML script tag'
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
10
20
|
|
11
|
-
def description
|
12
|
-
'Searches for variations for the HTML script tag'
|
13
21
|
end
|
@@ -1,21 +1,31 @@
|
|
1
|
-
|
2
|
-
'Shouting'
|
3
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module DespamilatorFilter
|
4
|
+
|
5
|
+
class Shouting < Despamilator::FilterBase
|
6
|
+
|
7
|
+
def name
|
8
|
+
'Shouting'
|
9
|
+
end
|
8
10
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
11
|
+
def description
|
12
|
+
'Detects and scores shouting (all caps)'
|
13
|
+
end
|
12
14
|
|
13
|
-
|
15
|
+
def parse text
|
16
|
+
# strip HTML
|
17
|
+
text.gsub!(/<\/?[^>]*>/, "")
|
14
18
|
|
15
|
-
|
16
|
-
|
19
|
+
return if text.length < 20
|
20
|
+
|
21
|
+
uppercased = text.scan(/[A-Z]/).length
|
22
|
+
lowercased = text.scan(/[a-z]/).length
|
23
|
+
|
24
|
+
if uppercased > 0
|
25
|
+
self.append_score = (uppercased.to_f / (uppercased + lowercased)) * 0.5
|
26
|
+
end
|
27
|
+
end
|
17
28
|
|
18
|
-
if uppercased > 0
|
19
|
-
self.append_score = (uppercased.to_f / (uppercased + lowercased)) * 0.5
|
20
29
|
end
|
21
|
-
|
30
|
+
|
31
|
+
end
|
@@ -1,13 +1,23 @@
|
|
1
|
-
|
2
|
-
'Square Brackets'
|
3
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module DespamilatorFilter
|
4
|
+
|
5
|
+
class SquareBrackets < Despamilator::FilterBase
|
6
|
+
|
7
|
+
def name
|
8
|
+
'Square Brackets'
|
9
|
+
end
|
10
|
+
|
11
|
+
def description
|
12
|
+
'Detects each square bracket in a string'
|
13
|
+
end
|
14
|
+
|
15
|
+
def parse text
|
16
|
+
text.downcase.scan(/(\[|\])/).each do |match|
|
17
|
+
self.append_score = 0.05
|
18
|
+
end
|
19
|
+
end
|
8
20
|
|
9
|
-
def parse
|
10
|
-
self.text.downcase.scan(/(\[|\])/).each do |match|
|
11
|
-
self.append_score = 0.05
|
12
21
|
end
|
22
|
+
|
13
23
|
end
|
@@ -1,11 +1,27 @@
|
|
1
|
-
|
2
|
-
'URLs'
|
3
|
-
end
|
1
|
+
require 'despamilator/filter_base'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module DespamilatorFilter
|
4
|
+
|
5
|
+
class URLs < Despamilator::FilterBase
|
6
|
+
|
7
|
+
def name
|
8
|
+
'URLs'
|
9
|
+
end
|
10
|
+
|
11
|
+
def description
|
12
|
+
'Detects each url in a string'
|
13
|
+
end
|
14
|
+
|
15
|
+
def parse text
|
16
|
+
text.downcase!
|
17
|
+
|
18
|
+
text.gsub!(/http:\/\/\d+\.\d+\.\d+\.\d+/, '')
|
19
|
+
|
20
|
+
1.upto(text.scan(/http:\/\//).length) do
|
21
|
+
self.append_score = 0.20
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
8
26
|
|
9
|
-
def parse
|
10
|
-
self.append_score = 0.20 * self.text.downcase.scan(/http:\/\//).length
|
11
27
|
end
|
@@ -1,27 +1,72 @@
|
|
1
1
|
class Despamilator
|
2
|
+
|
3
|
+
#This class is the base class of all the despamilator filters.
|
4
|
+
#
|
5
|
+
#== EXAMPLE:
|
6
|
+
#
|
7
|
+
#This example is to detect the letter "a". Put the code in
|
8
|
+
#lib/despamilator/filter/detect_letter_a.rb:
|
9
|
+
#
|
10
|
+
# require 'despamilator/filter_base'
|
11
|
+
#
|
12
|
+
# module DespamilatorFilter
|
13
|
+
#
|
14
|
+
# class DetectLetterA < Despamilator::FilterBase
|
15
|
+
#
|
16
|
+
# def name
|
17
|
+
# 'Detecting the letter A'
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# def description
|
21
|
+
# 'Detects the letter "a" in a string for no reason other than a demo'
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# def parse text
|
25
|
+
# if text.downcase.scan(/a/)
|
26
|
+
# # add 0.1 to the score of the text
|
27
|
+
# self.append_score = 0.1
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
|
2
32
|
class FilterBase
|
3
|
-
attr_accessor :text, :score, :
|
33
|
+
attr_accessor :text, :score, :matches
|
34
|
+
|
35
|
+
# Constructor for the class.
|
4
36
|
|
5
|
-
def initialize
|
37
|
+
def initialize
|
6
38
|
@matches = 0
|
7
|
-
@filename = filename
|
8
39
|
@score = 0
|
9
|
-
@text = text
|
10
40
|
@matched = false
|
11
41
|
end
|
12
42
|
|
43
|
+
# Returns the score the filter instance has calculated.
|
44
|
+
|
45
|
+
def score
|
46
|
+
# workaround for a bug in ruby 1.9.2's floats
|
47
|
+
sprintf("%.3f", @score).to_f
|
48
|
+
end
|
49
|
+
|
50
|
+
# The nice description of the filter. Usually no more than a sentence.
|
51
|
+
|
13
52
|
def description
|
14
|
-
raise "No description defined
|
53
|
+
raise "No description defined for #{self.class}"
|
15
54
|
end
|
16
55
|
|
17
|
-
|
18
|
-
|
56
|
+
# This method parses some text. The score is assigned to the same instance.
|
57
|
+
|
58
|
+
def parse text
|
59
|
+
raise "No parse defined for #{self.class}"
|
19
60
|
end
|
20
61
|
|
62
|
+
# The one or two word name for the filter.
|
63
|
+
|
21
64
|
def name
|
22
|
-
raise "No name defined
|
65
|
+
raise "No name defined for #{self.class}"
|
23
66
|
end
|
24
|
-
|
67
|
+
|
68
|
+
# Boolean. Whether or not the filter matched anything.
|
69
|
+
|
25
70
|
def matched?
|
26
71
|
@score > 0
|
27
72
|
end
|