docs: def wngram2idngram(input_file, vocab_file, output_file, buffersize=100, hashtablesize=2000000, files=20, compress=False, verbosity=2, n=3, write_ascii=False, fof_size=10):
      """
          Takes a word N-gram file and a vocabulary file and lists every id n-gram which occurred in the text, along with its number of occurrences, in either ASCII or binary format.
  
          Note : It is important that the vocabulary file is in alphabetical order. If you are using vocabularies generated by wfreq2vocab then this should not be an issue, as they will already be alphabetically sorted.
      """
      cmd = ['wngram2idngram', '-vocab', os.path.abspath(vocab_file),
                               '-idngram', os.path.abspath(output_file)]
      if buffersize:
          cmd.extend(['-buffer', buffersize])
  
      if hashtablesize:
          cmd.extend(['-hash', hashtablesize])
  
      if files:
          cmd.extend(['-files', files])
  
      if verbosity:
          cmd.extend(['-verbosity', verbosity])
  
      if n:
          cmd.extend(['-n', n])
  
      if fof_size:
          cmd.extend(['-fof_size', fof_size])
  
      if compress:
          cmd.append('-compress')
      if write_ascii:
          cmd.append('-write_ascii')
  
      # Ensure that every parameter is of type 'str'
      cmd = [str(x) for x in cmd]
      
      with tempfile.SpooledTemporaryFile() as output_f:
          with tempfile.SpooledTemporaryFile() as input_f:
              input_f.write(text.encode('utf-8') if sys.version_info >= (3,) and type(text) is str else text)
              input_f.seek(0)
              with  output_to_debuglogger() as err_f:
                  with do_in_tempdir():
                      exitcode = subprocess.call(cmd, stdin=input_f, stdout=output_f, stderr=err_f)
          output = output_f.read()
      
      logger = logging.getLogger(__name__)
      logger.debug("Command '%s' returned with exit code '%d'." % (' '.join(cmd), exitcode))
  
      if exitcode != 0:
          raise ConversionError("'%r' returned with non-zero exit status '%s'" % (cmd, exitcode))
  
      if sys.version_info >= (3,) and type(output) is bytes:
          output = output.decode('utf-8')
  
      return output.strip()