code: def overlap_score(hypothesis_chunks, reference_chunks):
      length_modifier = len(hypothesis_chunks) / len(reference_chunks)
      search_distance = max(len(reference_chunks) // 5, 10)
      chunk_scores = []
      chunk_weights = []
      for i, hyp_chunk in enumerate(hypothesis_chunks):
          max_score = 0
          chunk_weight = 1
          i_offset = int(i * length_modifier)
          chunk_range = range(
              max(0, i_offset - search_distance),
              min(len(reference_chunks), i_offset + search_distance),
          )
          for j in chunk_range:
              ref_chunk = reference_chunks[j]
              score = (
                  fuzz.ratio(hyp_chunk, ref_chunk, score_cutoff=30)
                  / 100
              )
              if score > max_score:
                  max_score = score
                  chunk_weight = math.sqrt(len(ref_chunk))
          chunk_scores.append(max_score)
          chunk_weights.append(chunk_weight)
      chunk_scores = [
          chunk_scores[i] * chunk_weights[i]
          for i in range(len(chunk_scores))
      ]
      return chunk_scores, chunk_weights
  
imports: import math
  from rapidfuzz import fuzz, distance
  import re
label_desc: Use image node_id 3 for calling a global function with example usage: overlap_score(hypothesis_chunks, reference_chunks) and returns: chunk_scores,  chunk_weights