class_docstr: Default encoder class with inbuilt function for decoding text that
  has been encoded by the same object. Also supports label encoding.
  Can be used as a skeleton to build more sophisticated encoders on top.
class_docstr_tok: ["Default","encoder","class","with","inbuilt","function","for","decoding","text","that","has","been","encoded","by","the","same","object",".","Also","supports","label","encoding",".","Can","be","used","as","a","skeleton","to","build","more","sophisticated","encoders","on","top","."]
docstr: Uses the default label encoder to encode labels into vector form.
  
  Arguments:
      y_str {Iterable over str} -- array-like w. label names as elements
  
  Keyword Arguments:
      needs_fit {bool} -- Does the label encoder need training.
      (default: {True})
  
  Returns:
      [List with 2 components] --
      * y_vec -- The labels vectorized and encoded to numeric form.
      * self.labelEncoder -- trained label encoder object.
docstr_tok: ["Uses","the","default","label","encoder","to","encode","labels","into","vector","form",".","Arguments",":","y_str","{","Iterable","over","str","}","--","array-like","w.","label","names","as","elements","Keyword","Arguments",":","needs_fit","{","bool","}","--","Does","the","label","encoder","need","training",".","(","default",":","{","True","}",")","Returns",":","[","List","with","2","components","]","--","*","y_vec","--","The","labels","vectorized","and","encoded","to","numeric","form",".","*","self.labelEncoder","--","trained","label","encoder","object","."]
code: def encode_labels(self, y_str, needs_fit=True):
      """Uses the default label encoder to encode labels into vector form.
  
      Arguments:
          y_str {Iterable over str} -- array-like w. label names as elements
  
      Keyword Arguments:
          needs_fit {bool} -- Does the label encoder need training.
          (default: {True})
  
      Returns:
          [List with 2 components] --
          * y_vec -- The labels vectorized and encoded to numeric form.
          * self.labelEncoder -- trained label encoder object.
      """
      y_str = np.asarray(y_str[:]).reshape(-1, 1)
      if needs_fit is True:
          y_vec = self.labelEncoder.fit_transform(y_str)
      else:
          y_vec = self.labelEncoder.transform(y_str)
      return [y_vec, self.labelEncoder]
  
file_path: interpret-text/python/interpret_text/experimental/common/utils_classical.py
imports: import spacy
  import html
  import string
  import numpy
  import matplotlib.pyplot
  from sklearn.preprocessing import LabelEncoder
  from IPython.core.display import display, HTML
  from sklearn.feature_extraction.text import CountVectorizer
label_desc: Use image node_id 3 for calling the BOWEncoder obj's underlying member method code with example usage: obj.encode_labels(y_str, needs_fit) and returns: list