mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
spam training script
This commit is contained in:
parent
0c81f212b6
commit
0487e0c95b
1 changed files with 16 additions and 0 deletions
16
Rakefile
16
Rakefile
|
@ -302,3 +302,19 @@ task :train_classifier => [:environment] do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'train_spam'
|
||||||
|
task :train_spam => [:environment] do
|
||||||
|
paths = File.read('./spam.txt')
|
||||||
|
|
||||||
|
paths.split("\n").each do |path|
|
||||||
|
username, site_file_path = path.match(/^([a-zA-Z0-9_\-]+)\/(.+)$/i).captures
|
||||||
|
site = Site[username: username]
|
||||||
|
next if site.nil?
|
||||||
|
site_file = site.site_files_dataset.where(path: site_file_path).first
|
||||||
|
next if site_file.nil?
|
||||||
|
site.train site_file_path, :spam
|
||||||
|
site.ban!
|
||||||
|
puts "Deleted #{site_file_path}, banned #{site.username}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue