code: def words_to_int(word_array):
      """Converts a simplified word to an integer
  
      Encodes a k-byte word to int (as those returned by max_contrast).
      First digit is least significant.
  
      Returns dot(word + 1, [1, 3, 9, 27 ...] ) for each word in word_array
  
      e.g.:
      [ -1, -1, -1] -> 0
      [ 0,   0,  0] -> 13
      [ 0,   1,  0] -> 16
  
      Args:
          word_array (numpy.ndarray): N x k array
  
      Returns:
          an array of integers of length N (the integer word encodings)
  
      """
      width = word_array.shape[1]
  
      # Three states (-1, 0, 1)
      coding_vector = 3 ** np.arange(width)
  
      # The 'plus one' here makes all digits positive, so that the
      # integer representation is strictly non-negative and unique
      return np.dot(word_array + 1, coding_vector)
  
file_path: image-match/image_match/signature_database_base.py
imports: from image_match.goldberg import ImageSignature
  from itertools import product
  from operator import itemgetter
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: words_to_int(word_array) and returns: np