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
data/spec/despamilator_spec.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'despamilator/filter_base'
|
2
|
+
|
3
|
+
class UnimplementedFilter < Despamilator::FilterBase
|
4
|
+
end
|
5
|
+
|
6
|
+
describe Despamilator::FilterBase do
|
7
|
+
describe "abstract method" do
|
8
|
+
|
9
|
+
before do
|
10
|
+
@filter = UnimplementedFilter.new
|
11
|
+
end
|
12
|
+
|
13
|
+
[
|
14
|
+
['name', 'No name defined for UnimplementedFilter'],
|
15
|
+
['description', 'No description defined for UnimplementedFilter'],
|
16
|
+
|
17
|
+
].each do |method, exception|
|
18
|
+
|
19
|
+
it "should throw an error when the child class has not implemented a '#{method}' method" do
|
20
|
+
-> {@filter.send(method)}.should raise_error(exception)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should throw an error when the child class has not implemented a 'parse' method" do
|
26
|
+
-> {@filter.parse('abc')}.should raise_error('No parse defined for UnimplementedFilter')
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -1,39 +1,9 @@
|
|
1
|
-
|
1
|
+
describe DespamilatorFilter::FunkyConsonant do
|
2
|
+
the_name_should_be 'Funky Consonant'
|
3
|
+
the_description_should_be 'Detects and scores each occurrence of a consonant next to an unlikely character'
|
2
4
|
|
3
|
-
|
4
|
-
it "should return a score for 1 misplaced z" do
|
5
|
-
dspam = Despamilator.new('zt')
|
6
|
-
dspam.score.should == 0.05
|
7
|
-
end
|
5
|
+
despamilator_should_apply_the_filter_for('zt')
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
@filter = Despamilator.new('vtjk').matched_by.first
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should have a filename" do
|
15
|
-
@filter.filename.should == 'funky_consonant.rb'
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should have a name" do
|
19
|
-
@filter.name.should == 'Funky Consonant'
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should have a description" do
|
23
|
-
@filter.description.should == 'Detects and scores each occurrence of a consonant next to an unlikely character'
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should have a number of matches" do
|
27
|
-
@filter.matches.should == 2
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should have a score" do
|
31
|
-
@filter.score.should == 0.1
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should score more for 3 misplaced q's" do
|
36
|
-
dspam = Despamilator.new('ztgb')
|
37
|
-
dspam.score.to_s.should == 0.1.to_s
|
38
|
-
end
|
7
|
+
a_single_match_of('zt', should_score: 0.05)
|
8
|
+
a_multiple_match_of('ztzt', should_score: [0.1, 2.times])
|
39
9
|
end
|
@@ -1,147 +1,129 @@
|
|
1
|
-
|
1
|
+
describe DespamilatorFilter::HtmlTags do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
[
|
6
|
-
'!--',
|
7
|
-
'!DOCTYPE',
|
8
|
-
'a',
|
9
|
-
'abbr',
|
10
|
-
'acronym',
|
11
|
-
'address',
|
12
|
-
'applet',
|
13
|
-
'area',
|
14
|
-
'b',
|
15
|
-
'base',
|
16
|
-
'basefont',
|
17
|
-
'bdo',
|
18
|
-
'big',
|
19
|
-
'blockquote',
|
20
|
-
'body',
|
21
|
-
'br',
|
22
|
-
'button',
|
23
|
-
'caption',
|
24
|
-
'center',
|
25
|
-
'cite',
|
26
|
-
'code',
|
27
|
-
'col',
|
28
|
-
'colgroup',
|
29
|
-
'dd',
|
30
|
-
'del',
|
31
|
-
'dfn',
|
32
|
-
'dir',
|
33
|
-
'div',
|
34
|
-
'dl',
|
35
|
-
'dt',
|
36
|
-
'em',
|
37
|
-
'fieldset',
|
38
|
-
'font',
|
39
|
-
'form',
|
40
|
-
'frame',
|
41
|
-
'frameset',
|
42
|
-
'h1',
|
43
|
-
'h2',
|
44
|
-
'h3',
|
45
|
-
'h4',
|
46
|
-
'h5',
|
47
|
-
'h6',
|
48
|
-
'head',
|
49
|
-
'hr',
|
50
|
-
'html',
|
51
|
-
'i',
|
52
|
-
'iframe',
|
53
|
-
'img',
|
54
|
-
'input',
|
55
|
-
'ins',
|
56
|
-
'isindex',
|
57
|
-
'kbd',
|
58
|
-
'label',
|
59
|
-
'legend',
|
60
|
-
'li',
|
61
|
-
'link',
|
62
|
-
'map',
|
63
|
-
'menu',
|
64
|
-
'meta',
|
65
|
-
'noframes',
|
66
|
-
'noscript',
|
67
|
-
'object',
|
68
|
-
'ol',
|
69
|
-
'optgroup',
|
70
|
-
'option',
|
71
|
-
'p',
|
72
|
-
'param',
|
73
|
-
'pre',
|
74
|
-
'q',
|
75
|
-
's',
|
76
|
-
'samp',
|
77
|
-
'select',
|
78
|
-
'small',
|
79
|
-
'span',
|
80
|
-
'strike',
|
81
|
-
'strong',
|
82
|
-
'style',
|
83
|
-
'sub',
|
84
|
-
'sup',
|
85
|
-
'table',
|
86
|
-
'tbody',
|
87
|
-
'td',
|
88
|
-
'textarea',
|
89
|
-
'tfoot',
|
90
|
-
'th',
|
91
|
-
'thead',
|
92
|
-
'title',
|
93
|
-
'tr',
|
94
|
-
'tt',
|
95
|
-
'u',
|
96
|
-
'ul',
|
97
|
-
'var',
|
98
|
-
'xmp'
|
99
|
-
].each do |script_tag|
|
100
|
-
[script_tag.upcase, script_tag.downcase].each do |script_tag|
|
101
|
-
[
|
102
|
-
"<#{script_tag}>",
|
103
|
-
"<#{script_tag}/>",
|
104
|
-
"< #{script_tag} >",
|
105
|
-
"<#{script_tag} />",
|
106
|
-
"<\n#{script_tag}\n/>",
|
107
|
-
"<\n#{script_tag} >",
|
108
|
-
"<#{script_tag}\n/>",
|
109
|
-
"<\r#{script_tag}\r/>"
|
110
|
-
].each do |tag|
|
111
|
-
it "should detect '#{tag}'" do
|
112
|
-
dspam = Despamilator.new(tag)
|
113
|
-
dspam.score.should == 0.3
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
3
|
+
the_name_should_be 'HTML tags'
|
4
|
+
the_description_should_be 'Detects HTML tags in text'
|
118
5
|
|
119
|
-
|
120
|
-
before :all do
|
121
|
-
@dspam = Despamilator.new('<xmp>').matched_by.first
|
122
|
-
end
|
6
|
+
despamilator_should_apply_the_filter_for('<xmp>')
|
123
7
|
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
it "should have a description" do
|
129
|
-
@dspam.description.should == 'Searches for various HTML tags'
|
130
|
-
end
|
8
|
+
a_single_match_of('<xmp>', should_score: 0.3)
|
9
|
+
a_multiple_match_of('<h1></h1> <h2></h2>', should_score: [0.6, 2.times])
|
131
10
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
11
|
+
[
|
12
|
+
'!--',
|
13
|
+
'!DOCTYPE',
|
14
|
+
'a',
|
15
|
+
'abbr',
|
16
|
+
'acronym',
|
17
|
+
'address',
|
18
|
+
'applet',
|
19
|
+
'area',
|
20
|
+
'b',
|
21
|
+
'base',
|
22
|
+
'basefont',
|
23
|
+
'bdo',
|
24
|
+
'big',
|
25
|
+
'blockquote',
|
26
|
+
'body',
|
27
|
+
'br',
|
28
|
+
'button',
|
29
|
+
'caption',
|
30
|
+
'center',
|
31
|
+
'cite',
|
32
|
+
'code',
|
33
|
+
'col',
|
34
|
+
'colgroup',
|
35
|
+
'dd',
|
36
|
+
'del',
|
37
|
+
'dfn',
|
38
|
+
'dir',
|
39
|
+
'div',
|
40
|
+
'dl',
|
41
|
+
'dt',
|
42
|
+
'em',
|
43
|
+
'fieldset',
|
44
|
+
'font',
|
45
|
+
'form',
|
46
|
+
'frame',
|
47
|
+
'frameset',
|
48
|
+
'h1',
|
49
|
+
'h2',
|
50
|
+
'h3',
|
51
|
+
'h4',
|
52
|
+
'h5',
|
53
|
+
'h6',
|
54
|
+
'head',
|
55
|
+
'hr',
|
56
|
+
'html',
|
57
|
+
'i',
|
58
|
+
'iframe',
|
59
|
+
'img',
|
60
|
+
'input',
|
61
|
+
'ins',
|
62
|
+
'isindex',
|
63
|
+
'kbd',
|
64
|
+
'label',
|
65
|
+
'legend',
|
66
|
+
'li',
|
67
|
+
'link',
|
68
|
+
'map',
|
69
|
+
'menu',
|
70
|
+
'meta',
|
71
|
+
'noframes',
|
72
|
+
'noscript',
|
73
|
+
'object',
|
74
|
+
'ol',
|
75
|
+
'optgroup',
|
76
|
+
'option',
|
77
|
+
'p',
|
78
|
+
'param',
|
79
|
+
'pre',
|
80
|
+
'q',
|
81
|
+
's',
|
82
|
+
'samp',
|
83
|
+
'select',
|
84
|
+
'small',
|
85
|
+
'span',
|
86
|
+
'strike',
|
87
|
+
'strong',
|
88
|
+
'style',
|
89
|
+
'sub',
|
90
|
+
'sup',
|
91
|
+
'table',
|
92
|
+
'tbody',
|
93
|
+
'td',
|
94
|
+
'textarea',
|
95
|
+
'tfoot',
|
96
|
+
'th',
|
97
|
+
'thead',
|
98
|
+
'title',
|
99
|
+
'tr',
|
100
|
+
'tt',
|
101
|
+
'u',
|
102
|
+
'ul',
|
103
|
+
'var',
|
104
|
+
'xmp'
|
105
|
+
].each do |script_tag|
|
106
|
+
[script_tag.upcase, script_tag.downcase].each do |script_tag|
|
107
|
+
[
|
108
|
+
"<#{script_tag}>",
|
109
|
+
"<#{script_tag}/>",
|
110
|
+
"< #{script_tag} >",
|
111
|
+
"<#{script_tag} />",
|
112
|
+
"<\n#{script_tag}\n/>",
|
113
|
+
"<\n#{script_tag} >",
|
114
|
+
"<#{script_tag}\n/>",
|
115
|
+
"<\r#{script_tag}\r/>"
|
116
|
+
].each do |tag|
|
117
|
+
it "should detect '#{tag}'" do
|
118
|
+
dspam = DespamilatorFilter::HtmlTags.new
|
119
|
+
dspam.parse(tag)
|
120
|
+
dspam.score.should == 0.3
|
121
|
+
end
|
136
122
|
|
137
|
-
describe 'bug fixes' do
|
138
|
-
it "should detect an h1" do
|
139
|
-
Despamilator.new('<h1>TITLE!!</h1>').score.should == 0.3
|
140
123
|
end
|
141
124
|
|
142
|
-
it "should not detect tags twice" do
|
143
|
-
Despamilator.new('<i>italic</i>').score.should == 0.3
|
144
|
-
end
|
145
125
|
end
|
126
|
+
|
146
127
|
end
|
147
|
-
|
128
|
+
|
129
|
+
end
|
@@ -1,29 +1,11 @@
|
|
1
|
-
|
1
|
+
describe DespamilatorFilter::IPAddressURL do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
before :each do
|
6
|
-
@filter = Despamilator.new('http://12.34.56.78/').matched_by.first
|
7
|
-
end
|
3
|
+
the_name_should_be 'IP Address URL'
|
4
|
+
the_description_should_be 'Detects IP address URLs'
|
8
5
|
|
9
|
-
|
10
|
-
@filter.filename.should == 'ip_address_url.rb'
|
11
|
-
end
|
6
|
+
despamilator_should_apply_the_filter_for('http://12.34.56.78/')
|
12
7
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
8
|
+
a_single_match_of('http://12.34.56.78/', should_score: 0.5)
|
9
|
+
a_multiple_match_of('http://12.34.56.78/ http://98.76.54.32/', should_score: [0.5, 1.times])
|
16
10
|
|
17
|
-
it "should have a description" do
|
18
|
-
@filter.description.should == 'Detects IP address URLs'
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a number of matches" do
|
22
|
-
@filter.matches.should == 1
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a score" do
|
26
|
-
@filter.score.should == 0.5
|
27
|
-
end
|
28
|
-
end
|
29
11
|
end
|
@@ -1,34 +1,11 @@
|
|
1
|
-
|
1
|
+
describe DespamilatorFilter::LongWords do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
dspam = Despamilator.new('honorificabilitudinitatibus')
|
6
|
-
dspam.score.should == 0.1
|
7
|
-
end
|
3
|
+
the_name_should_be 'Long Words'
|
4
|
+
the_description_should_be 'Detects long and unbroken strings'
|
8
5
|
|
9
|
-
|
10
|
-
before :each do
|
11
|
-
@filter = Despamilator.new('honorificabilitudinitatibus antidisestablishmentarianism').matched_by.first
|
12
|
-
end
|
6
|
+
despamilator_should_apply_the_filter_for('honorificabilitudinitatibus')
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
8
|
+
a_single_match_of('honorificabilitudinitatibus', should_score: 0.1)
|
9
|
+
a_multiple_match_of('honorificabilitudinitatibus antidisestablishmentarianism', should_score: [0.2, 2.times])
|
17
10
|
|
18
|
-
it "should have a name" do
|
19
|
-
@filter.name.should == 'Long Words'
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should have a description" do
|
23
|
-
@filter.description.should == 'Detects long and unbroken strings'
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should have a number of matches" do
|
27
|
-
@filter.matches.should == 2
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should have a score" do
|
31
|
-
@filter.score.to_s.should == 0.2.to_s
|
32
|
-
end
|
33
|
-
end
|
34
11
|
end
|
@@ -1,39 +1,11 @@
|
|
1
|
-
|
1
|
+
describe DespamilatorFilter::NaughtyQ do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
dspam = Despamilator.new('qtu')
|
6
|
-
dspam.score.should == 0.2
|
7
|
-
end
|
3
|
+
the_name_should_be 'Naughty Q'
|
4
|
+
the_description_should_be 'Detects possible misuse of the letter Q (English language)'
|
8
5
|
|
9
|
-
|
10
|
-
before :each do
|
11
|
-
@filter = Despamilator.new('qtqt').matched_by.first
|
12
|
-
end
|
6
|
+
despamilator_should_apply_the_filter_for('qtu')
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
8
|
+
a_single_match_of('qtu', should_score: 0.2)
|
9
|
+
a_multiple_match_of('qtq', should_score: [0.4, 2.times])
|
17
10
|
|
18
|
-
it "should have a name" do
|
19
|
-
@filter.name.should == 'Naughty Q'
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should have a description" do
|
23
|
-
@filter.description.should == 'Detects possible misuse of the letter Q (English language)'
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should have a number of matches" do
|
27
|
-
@filter.matches.should == 3
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should have a score" do
|
31
|
-
@filter.score.to_s.should == 0.6.to_s
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should score more for 3 misplaced q's" do
|
36
|
-
dspam = Despamilator.new('qtuqsq')
|
37
|
-
dspam.score.to_s.should == 0.6.to_s
|
38
|
-
end
|
39
11
|
end
|