code: def scoreDuplicates(
      record_pairs: RecordPairs,
      featurizer: FeaturizerFunction,
      classifier: Classifier,
      num_cores: int = 1,
  ) -> Scores:
      if num_cores < 2:
          from multiprocessing.dummy import Process, Queue
      else:
          from .backport import Process, Queue  # type: ignore
  
      first, record_pairs = peek(record_pairs)
      if first is None:
          raise BlockingError(
              "No records have been blocked together. "
              "Is the data you are trying to match like "
              "the data you trained on? If so, try adding "
              "more training data."
          )
  
      record_pairs_queue: _Queue = Queue(2)
      exception_queue: _Queue = Queue()
      scored_pairs_file, score_file_path = tempfile.mkstemp()
      os.close(scored_pairs_file)
  
      # explicitly defining the lock from the "spawn context" seems to
      # be necessary for python 3.7 on mac os.
      offset = multiprocessing.Value("Q", 0, lock=RLock())
  
      id_type = sniff_id_type(first)
      dtype = numpy.dtype([("pairs", id_type, 2), ("score", "f4")])
  
      n_map_processes = max(num_cores, 1)
      score_records = ScoreDupes(
          featurizer,
          classifier,
          record_pairs_queue,
          exception_queue,
          score_file_path,
          dtype,
          offset,
      )
      map_processes = [
          Process(target=score_records) for _ in range(n_map_processes)
      ]
  
      for process in map_processes:
          process.start()
  
      fillQueue(record_pairs_queue, record_pairs, n_map_processes)
  
      for process in map_processes:
          process.join()
  
      try:
          exc = exception_queue.get_nowait()
      except queue.Empty:
          pass
      else:
          raise ChildProcessError from exc
  
      scored_pairs: Scores
  
      if offset.value:  # type: ignore
          scored_pairs = numpy.memmap(score_file_path, dtype=dtype)
      else:
          scored_pairs = numpy.array([], dtype=dtype)
  
      return scored_pairs
  
imports: from __future__ import annotations
  import collections
  import functools
  import itertools
  import multiprocessing
  import multiprocessing.dummy
  import os
  import queue
  import tempfile
  from typing import TYPE_CHECKING, overload
  import numpy
  from dedupe.backport import RLock
label_desc: Use image node_id 1 for calling a global function with example usage: scoreDuplicates(record_pairs, featurizer, classifier, num_cores) and returns: scored_pairs