<commit_before>module Lita
  module Handlers
    class Pet < Handler
      route /^java\s+(.+)/, :with_java, help: { "java TEXT" => "reply back with java." }
      route /^(?:otp)\s+(.+)/, :otp, help: { "otp[ LENGTH]" => "reply one time password" }
      route /(.+)\(回文\)$/, :palindrome
      route /^(?:bj|ブラック)/, :black

      def with_java( response )
        word = response.matches[0][0]
        response.reply "!!! #{word} とジャバ !!!"
      end

      def otp( response )
        length = response.matches[0][0]
        if length.to_i <= 0
          len = 15
        else
          len = length.to_i
        end
        pattern = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
        pattern += ["!", "#", "$", "%", "&", "(", ")",
                    "=", "-", "^", "~", "*", "+", "?", "_"]
        random_string = (0...len).map { pattern[rand( pattern.length )] }.join
        response.reply random_string
      end

      def palindrome( response )
        word = response.matches[0][0]
        response.reply word.reverse
      end

      def black( response )
        kotowaza = [
          "飛んで火にいる春の新卒",
          "うどの大企業 ",
          "転ばぬ先の杖を用意する暇があるなら働け ",
          "払わぬボーナス、サービス残業",
          "石橋を叩く暇があったら渡って仕事取って帰ってこい",
          "下手な新卒数とりゃ逃げて",
          "焼き鉄板の上でも３年 ",
          "ブラック社員に口なし",
          "低学歴の背比べ",
          "はきだめに東大",
          "上司の耳に念仏",
          "社長の耳に労働基準法 ",<commit_msg>add otp<commit_after>module Lita
  module Handlers
    class Pet < Handler
      route /^java\s+(.+)/, :with_java, help: { "java TEXT" => "reply back with java." }
      route /^(?:otp)\s+(.+)/, :otp, help: { "otp[ LENGTH]" => "reply one time password" }
      route /(.+)\(回文\)$/, :palindrome
      route /^(?:bj|ブラック)/, :black

      def with_java( response )
        word = response.matches[0][0]
        response.reply "!!! #{word} とジャバ !!!"
      end

      def otp( response )
        length = response.matches[0][0]
        if length.to_i <= 0 || length == nil
          len = 15
        else
          len = length.to_i
        end
        pattern = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
        pattern += ["!", "#", "$", "%", "&", "(", ")",
                    "=", "-", "^", "~", "*", "+", "?", "_"]
        random_string = (0...len).map { pattern[rand( pattern.length )] }.join
        response.reply random_string
      end

      def palindrome( response )
        word = response.matches[0][0]
        response.reply word.reverse
      end

      def black( response )
        kotowaza = [
          "飛んで火にいる春の新卒",
          "うどの大企業 ",
          "転ばぬ先の杖を用意する暇があるなら働け ",
          "払わぬボーナス、サービス残業",
          "石橋を叩く暇があったら渡って仕事取って帰ってこい",
          "下手な新卒数とりゃ逃げて",
          "焼き鉄板の上でも３年 ",
          "ブラック社員に口なし",
          "低学歴の背比べ",
          "はきだめに東大",
          "上司の耳に念仏",
          "社長の耳に労働基準法 ",
{'fraction_non_alphanumeric': 0.19064368624692227, 'fraction_numerical': 0.009145269081955681, 'mean_word_length': 1.7189292543021033, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '662330', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1188, 'n_words': 189}