<commit_before>package com.github.lwhite1.tablesaw.util;

import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntCollection;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;

import java.util.Set;

/**
 * A map that supports reversible key value pairs of short-String
 */
public class DictionaryMap {

  private final Int2ObjectMap<String> keyToValue = new Int2ObjectOpenHashMap<>();

  private final Object2IntMap<String> valueToKey = new Object2IntOpenHashMap<>();

  public DictionaryMap() {
    super();
    valueToKey.defaultReturnValue(-1);
  }

  public void put(int key, String value) {
    keyToValue.put(key, value);
    valueToKey.put(value, key);
  }

  public String get(int key) {
    return keyToValue.get(key);
  }

  public int get(String value) {

    return valueToKey.getInt(value);
  }

  public void remove(short key) {
    String value = keyToValue.remove(key);
    valueToKey.remove(value);
  }

  public void remove(String value) {
    int key = valueToKey.remove(value);
    keyToValue.remove(key);
  }<commit_msg>added copy constructor for DictionaryMap<commit_after>package com.github.lwhite1.tablesaw.util;

import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntCollection;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;

import java.util.Set;

/**
 * A map that supports reversible key value pairs of short-String
 */
public class DictionaryMap {

  private final Int2ObjectMap<String> keyToValue = new Int2ObjectOpenHashMap<>();

  private final Object2IntMap<String> valueToKey = new Object2IntOpenHashMap<>();

  public DictionaryMap() {
    super();
    valueToKey.defaultReturnValue(-1);
  }

  /**
   * Returns a new DictionaryMap that is a deep copy of the original
   */
  public DictionaryMap(DictionaryMap original) {
    for (Int2ObjectMap.Entry<String> entry: original.keyToValue.int2ObjectEntrySet()) {
      keyToValue.put(entry.getIntKey(), entry.getValue());
      valueToKey.put(entry.getValue(), entry.getIntKey());
    }
  }

  public void put(int key, String value) {
    keyToValue.put(key, value);
    valueToKey.put(value, key);
  }

  public String get(int key) {
    return keyToValue.get(key);
  }

  public int get(String value) {

    return valueToKey.getInt(value);
  }

  public void remove(short key) {
    String value = keyToValue.remove(key);
    valueToKey.remove(value);
  }

  public void remove(String value) {
    int key = valueToKey.remove(value);
    keyToValue.remove(key);
  }
{'fraction_non_alphanumeric': 0.11320754716981132, 'fraction_numerical': 0.007982583454281567, 'mean_word_length': 4.192090395480226, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '6960818', 'n_tokens_mistral': 898, 'n_tokens_neox': 891, 'n_words': 189}