code: def prune_stats(stats, big_stats, threshold):
      """Prune statistics dict for efficiency of max()
  
      The frequency of a symbol pair never increases, so pruning is generally safe
      (until we the most frequent pair is less frequent than a pair we previously pruned)
      big_stats keeps full statistics for when we need to access pruned items
      """
      for item, freq in list(stats.items()):
          if freq < threshold:
              del stats[item]
              if freq < 0:
                  big_stats[item] += freq
              else:
                  big_stats[item] = freq
  
file_path: OpenNMT-py/tools/learn_bpe.py
imports: from __future__ import unicode_literals
  import sys
  import codecs
  import re
  import copy
  import argparse
  from collections import defaultdict, Counter
  from io import open
label_desc: Use image node_id 6 for calling a global function with example usage: prune_stats(stats, big_stats, threshold) without return types