<commit_before>class TweetVandalism 
  attr_accessor :content, :client, :page_title, :url

  def initialize(content, page_title, url)
    @content = content
    @client = create_client
    @page_title = page_title
    @url = url
  end

  def create_client
    Twitter::REST::Client.new do |config|
      config.consumer_key        = ENV["TWITTER_KEY"]
      config.consumer_secret     = ENV["TWITTER_SECRET"]
      config.access_token        = ENV["TWITTER_ACCESS_TOKEN"]
      config.access_token_secret = ENV["TWITTER_ACCESS_TOKEN_SECRET"]
    end
  end

  def send_tweet
    client.update(format_tweet)
  end

  def tweet_suffix
    " ##{page_title.gsub(" ","")}" + " #wikivice"
  end

  def safe_tweet
    self.tweet_parser
  end

  def format_tweet
    self.safe_tweet.slice(0, 128 - tweet_suffix.size) + "..." + tweet_suffix
  end

  def replace_words
    better_words = {
      /[f][u][c][k][e][d]/i => "f*cked",
      /[f][u][c][k]/i => "f*ck",
      /[r][a][p][e]\w{1}/i => "r****",
      /[r][a][p][e]/i => "r***",
      /[r][a][p][i][s][t]/i => "r*****",
      /[f][a][g][g][o][t][s]/i => "f*****s",
      /[f][a][g][g][o][t]/i => "f****t",
      /[c][u][n][t][s]/i => "c*nts",
      /[c][u][n][t]/i => "c*nt",
      /[n][i][g][g][e][r][s]/i => "n*****s",
      /n[i][g][g][e][r]/i => "n****"
    }
  end

  def tweet_parser
    test = @content.split(" ")
    test.each do |word|
      self.replace_words.collect do |bad_word, better_word|<commit_msg>fully working, has some kinks to work out and probably missing some terms but hey at least we wont be tweeting freely about rape anymore right?<commit_after>class TweetVandalism 
  attr_accessor :content, :client, :page_title, :url

  def initialize(content, page_title, url)
    @content = content
    @client = create_client
    @page_title = page_title
    @url = url
  end

  def create_client
    Twitter::REST::Client.new do |config|
      config.consumer_key        = ENV["TWITTER_KEY"]
      config.consumer_secret     = ENV["TWITTER_SECRET"]
      config.access_token        = ENV["TWITTER_ACCESS_TOKEN"]
      config.access_token_secret = ENV["TWITTER_ACCESS_TOKEN_SECRET"]
    end
  end

  def send_tweet
    client.update(format_tweet)
  end

  def tweet_suffix
    " ##{page_title.gsub(" ","")}" + " #wikivice"
  end

  def safe_tweet
    self.tweet_parser
  end

  def format_tweet
    self.safe_tweet.slice(0, 128 - tweet_suffix.size) + "..." + tweet_suffix
  end

  def replace_words
    better_words = {
      /[f][u][c][k][e][d]/i => "f*cked",
      /[f][u][c][k]/i => "f*ck",
      /[r][a][p][e]\w{1}/i => "r****",
      /[r][a][p][e]/i => "r***",
      /[r][a][p][i][s][t]/i => "r*****",
      /[f][a][g][g][o][t][s]/i => "f*****s",
      /[f][a][g][g][o][t]/i => "f****t",
      /[c][u][n][t][s]/i => "c*nts",
      /[c][u][n][t]/i => "c*nt",
      /[n][i][g][g][e][r][s]/i => "n*****s",
      /n[i][g][g][e][r]/i => "n****"
    }
  end
 
  def tweet_parser
    test = @content.split(" ")
    test.each do |word|
      self.replace_words.collect do |bad_word, better_word|
{'fraction_non_alphanumeric': 0.22062193126022914, 'fraction_numerical': 0.0032733224222585926, 'mean_word_length': 2.9229781771501924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6692392', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1208, 'n_words': 208}