class_docstr: Create a ``FeatureSet`` instance from a LibSVM/LibLinear/SVMLight file.
  
  We use a specially formatted comment for storing example IDs, class names,
  and feature names, which are normally not supported by the format.  The
  comment is not mandatory, but without it, your labels and features will
  not have names.  The comment is structured as follows::
  
      ExampleID | 1=FirstClass | 1=FirstFeature 2=SecondFeature
  
  Parameters
  ----------
  path_or_list : Union[:class:`skll.types.PathOrStr`, List[Dict[str, Any]]
      Path or a list of example dictionaries.
  
  quiet : bool, default=True
      Do not print "Loading..." status message to stderr.
  
  ids_to_floats : bool, default=False
      Convert IDs to float to save memory. Will raise error
      if we encounter an a non-numeric ID.
  
  label_col : Optional[str], default='y'
      Name of the column which contains the class labels
      for ARFF/CSV/TSV files. If no column with that name
      exists, or ``None`` is specified, the data is
      considered to be unlabelled.
  
  id_col : str, default='id'
      Name of the column which contains the instance IDs.
      If no column with that name exists, or ``None`` is
      specified, example IDs will be automatically generated.
  
  class_map : Optional[:class:`skll.types.ClassMap`], default=None
      Mapping from original class labels to new ones. This is
      mainly used for collapsing multiple labels into a single
      class. Anything not in the mapping will be kept the same.
      The keys are the new labels and the list of values for each
      key is the labels to be collapsed to said new label.
  
  sparse : bool, default=True
      Whether or not to store the features in a numpy CSR
      matrix when using a DictVectorizer to vectorize the
      features.
  
  feature_hasher : bool, default=False
      Whether or not a FeatureHasher should be used to
      vectorize the features.
  
  num_features : Optional[int], default=None
      If using a FeatureHasher, how many features should the
      resulting matrix have?  You should set this to a power
      of 2 greater than the actual number of features to
      avoid collisions.
  
  logger : Optional[logging.Logger], default=None
      A logger instance to use to log messages instead of creating
      a new one by default.
class_docstr_tok: ["Create","a","``","FeatureSet","``","instance","from","a","LibSVM\/LibLinear\/SVMLight","file",".","We","use","a","specially","formatted","comment","for","storing","example","IDs",",","class","names",",","and","feature","names",",","which","are","normally","not","supported","by","the","format",".","The","comment","is","not","mandatory",",","but","without","it",",","your","labels","and","features","will","not","have","names",".","The","comment","is","structured","as","follows",":",":","ExampleID","|","1=FirstClass","|","1=FirstFeature","2=SecondFeature","Parameters","--","--","--","--","--","path_or_list",":","Union","[",":","class",":","`","skll.types.PathOrStr","`",",","List","[","Dict","[","str",",","Any","]","]","Path","or","a","list","of","example","dictionaries",".","quiet",":","bool",",","default=True","Do","not","print","``","Loading","...","''","status","message","to","stderr",".","ids_to_floats",":","bool",",","default=False","Convert","IDs","to","float","to","save","memory",".","Will","raise","error","if","we","encounter","an","a","non-numeric","ID",".","label_col",":","Optional","[","str","]",",","default=","'","y'","Name","of","the","column","which","contains","the","class","labels","for","ARFF\/CSV\/TSV","files",".","If","no","column","with","that","name","exists",",","or","``","None","``","is","specified",",","the","data","is","considered","to","be","unlabelled",".","id_col",":","str",",","default='id'","Name","of","the","column","which","contains","the","instance","IDs",".","If","no","column","with","that","name","exists",",","or","``","None","``","is","specified",",","example","IDs","will","be","automatically","generated",".","class_map",":","Optional","[",":","class",":","`","skll.types.ClassMap","`","]",",","default=None","Mapping","from","original","class","labels","to","new","ones",".","This","is","mainly","used","for","collapsing","multiple","labels","into","a","single","class",".","Anything","not","in","the","mapping","will","be","kept","the","same",".","The","keys","are","the","new","labels","and","the","list","of","values","for","each","key","is","the","labels","to","be","collapsed","to","said","new","label",".","sparse",":","bool",",","default=True","Whether","or","not","to","store","the","features","in","a","numpy","CSR","matrix","when","using","a","DictVectorizer","to","vectorize","the","features",".","feature_hasher",":","bool",",","default=False","Whether","or","not","a","FeatureHasher","should","be","used","to","vectorize","the","features",".","num_features",":","Optional","[","int","]",",","default=None","If","using","a","FeatureHasher",",","how","many","features","should","the","resulting","matrix","have","?","You","should","set","this","to","a","power","of","2","greater","than","the","actual","number","of","features","to","avoid","collisions",".","logger",":","Optional","[","logging.Logger","]",",","default=None","A","logger","instance","to","use","to","log","messages","instead","of","creating","a","new","one","by","default","."]
docstr: Split feature-value pair separated by a colon into tuple.
  
  Also perform `safe_float` conversion on the value.
  
  Parameters
  ----------
  pair: str
      A feature-value pair to split.
  feat_map : Dict[str, str]
      Feature name mapping.
  
  Returns
  -------
  name : str
      The name of the feature.
  value : Union[float, int, str]
      The value of the example.
docstr_tok: ["Split","feature-value","pair","separated","by","a","colon","into","tuple",".","Also","perform","`","safe_float","`","conversion","on","the","value",".","Parameters","--","--","--","--","--","pair",":","str","A","feature-value","pair","to","split",".","feat_map",":","Dict","[","str",",","str","]","Feature","name","mapping",".","Returns","--","--","--","-","name",":","str","The","name","of","the","feature",".","value",":","Union","[","float",",","int",",","str","]","The","value","of","the","example","."]
code: def _pair_to_tuple(
      pair: str, feat_map: Dict[str, str]
  ) -> Tuple[str, Union[float, int, str]]:
      """
      Split feature-value pair separated by a colon into tuple.
  
      Also perform `safe_float` conversion on the value.
  
      Parameters
      ----------
      pair: str
          A feature-value pair to split.
      feat_map : Dict[str, str]
          Feature name mapping.
  
      Returns
      -------
      name : str
          The name of the feature.
      value : Union[float, int, str]
          The value of the example.
      """
      name, value = pair.split(":")
      if feat_map is not None:
          ret_name = feat_map[name]
      ret_value = safe_float(value)
      return (ret_name, ret_value)
  
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 1 for calling the LibSVMReader obj's underlying member method code with example usage: obj._pair_to_tuple(pair, feat_map) and returns: ret_name,  ret_value