code: def store_text_prediction(self, prediction, sample_id, output_dir):
      sample = self.sample_by_id(sample_id)
      output_dir = (
          output_dir
          if output_dir
          else os.path.dirname(sample["image_path"])
      )
      bn = sample.get("base_name", sample["id"])
      with codecs.open(
          os.path.join(output_dir, bn + self.params.pred_extension),
          "w",
          "utf-8",
      ) as f:
          f.write(prediction.sentence)
  
imports: import codecs
  import os
  from copy import deepcopy
  from dataclasses import dataclass, field
  from typing import List
  import numpy
  import logging
  from paiargparse import pai_dataclass, pai_meta
  from tfaip.data.pipeline.definitions import PipelineMode, INPUT_PROCESSOR
  from calamari_ocr.ocr.dataset.datareader.base import CalamariDataGenerator, CalamariDataGeneratorParams, InputSample, SampleMeta
  from calamari_ocr.utils import split_all_ext, glob_all, keep_files_with_same_file_name
label_desc: Use image node_id 5 for calling the FileDataGenerator obj's underlying member method code with example usage: obj.store_text_prediction(prediction, sample_id, output_dir) without return types