code: def build_lm(args, data_lower, vocab_str):
      print("\nCreating ARPA file ...")
      lm_path = os.path.join(args.output_dir, "lm.arpa")
      subargs = [
          os.path.join(args.kenlm_bins, "lmplz"),
          "--order",
          str(args.arpa_order),
          "--temp_prefix",
          args.output_dir,
          "--memory",
          args.max_arpa_memory,
          "--text",
          data_lower,
          "--arpa",
          lm_path,
          "--prune",
          *args.arpa_prune.split("|"),
      ]
      if args.discount_fallback:
          subargs += ["--discount_fallback"]
      subprocess.check_call(subargs)
  
      # Filter LM using vocabulary of top-k words
      print("\nFiltering ARPA file using vocabulary of top-k words ...")
      filtered_path = os.path.join(args.output_dir, "lm_filtered.arpa")
      subprocess.run(
          [
              os.path.join(args.kenlm_bins, "filter"),
              "single",
              "model:{}".format(lm_path),
              filtered_path,
          ],
          input=vocab_str.encode("utf-8"),
          check=True,
      )
  
      # Quantize and produce trie binary.
      print("\nBuilding lm.binary ...")
      binary_path = os.path.join(args.output_dir, "lm.binary")
      subprocess.check_call(
          [
              os.path.join(args.kenlm_bins, "build_binary"),
              "-a",
              str(args.binary_a_bits),
              "-q",
              str(args.binary_q_bits),
              "-v",
              args.binary_type,
              filtered_path,
              binary_path,
          ]
      )
  
file_path: DeepSpeech/data/lm/generate_lm.py
imports: import argparse
  import gzip
  import io
  import os
  import subprocess
  from collections import Counter
  import progressbar
label_desc: Use image node_id 2 for calling a global function with example usage: build_lm(args, data_lower, vocab_str) without return types