<commit_before>require 'sinatra'
require 'obscenity'
require 'json'
require 'yaml'
require 'open-uri'

configure do
	enable :sessions
end

get '/' do
	 '?list'
end

get '/check/:sentence' do
	Obscenity.configure do |config|
		config.blacklist = YAML.load(open(params[:list]))
		config.replacement = :garbled
	end	
	return status, {'Content-Type' => 'application/json'}, {:profane => Obscenity.profane?(params[:sentence]) }.to_json
end

get '/clean/:sentence' do
	Obscenity.configure do |config|
		config.blacklist = YAML.load(open(params[:list]))
		config.replacement = :garbled
	end		
	return status, {'Content-Type' => 'application/json'}, {:cleaned_sentence => Obscenity.sanitize(params[:sentence])}.to_json
end<commit_msg>Dev push<commit_after>require 'sinatra'
require 'obscenity'
require 'json'
require 'yaml'
require 'open-uri'

configure do
	enable :sessions
end

get '/use' do
	Obscenity.configure do |config|
		config.blacklist = YAML.load(open(params[:list]))
		config.replacement = :garbled
	end	
end

get '/check/:sentence' do
	Obscenity.configure do |config|
		config.blacklist = YAML.load(open(params[:list]))
		config.replacement = :garbled
	end	
	return status, {'Content-Type' => 'application/json'}, {:profane => Obscenity.profane?(params[:sentence]) }.to_json
end

get '/clean/:sentence' do	
	return status, {'Content-Type' => 'application/json'}, {:cleaned_sentence => Obscenity.sanitize(params[:sentence])}.to_json
end
{'fraction_non_alphanumeric': 0.15347222222222223, 'fraction_numerical': 0.0, 'mean_word_length': 5.579908675799087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2677735', 'n_tokens_mistral': 523, 'n_tokens_neox': 504, 'n_words': 112}