code: def merge_groups(np, old_id, diff_id):
      if diff_id in id2group:
          for term in id2group[diff_id]:  # for each term update dicts
              np2id[term] = old_id
              id2group[old_id].append(term)
              if np2count[term] > np2count[id2rep[old_id]]:
                  id2rep[old_id] = term
          id2rep.pop(diff_id)
          id2group.pop(diff_id)
      else:
          if np2count[np] > np2count[id2rep[old_id]]:
              id2rep[old_id] = np
      return old_id
  
file_path: nlp-architect/solutions/set_expansion/prepare_data.py
imports: import gzip
  import json
  import logging
  from argparse import ArgumentParser
  from os import path, makedirs
  from tqdm import tqdm
  from nlp_architect import LIBRARY_OUT
  from nlp_architect.pipelines.spacy_np_annotator import NPAnnotator, get_noun_phrases
  from nlp_architect.utils.io import check_size, download_unlicensed_file, validate_parent_exists
  from nlp_architect.utils.text import spacy_normalizer, SpacyInstance
label_desc: Use image node_id 5 for calling a global function with example usage: merge_groups(np, old_id, diff_id) and returns: old_id