<commit_before>module BceExplorer
  # address info report
  class AddressReport
    def initialize(db)
      @address = db.address
      @wallet = db.wallet
      @tx_address = db.tx_address
      @tx_list = db.tx_list
    end

    def call(address)
      if @address.exists? address
        info(address)
      else
        { 'address' => address, 'balance' => 0.0,
          'wallet_id' => '', 'wallet_knowns' => 0,
          'tx_count' => 0, 'tx' => nil }
      end
    end

    private

    def info(address)
      wallet_id = @wallet.id address

      {
        'address' => address,
        'balance' => @address[address],
        'wallet_id' => wallet_id,
        'wallet_size' => @wallet.count(wallet_id),
        'tx_count' => @tx_address.count(address),
        'tx' => @tx_address[address].map { |txid| @tx_list[txid] }.compact
      }
    end
  end
end
<commit_msg>fixed AddressReport#<commit_after>module BceExplorer
  # address info report
  class AddressReport
    def initialize(db)
      @address = db.address
      @wallet = db.wallet
      @tx_address = db.tx_address
      @tx = db.tx
    end

    def call(address)
      if @address.exists? address
        info(address)
      else
        { 'address' => address, 'balance' => 0.0,
          'wallet_id' => '', 'wallet_knowns' => 0,
          'tx_count' => 0, 'tx' => nil }
      end
    end

    private

    def info(address)
      wallet_id = @wallet.id address

      {
        'address' => address,
        'balance' => @address[address],
        'wallet_id' => wallet_id,
        'wallet_size' => @wallet.count(wallet_id),
        'tx_count' => @tx_address.count(address),
        'tx' => @tx.fetch(@tx_address[address])
      }
    end
  end
end

{'fraction_non_alphanumeric': 0.1345707656612529, 'fraction_numerical': 0.004640371229698376, 'mean_word_length': 2.108108108108108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '5753495', 'n_tokens_mistral': 578, 'n_tokens_neox': 580, 'n_words': 122}