class_docstr: kws task 
docstr: train.list file:
    /path/to/10w.42.feat
    /path/to/10w.42.label
    ./10w.42.desc
    /path/to/train.7.feat
    /path/to/train.7.label
    ./train.7.desc
docstr_tok: ["train.list","file",":","\/path\/to\/10w.42.feat","\/path\/to\/10w.42.label",".\/10w.42.desc","\/path\/to\/train.7.feat","\/path\/to\/train.7.label",".\/train.7.desc"]
code: def generate_data(self):
      """
      train.list file:
        /path/to/10w.42.feat
        /path/to/10w.42.label
        ./10w.42.desc
        /path/to/train.7.feat
        /path/to/train.7.label
        ./train.7.desc
      """
  
      for i in range(0, len(self.lines), 3):
          fp_feat = open(self.lines[i].strip(), "rb")
          buff = open(self.lines[i + 1].strip(), "rb").read()
          # label is 0 ~ 8,
          # one label per frame
          label_arr = struct.unpack(
              "%di" % (len(buff) / 4), buff
          )  # 570485
          # desc_lines = open(self.lines[i + 2].strip()).readlines()[1:]
  
          # read file header, frame_bytes is 160 Bytes, 40 dimensions
          num_frames, _, frame_bytes, _ = struct.unpack(
              "!%di%dh" % (2, 2), fp_feat.read(12)
          )
          del num_frames
          buff = fp_feat.read()  # file body
          fp_feat.close()
  
          # ! means converting Big-Endian to Little-Endian
          feat_all = struct.unpack("!%df" % (len(buff) / 4), buff)
          feat_matrix = np.array(feat_all).reshape(
              (-1, int(frame_bytes / 4))
          )  # (570485, 40) (frame_num, feat_dim)
  
          # num, bad = 0, 0
          length = feat_matrix.shape[0] - self.window_len  #  281508
          for j in range(0, length, self.window_shift):
              label_t = np.unique(label_arr[j : j + self.window_len])
              if -1 in label_t:
                  # reduce the ratio of negative samples
                  continue
              if len(label_t) > 2 and len(label_t) < 8:
                  continue
  
              feat = feat_matrix[j : j + self.window_len]
              _, feat = self.reader.add_delta(
                  feat, self.delta_order, self.delta_wind
              )
              # cmvn is 120 lines, each line has mean and variance
              _, feat = self.reader.normalization_feat_by_mean_variance(
                  feat, self.cmvn_path
              )
              if self.splice_frame:
                  _, feat = self.reader.splice_frames(
                      feat, self.left_context, self.left_context
                  )
              if set(label_t).issuperset(range(0, 8)):
                  # including keyword
                  label = 1
              else:
                  label = 0
  
              yield feat, label
  
file_path: delta/delta/data/task/kws_cls_task.py
imports: import struct
  import numpy
  import delta.compat
  from delta import utils
  from delta.utils.register import registers
  from delta.data.task.base_speech_task import SpeechTask
  from delta.data.utils.htk_reader_lib import HtkReaderIO
label_desc: Use image node_id 4 for calling the KwsClsTask obj's underlying member method code with example usage: obj.generate_data() without return types