class_docstr: Reader class for reading data with different types of format.
  
  Parameters
  ----------
  user_set: set, default = None
      Set of users to be retained when reading data.
      If `None`, all users will be included.
  
  item_set: set, default = None
      Set of items to be retained when reading data.
      If `None`, all items will be included.
  
  min_user_freq: int, default = 1
      The minimum frequency of a user to be retained.
      If `min_user_freq = 1`, all users will be included.
  
  min_item_freq: int, default = 1
      The minimum frequency of an item to be retained.
      If `min_item_freq = 1`, all items will be included.
  
  num_top_freq_user: int, default = 0
      The number of top popular users to be retained.
      If `num_top_freq_user = 0`, all users will be included.
  
  num_top_freq_item: int, default = 0
      The number of top popular items to be retained.
      If `num_top_freq_item = 0`, all items will be included.
  
  min_basket_size: int, default = 1
      The minimum number of items of a basket to be retained.
      If `min_basket_size = 1`, all items will be included.
  
  max_basket_size: int, default = -1
      The maximum number of items of a basket to be retained.
      If `min_basket_size = -1`, all items will be included.
  
  min_basket_sequence: int, default = 1
      The minimum number of baskets of a user to be retained.
      If `min_basket_sequence = 1`, all baskets will be included.
  
  min_sequence_size: int, default = 1
      The minimum number of items of a sequence to be retained.
      If `min_sequence_size = 1`, all sequences will be included.
  
  max_sequence_size: int, default = -1
      The maximum number of items of a sequence to be retained.
      If `min_sequence_size = -1`, all sequences will be included.
  
  bin_threshold: float, default = None
      The rating threshold to binarize rating values (turn explicit feedback to implicit feedback).
      For example, if `bin_threshold = 3.0`, all rating values >= 3.0 will be set to 1.0,
      and the rest (< 3.0) will be discarded.
  
  encoding: str, default = `utf-8`
      Encoding used to decode the file.
  
  errors: int, default = None
      Optional string that specifies how encoding errors are to be handled.
      Pass 'strict' to raise a ValueError exception if there is an encoding error
      (None has the same effect), or pass 'ignore' to ignore errors.
docstr: Read data and parse line by line based on provided `fmt` or `parser`.
  
  Parameters
  ----------
  fpath: str
      Path to the data file.
  
  fmt: str, default: 'UIR'
      Line format to be parsed ('UI', 'UIR', 'UIRT', 'UITup', 'UIReview', 'UBI', 'UBIT', or 'UBITJson')
  
  sep: str, default: '    '
      The delimiter string.
  
  skip_lines: int, default: 0
      Number of first lines to skip
  
  id_inline: bool, default: False
      If `True`, user ids corresponding to the line numbers of the file,
      where all the ids in each line are item ids.
  
  parser: function, default: None
      Function takes a list of `str` tokenized by `sep` and
      returns a list of tuples which will be joined to the final results.
      If `None`, parser will be determined based on `fmt`.
  
  Returns
  -------
  tuples: list
      Data in the form of list of tuples. What inside each tuple
      depends on `parser` or `fmt`.
docstr_tok: ["Read","data","and","parse","line","by","line","based","on","provided","`","fmt","`","or","`","parser","`",".","Parameters","--","--","--","--","--","fpath",":","str","Path","to","the","data","file",".","fmt",":","str",",","default",":","'UIR'","Line","format","to","be","parsed","(","'UI","'",",","'UIR","'",",","'UIRT","'",",","'UITup","'",",","'UIReview","'",",","'UBI","'",",","'UBIT","'",",","or","'UBITJson","'",")","sep",":","str",",","default",":","'","'","The","delimiter","string",".","skip_lines",":","int",",","default",":","0","Number","of","first","lines","to","skip","id_inline",":","bool",",","default",":","False","If","`","True","`",",","user","ids","corresponding","to","the","line","numbers","of","the","file",",","where","all","the","ids","in","each","line","are","item","ids",".","parser",":","function",",","default",":","None","Function","takes","a","list","of","`","str","`","tokenized","by","`","sep","`","and","returns","a","list","of","tuples","which","will","be","joined","to","the","final","results",".","If","`","None","`",",","parser","will","be","determined","based","on","`","fmt","`",".","Returns","--","--","--","-","tuples",":","list","Data","in","the","form","of","list","of","tuples",".","What","inside","each","tuple","depends","on","`","parser","`","or","`","fmt","`","."]
code: def read(
      self,
      fpath,
      fmt="UIR",
      sep="\t",
      skip_lines=0,
      id_inline=False,
      parser=None,
      **kwargs,
  ):
      """Read data and parse line by line based on provided `fmt` or `parser`.
  
      Parameters
      ----------
      fpath: str
          Path to the data file.
  
      fmt: str, default: 'UIR'
          Line format to be parsed ('UI', 'UIR', 'UIRT', 'UITup', 'UIReview', 'UBI', 'UBIT', or 'UBITJson')
  
      sep: str, default: '\t'
          The delimiter string.
  
      skip_lines: int, default: 0
          Number of first lines to skip
  
      id_inline: bool, default: False
          If `True`, user ids corresponding to the line numbers of the file,
          where all the ids in each line are item ids.
  
      parser: function, default: None
          Function takes a list of `str` tokenized by `sep` and
          returns a list of tuples which will be joined to the final results.
          If `None`, parser will be determined based on `fmt`.
  
      Returns
      -------
      tuples: list
          Data in the form of list of tuples. What inside each tuple
          depends on `parser` or `fmt`.
  
      """
      parser = PARSERS.get(fmt, None) if parser is None else parser
      if parser is None:
          raise ValueError(
              "Invalid line format: {}\n"
              "Supported formats: {}".format(fmt, PARSERS.keys())
          )
  
      with open(fpath, encoding=self.encoding, errors=self.errors) as f:
          tuples = [
              tup
              for idx, line in enumerate(
                  itertools.islice(f, skip_lines, None)
              )
              for tup in parser(
                  line.strip().split(sep),
                  line_idx=idx,
                  id_inline=id_inline,
                  **kwargs,
              )
          ]
          tuples = self._filter(tuples=tuples, fmt=fmt)
          if fmt in {"UBI", "UBIT", "UBITJson"}:
              tuples = self._filter_basket(tuples=tuples, fmt=fmt)
          elif fmt in {"SIT", "SITJson", "USIT", "USITJson"}:
              tuples = self._filter_sequence(tuples=tuples, fmt=fmt)
          return tuples
  
imports: import ast
  import itertools
  from collections import Counter
label_desc: Use image node_id 5 for calling the Reader obj's underlying member method code with example usage: obj.read(fpath, fmt, sep, skip_lines, id_inline, parser) and returns: tuples