code: def extract_entities_from_subfolder(subfolder, nkjp_dir):
      # read the ner annotation from a subfolder, assign it to paragraphs
      subfolder_entities = extract_unassigned_subfolder_entities(
          subfolder, nkjp_dir
      )
      par_id_to_segs = assign_entities(
          subfolder, subfolder_entities, nkjp_dir
      )
      return par_id_to_segs
  
imports: import argparse
  import json
  import os
  import random
  import tarfile
  import tempfile
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling a global function with example usage: extract_entities_from_subfolder(subfolder, nkjp_dir) and returns: par_id_to_segs