<commit_before>require 'json'
require 'yaml'
require 'line/bot'

module MylineCommand
  class Command

    def initialize
      path = File.expand_path('../../../config.yml', __FILE__)
      config_txt = YAML.load_file(path)
      ENV["LINE_CHANNEL_SECRET"] = config_txt["line"]["line_channel_secret"]
      ENV["LINE_CHANNEL_TOKEN"] = config_txt["line"]["line_channel_token"]
#      ENV["LINE_USERID"] = config_txt["line"]["line_uid"]
      @userids = config_txt["line"]["line_uid"]
      @client ||= Line::Bot::Client.new { |config|
        config.channel_secret = ENV["LINE_CHANNEL_SECRET"]
        config.channel_token = ENV["LINE_CHANNEL_TOKEN"]
      }
    end
    
    def start_unbrella_advice<commit_msg>ヒブワクチンサーチ実行ルーチン実装<commit_after>require 'json'
require 'yaml'
require 'line/bot'

module MylineCommand
  class Command

    def initialize
      path = File.expand_path('../../../config.yml', __FILE__)
      config_txt = YAML.load_file(path)
      ENV["LINE_CHANNEL_SECRET"] = config_txt["line"]["line_channel_secret"]
      ENV["LINE_CHANNEL_TOKEN"] = config_txt["line"]["line_channel_token"]
#      ENV["LINE_USERID"] = config_txt["line"]["line_uid"]
      @userids = config_txt["line"]["line_uid"]
      @client ||= Line::Bot::Client.new { |config|
        config.channel_secret = ENV["LINE_CHANNEL_SECRET"]
        config.channel_token = ENV["LINE_CHANNEL_TOKEN"]
      }
    end
    
    def start_hib_search
      hs = MylineCommand::HibSearch.new
      hs.get_hibdata

      if hs.hib_notice?
        post_text  = "***ヒブワクチン供給開始のニュースが出ています***"
        uid_keys = @userids.keys
        for uid_key in uid_keys do
          @client.push_message(@userids[uid_key], {type: 'text', text: post_text})
        end
      end
    end

    def start_unbrella_advice
{'fraction_non_alphanumeric': 0.1386696730552424, 'fraction_numerical': 0.0, 'mean_word_length': 3.415422885572139, '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': '3840900', 'n_tokens_mistral': 623, 'n_tokens_neox': 626, 'n_words': 93}