<commit_before>deep_hash
=========

`deep_hash` is a Ruby gem that provides ways to deal with multi-level default hashes.

Usage
-----

Right now the only functionality is to create such a hash. This is useful if you use multi-dimensional default
hashes a lot. For example, multi-dimensional tables of counts (defaulting to 0) are often useful.

```ruby
require "deep_hash"

h = Hash.deep(0) # is equivalent to
h = {}

h = Hash.deep(2) # is equivalent to
h = Hash.new { |k1, v1| k1[v1] = Hash.new { |k2, v2| k2[v2] = {} } }

h = Hash.deep(0) { "foobar" } # is equivalent to
h = Hash.new { |k, v| k[v] = "foobar" }

h = Hash.deep(1) { 0 } # is equivalent to
h = Hash.new { |k1, v1| k1[v1] = Hash.new { |k2, v2| k2[v2] = 0 } }
```

Installation
------------

    gem install deep_hash<commit_msg>Update the readme with the latest information<commit_after>deep_hash
=========

`deep_hash` is a Ruby gem that provides ways to deal with multi-level default hashes.

Usage
-----

Right now the only functionality is to create such a hash. This is useful if you use multi-dimensional default
hashes a lot. For example, multi-dimensional tables of counts (defaulting to 0) are often useful.

```ruby
require "deep_hash"

h = Hash.deep(0) # is equivalent to
h = {}

h = Hash.deep(2) # is equivalent to
h = Hash.new { |k1, v1| k1[v1] = Hash.new { |k2, v2| k2[v2] = {} } }

h = Hash.deep(0) { "foobar" } # is equivalent to
h = Hash.new { |k, v| k[v] = "foobar" }

h = Hash.deep(1) { 0 } # is equivalent to
h = Hash.new { |k1, v1| k1[v1] = Hash.new { |k2, v2| k2[v2] = 0 } }

h = Hash.deep # an arbitrarily deep hash
h[1][2][3] = 4
h[:foo][:bar] = :baz
```

Installation
------------

    gem install deep_hash
{'fraction_non_alphanumeric': 0.16372202591283863, 'fraction_numerical': 0.02944640753828033, 'mean_word_length': 3.2581453634085213, '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': '6085539', 'n_tokens_mistral': 649, 'n_tokens_neox': 625, 'n_words': 225}