code: def get_words(array, k, N):
      """Gets N words of length k from an array.
  
      Words may overlap.
  
      For example, say your image signature is [0, 1, 2, 0, -1, -2, 0, 1] and
      k=3 and N=4. That means we want 4 words of length 3.  For this signature,
      that gives us:
  
      [0, 1, 2]
      [2, 0, -1]
      [-1, -2, 0]
      [0, 1]
  
      Args:
          array (numpy.ndarray): array to split into words
          k (int): word length
          N (int): number of words
  
      Returns:
          an array with N rows of length k
  
      """
      # generate starting positions of each word
      word_positions = np.linspace(
          0, array.shape[0], N, endpoint=False
      ).astype("int")
  
      # check that inputs make sense
      if k > array.shape[0]:
          raise ValueError(
              "Word length cannot be longer than array length"
          )
      if word_positions.shape[0] > array.shape[0]:
          raise ValueError(
              "Number of words cannot be more than array length"
          )
  
      # create empty words array
      words = np.zeros((N, k)).astype("int8")
  
      for i, pos in enumerate(word_positions):
          if pos + k <= array.shape[0]:
              words[i] = array[pos : pos + k]
          else:
              temp = array[pos:].copy()
              temp.resize(k)
              words[i] = temp
  
      return words
  
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 2 for calling a global function with example usage: get_words(array, k, N) and returns: words