class_docstr: Create a ``FeatureSet`` instance from an ARFF file.
  
  If example/instance IDs are included in the files, they
  must be specified in the ``id`` column.
  Also, there must be a column with the name specified by ``label_col`` if the
  data is labeled, and this column must be the final one (as it is in Weka).
  
  Parameters
  ----------
  path_or_list : Union[:class:`skll.types.PathOrStr`, List[Dict[str, Any]]]
      The path to the ARFF file.
  
  kwargs : Optional[Dict[str, Any]]
      Other arguments to the Reader object.
class_docstr_tok: ["Create","a","``","FeatureSet","``","instance","from","an","ARFF","file",".","If","example\/instance","IDs","are","included","in","the","files",",","they","must","be","specified","in","the","``","id","``","column",".","Also",",","there","must","be","a","column","with","the","name","specified","by","``","label_col","``","if","the","data","is","labeled",",","and","this","column","must","be","the","final","one","(","as","it","is","in","Weka",")",".","Parameters","--","--","--","--","--","path_or_list",":","Union","[",":","class",":","`","skll.types.PathOrStr","`",",","List","[","Dict","[","str",",","Any","]","]","]","The","path","to","the","ARFF","file",".","kwargs",":","Optional","[","Dict","[","str",",","Any","]","]","Other","arguments","to","the","Reader","object","."]
docstr: Parse rows of ARFF file.
  
  Parameters
  ----------
  file : IO[str]
      A file buffer for the ARFF file.
  
  Yields
  ------
  curr_id : :class:`skll.types.IdType`
      The current ID for the example.
  
  class_name : :class:`skll.types.LabelType`
      The name of the class label for the example.
  
  example : :class:`skll.types.FeatureDict`
      The example features in dictionary format.
docstr_tok: ["Parse","rows","of","ARFF","file",".","Parameters","--","--","--","--","--","file",":","IO","[","str","]","A","file","buffer","for","the","ARFF","file",".","Yields","--","--","--","curr_id",":",":","class",":","`","skll.types.IdType","`","The","current","ID","for","the","example",".","class_name",":",":","class",":","`","skll.types.LabelType","`","The","name","of","the","class","label","for","the","example",".","example",":",":","class",":","`","skll.types.FeatureDict","`","The","example","features","in","dictionary","format","."]
code: def _sub_read(self, file: IO[str]) -> FeatGenerator:
      """
      Parse rows of ARFF file.
  
      Parameters
      ----------
      file : IO[str]
          A file buffer for the ARFF file.
  
      Yields
      ------
      curr_id : :class:`skll.types.IdType`
          The current ID for the example.
  
      class_name : :class:`skll.types.LabelType`
          The name of the class label for the example.
  
      example : :class:`skll.types.FeatureDict`
          The example features in dictionary format.
      """
      field_names = []
      # Process ARFF header
      for line in file:
          # Process encoding
          if not isinstance(line, str):
              decoded_line = UnicodeDammit(
                  line, ["utf-8", "windows-1252"]
              ).unicode_markup
          else:
              decoded_line = line
          line = decoded_line.strip()
          # Skip empty lines
          if line:
              # Split the line using CSV reader because it can handle
              # quoted delimiters.
              split_header = self.split_with_quotes(line)
              row_type = split_header[0].lower()
              if row_type == "@attribute":
                  # Add field name to list
                  field_name = split_header[1]
                  field_names.append(field_name)
                  # Check if we're doing regression
                  if field_name == self.label_col:
                      self.regression = (
                          len(split_header) > 2
                          and split_header[2] == "numeric"
                      )
              # Save relation if specified
              elif row_type == "@relation":
                  self.relation = split_header[1]
              # Stop at data
              elif row_type == "@data":
                  break
              # Skip other types of rows (relations)
  
      # Create header for CSV
      io_type = StringIO
      with io_type() as field_buffer:
          csv.writer(field_buffer, dialect="arff").writerow(field_names)
          field_str = field_buffer.getvalue()
  
      # Set label_col to be the name of the last field, since that's standard
      # for ARFF files
      if self.label_col != field_names[-1]:
          self.label_col = None
  
      # Process iterator as a CSV file
      csv_file_buffer = chain([field_str], file)
      reader = csv.DictReader(csv_file_buffer, dialect=self.dialect)
      for example_num, row in enumerate(reader):
          if self.label_col is not None and self.label_col in row:
              class_name = safe_float(
                  row[self.label_col], replace_dict=self.class_map
              )
              del row[self.label_col]
          else:
              class_name = None
  
          if self.id_col not in row:
              curr_id = f"EXAMPLE_{example_num}"
          else:
              curr_id = row[self.id_col]
              del row[self.id_col]
  
          # Convert features to floats and if a feature is 0
          # then store the name of the feature so we can
          # delete it later since we don't need to explicitly
          # store zeros in the feature hash
          columns_to_delete = []
          for fname, fval in row.items():
              fval_float = safe_float(fval)
              # we don't need to explicitly store zeros
              if fval_float:
                  row[fname] = fval_float
              else:
                  columns_to_delete.append(fname)
  
          # remove the columns with zero values
          for cname in columns_to_delete:
              del row[cname]
  
          yield curr_id, class_name, row
  
imports: import csv
  import json
  import logging
  import re
  import sys
  from io import StringIO
  from itertools import chain
  from numbers import Number
  from pathlib import Path
  from typing import IO, Any, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  from bs4 import UnicodeDammit
  from sklearn.feature_extraction import FeatureHasher
  from skll.data import FeatureSet
  from skll.data.dict_vectorizer import DictVectorizer
  from skll.types import ClassMap, FeatGenerator, FeatureDictList, IdType, LabelType, PathOrStr
label_desc: Use image node_id 3 for calling the ARFFReader obj's underlying member method code with example usage: obj._sub_read(file) without return types