<commit_before>require_relative 'KarlMarxovChain'

tweet = KarlMarxovChain.new
if ARGV[0] == "random" # Called from the command line to make a random sentence.
  tweet_text = tweet.random_sentence
  # tweet.tweet(tweet_text)
  puts tweet_text
elsif ARGV[0] == "term" # Called from the command line to seed a sentence.
  tweet.triple_array
  tweet.tweet(tweet.build_sentence(ARGV[1]))
else # must a cron job, looking for @s.
  tweet.triple_array
  reply_ids = []
  tweet.replies.each do |reply|
    reply_ids.push(reply.id)
    # puts "reply: #{reply.id} - #{reply.text}"
    match = /^.*@KarlMarxovChain (\w*).*$/i.match(reply.text)
    match.nil? ? term = "No term detected" : term = match[1]
    tweet_text = tweet.build_sentence(term)
    tweet_text = "@" + reply.user.screen_name + " " + tweet_text
    tweet.tweet(tweet_text, reply.id)
  end
  tweet.update_since_id(reply_ids.max) unless reply_ids.max.nil?
end
<commit_msg>Reenable random tweet-maker<commit_after>require_relative 'KarlMarxovChain'

tweet = KarlMarxovChain.new
if ARGV[0] == "random" # Called from the command line to make a random sentence.
  tweet_text = tweet.random_sentence
  tweet.tweet(tweet_text)
elsif ARGV[0] == "term" # Called from the command line to seed a sentence.
  tweet.triple_array
  tweet.tweet(tweet.build_sentence(ARGV[1]))
else # must a cron job, looking for @s.
  tweet.triple_array
  reply_ids = []
  tweet.replies.each do |reply|
    reply_ids.push(reply.id)
    # puts "reply: #{reply.id} - #{reply.text}"
    match = /^.*@KarlMarxovChain (\w*).*$/i.match(reply.text)
    match.nil? ? term = "No term detected" : term = match[1]
    tweet_text = tweet.build_sentence(term)
    tweet_text = "@" + reply.user.screen_name + " " + tweet_text
    tweet.tweet(tweet_text, reply.id)
  end
  tweet.update_since_id(reply_ids.max) unless reply_ids.max.nil?
end

{'fraction_non_alphanumeric': 0.1318918918918919, 'fraction_numerical': 0.004324324324324324, 'mean_word_length': 4.043596730245231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4683345', 'n_tokens_mistral': 717, 'n_tokens_neox': 692, 'n_words': 152}