code: def build_dataset(filename, max_lines=-1):
      """Loads a text file, and turns each line into an encoded sequence."""
      encodings = dict(list(map(reversed, enumerate(string.printable))))
      digitize = (
          lambda char: encodings[char]
          if char in encodings
          else len(encodings)
      )
      encode_line = lambda line: np.array(list(map(digitize, line)))
      nonblank_line = lambda line: len(line) > 2
  
      with open(filename) as f:
          lines = f.readlines()
  
      encoded_lines = list(
          map(
              encode_line,
              list(filter(nonblank_line, lines))[:max_lines],
          )
      )
      num_outputs = len(encodings) + 1
  
      return encoded_lines, num_outputs
  
file_path: autograd/examples/hmm_em.py
imports: from __future__ import division, print_function
  import autograd.numpy
  import autograd.numpy.random
  from autograd.scipy.special import logsumexp
  from autograd import value_and_grad
  from functools import partial
  from os.path import join, dirname
  import string
label_desc: Use image node_id 5 for calling a global function with example usage: build_dataset(filename, max_lines) and returns: encoded_lines,  num_outputs