code: def prepare_dict(sample_file, q, document_size):
      with open(sample_file) as f:
          if sample_file[-3:] == "txt":
              text = f.read()[:document_size]
              assert len(text) == document_size
              dicts = [{"questions": [q], "text": text}]
          elif sample_file[-4:] == "json":
              data = json.load(f)
              dicts = []
              for d in data["data"]:
                  for p in d["paragraphs"]:
                      dicts.append(p)
      return dicts
  
file_path: FARM/test/benchmarks/question_answering_components.py
imports: from farm.infer import Inferencer
  from pprint import pformat
  import pandas
  from tqdm import tqdm
  import logging
  import json
  from datetime import date
label_desc: Use image node_id 6 for calling a global function with example usage: prepare_dict(sample_file, q, document_size) and returns: dicts