code: def compute_ngram_freq_sorted(args, ngrams):
      ngrams_freq = {}
      for ngram_key in ngrams.keys():
          length = len(ngram_key.split())
          ngrams_freq[length] = (
              ngrams_freq[length] + 1 if length in ngrams_freq else 1
          )
  
      ngrams_freq_sorted = sorted(
          ngrams_freq.items(), key=lambda item: item[0]
      )
      print(
          " Ngram frequencies: {}".format(ngrams_freq_sorted),
          flush=True,
      )
      print(
          " Entities in ngrams {} min_ngram_size {} max_ngram_size {}".format(
              len(ngrams),
              ngrams_freq_sorted[0][0],
              ngrams_freq_sorted[len(ngrams_freq_sorted) - 1][0],
          ),
          flush=True,
      )
      return ngrams_freq_sorted
  
imports: import argparse
  from functools import partial
  import json
  import multiprocessing
  import nltk
  import pickle
  import re
  import string
  import sys
  import time
label_desc: Use image node_id 10 for calling a global function with example usage: compute_ngram_freq_sorted(args, ngrams) and returns: ngrams_freq_sorted