code: def get_group_norm(spacy_span):
      """
      Give a span, determine the its group and return the normalized text representing the group
  
      Args:
              spacy_span (spacy.tokens.Span)
      """
      np = spacy_span.text
      norm = spacy_normalizer(np, spacy_span.lemma_)
      if args.mark_char in norm:
          norm = norm.replace(args.mark_char, " ")
      if np not in np2count:  # new np
          np2count[np] = 1
          np2id[np] = norm
          if norm in id2group:  # norm already exist
              id2group[norm].append(np)
          else:
              id2group[norm] = [np]
              id2rep[norm] = np
      else:  # another occurrence of this np. norm must exist and be consistent
          np2count[np] += 1
          if (
              np2id[np] != norm
          ):  # new norm to the same np - merge groups.
              #  no need to update np2id[np]
              norm = merge_groups(
                  np, np2id[np], norm
              )  # set to the already exist
              #  norm so I know this norm is already in id2group/id2rep
          else:  # update rep
              if np2count[np] > np2count[id2rep[norm]]:
                  id2rep[norm] = np  # replace rep
  
      return norm
  
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 1 for calling a global function with example usage: get_group_norm(spacy_span) and returns: norm