<commit_before>package com.maestrano.helpers;

import java.util.HashMap;
import java.util.Map;

public class MnoMapHelper {
	
	/**
	 * Convert all keys to snake case style
	 * @param <V>
	 * @param hash
	 * @return
	 */
	public static <V> Map<String,V> toUnderscoreHash(Map<String,V> hash) {
		if (hash == null) return null;
		
		Map<String,V> newHash = new HashMap<String,V>();
		
		for (Map.Entry<String, V> entry : hash.entrySet())
		{
			newHash.put(MnoStringHelper.toSnakeCase(entry.getKey()), entry.getValue());
		}
		
		return newHash;
	}
	
//	public static Map<String,Object> toUnderscoreHash(Map<String,String> hash) {
//		
//	}
}<commit_msg>recursive conversion<commit_after>package com.maestrano.helpers;

import java.util.HashMap;
import java.util.Map;

public class MnoMapHelper {
	
	/**
	 * Convert all keys to snake case style
	 * @param <V>
	 * @param hash
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static <V> Map<String,V> toUnderscoreHash(Map<String,V> hash) {
		if (hash == null) return null;
		
		Map<String,V> newHash = new HashMap<String,V>();
		
		for (Map.Entry<String, V> entry : hash.entrySet())
		{
			V value = entry.getValue();
			
			// Apply toUnderscoreHash recursively on sub-hashes
			if (value instanceof Map) {
				value = (V) toUnderscoreHash((Map<String,Object>) value);
			}
			newHash.put(MnoStringHelper.toSnakeCase(entry.getKey()), value);
			
		}
		
		return newHash;
	}
}
{'fraction_non_alphanumeric': 0.14335664335664336, 'fraction_numerical': 0.0, 'mean_word_length': 3.77, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '5708558', 'n_tokens_mistral': 554, 'n_tokens_neox': 492, 'n_words': 113}