code: def augment_with_ngrams(unigrams, unigram_vocab_size, n_buckets, n=2):
      """Augment unigram features with hashed n-gram features."""
  
      def get_ngrams(n):
          return list(zip(*[unigrams[i:] for i in range(n)]))
  
      def hash_ngram(ngram):
          bytes_ = array.array("L", ngram).tobytes()
          hash_ = int(hashlib.sha256(bytes_).hexdigest(), 16)
          return unigram_vocab_size + hash_ % n_buckets
  
      return unigrams + [
          hash_ngram(ngram)
          for i in range(2, n + 1)
          for ngram in get_ngrams(i)
      ]
  
file_path: TensorLayer/examples/text_classification/tutorial_imdb_fasttext.py
imports: import array
  import hashlib
  import os
  import time
  import numpy
  import tensorflow
  import tensorlayer
  from tensorlayer.layers import *
  from tensorlayer.models import *
label_desc: Use image node_id 1 for calling a global function with example usage: augment_with_ngrams(unigrams, unigram_vocab_size, n_buckets, n) and returns: unknown, list, unknown