code: def generate_affinity(
      self, img_h, img_w, word_level_char_bbox, horizontal_text_bools
  ):
      affinity_map = np.zeros([img_h, img_w], dtype=np.float32)
      all_affinity_bbox = []
      for i in range(len(word_level_char_bbox)):
          for j in range(len(word_level_char_bbox[i]) - 1):
              affinity_bbox = self.calculate_affinity_box_points(
                  word_level_char_bbox[i][j],
                  word_level_char_bbox[i][j + 1],
              )
  
              affinity_map = self.add_gaussian_map_to_score_map(
                  affinity_map,
                  affinity_bbox.copy(),
                  self.enlarge_affinity,
                  horizontal_text_bools[i],
                  map_type="affinity",
              )
              all_affinity_bbox.append(
                  np.expand_dims(affinity_bbox, axis=0)
              )
  
      if len(all_affinity_bbox) > 0:
          all_affinity_bbox = np.concatenate(all_affinity_bbox, axis=0)
      return affinity_map, all_affinity_bbox
  
file_path: EasyOCR/trainer/craft/data/gaussian.py
imports: import numpy
  import cv2
  from data.boxEnlarge import enlargebox
label_desc: Use image node_id 8 for calling the GaussianBuilder obj's underlying member method code with example usage: obj.generate_affinity(img_h, img_w, word_level_char_bbox, horizontal_text_bools) and returns: affinity_map,  all_affinity_bbox