code: def analyze(
      target_data,
      ref_data,
      tar_header,
      ref_header,
      top_n=10000,
      top_n_vectors=500,
      re_analysis=False,
      tfidf_w=0.5,
      cval_w=0.5,
      lm_w=0,
  ):
      """
      Compare a topics list of a target data to a topics list of a reference data
      and extract hot topics, trends and clusters. Topic lists can be generated
      by running topic_extraction.py
  
      Args:
          target_data: A list of topics with importance scores extracted from the tagret corpus
          ref_data: A list of topics with importance scores extracted from the reference corpus
          tar_header: The header to appear for the target topics graphs
          ref_header: The header to appear for the reference topics graphs
          top_n (int): Limit the analysis to only the top N phrases of each list
          top_n_vectors (int): The number of vectors to include in the scatter
          re_analysis (Boolean): whether a first analysis has already been made or not
          tfidf_w (Float): the TF_IDF weight for the final score calculation
          cval_w (Float): the C_Value weight for the final score calculation
          lm_w (Float): the Language-Model weight for the final score calculation
      """
      hash2group = {}
      rep2rank = (
          {}
      )  # the merged list of groups extracted from both corpora.
      #  Will be sorted by their rank.
      in_model_count = 0
      create_clusters = False
      try:
          if not re_analysis:  # first analysis, not through ui
              copyfile(
                  target_data, target_topics_path
              )  # copying the initial
              # scores file to have a const filename for the ui to recognize
              #  when reanalyzing
              copyfile(ref_data, ref_topics_path)
          calc_scores(
              target_data, tfidf_w, cval_w, lm_w, target_scores_path
          )
          calc_scores(ref_data, tfidf_w, cval_w, lm_w, ref_scores_path)
          # unify all topics:
          with open(ref_data, encoding="utf-8", errors="ignore") as f:
              topics1 = sum(1 for _ in f)
          with open(
              target_data, encoding="utf-8", errors="ignore"
          ) as f:
              topics2 = sum(1 for _ in f)
          sum_topics = topics1 + topics2
          logger.info("sum of all topics= %s", str(sum_topics))
          merge_phrases(
              ref_scores_path,
              True,
              hash2group,
              rep2rank,
              top_n,
              sum_topics,
          )
          merge_phrases(
              target_scores_path,
              False,
              hash2group,
              rep2rank,
              top_n,
              sum_topics,
          )
          logger.info(
              "Total number of evaluated topics: %s", str(len(rep2rank))
          )
          all_topics_sorted = sorted(rep2rank, key=rep2rank.get)
          top_n_scatter = (
              len(all_topics_sorted)
              if top_n_vectors is None
              else top_n_vectors
          )
          # compute 2D space clusters if model exists:
          w2v_loc = path.join(directory, "W2V_Models/model.bin")
          if os.path.isfile(w2v_loc):
              scatter_group = all_topics_sorted[0:top_n_scatter]
              (
                  np_scat,
                  x_scat,
                  y_scat,
                  in_model_count,
              ) = compute_scatter_subwords(scatter_group, w2v_loc)
              if np_scat is not None and x_scat is not None:
                  create_clusters = True
                  for j in range(len(np_scat)):
                      hash2group[simple_normalizer(np_scat[j])] += (
                          x_scat[j],
                          y_scat[j],
                      )
          # prepare reports data:
          groups_r = list(
              filter(
                  lambda x: x[2] == 0 or x[2] == 2, hash2group.values()
              )
          )
          groups_t = list(
              filter(
                  lambda x: x[2] == 1 or x[2] == 2, hash2group.values()
              )
          )
          trends = list(
              filter(lambda x: x[2] == 2, hash2group.values())
          )  # all trends
          groups_r_sorted = sorted(
              groups_r, key=operator.itemgetter(1), reverse=True
          )
          groups_t_sorted = sorted(
              groups_t, key=operator.itemgetter(3), reverse=True
          )
          trends_sorted = sorted(
              trends, key=operator.itemgetter(6), reverse=True
          )  # sort by t_score
  
          # save results:
          save_report_data(
              hash2group,
              groups_r_sorted,
              groups_t_sorted,
              trends_sorted,
              all_topics_sorted,
              create_clusters,
              tar_header,
              ref_header,
              tfidf_w,
              cval_w,
              lm_w,
              in_model_count,
              top_n_scatter,
          )
          logger.info("Done analysis.")
      except Exception as e:
          logger.error(str(e))
  
imports: import argparse
  import csv
  import logging
  import operator
  import os
  import sys
  from os import path
  from pathlib import Path
  from shutil import copyfile
  import numpy
  import pandas
  from sklearn.manifold import TSNE
  from nlp_architect import LIBRARY_OUT
  from nlp_architect.utils.embedding import FasttextEmbeddingsModel
  from nlp_architect.utils.io import check_size, validate_existing_filepath
  from nlp_architect.utils.text import simple_normalizer
label_desc: Use image node_id 1 for calling a global function with example usage: analyze(target_data, ref_data, tar_header, ref_header, top_n, top_n_vectors, re_analysis, tfidf_w, cval_w, lm_w) without return types