class_docstr: load data from a given directory
class_docstr_tok: ["load","data","from","a","given","directory"]
code: def __init__(self, dataset, sampleEach=1):
      self.path = "../data/" + dataset + "/"
      self.chars = codecs.open(
          self.path + "chars.txt", "r", "utf8"
      ).read()
      self.wordChars = codecs.open(
          self.path + "wordChars.txt", "r", "utf8"
      ).read()
      self.lm = LanguageModel(
          codecs.open(self.path + "corpus.txt", "r", "utf8").read(),
          self.chars,
          self.wordChars,
      )
      self.mats = []
      self.gts = []
      self.fns = []
  
      i = 0
      while True:
          fnMat = self.path + "mat_" + str(i) + ".csv"
          fnGT = self.path + "gt_" + str(i) + ".txt"
          i += 1
  
          # file not found
          if (not os.path.isfile(fnMat)) or (not os.path.isfile(fnGT)):
              break
  
          # ignore this sample
          if (i - 1) % sampleEach != 0:
              continue
  
          # put into result
          self.mats.append(fnMat)
          self.gts.append(fnGT)
          self.fns.append(fnMat + "|" + fnGT)
  
      self.currIdx = 0
  
file_path: calamari/calamari_ocr/thirdparty/ctcwordbeamsearch/DataLoader.py
imports: from __future__ import division
  from __future__ import print_function
  import codecs
  import os.path
  import numpy
  from LanguageModel import LanguageModel
label_desc: Use image node_id 1 to create a new DataLoader object  with example: obj = DataLoader(dataset, sampleEach)