class_docstr: Convert a collection of raw documents to a document id matrix.
  
  Attributes:
      _use_char: boolean. Whether to use char feature.
      _num_norm: boolean. Whether to normalize text.
      _word_vocab: dict. A mapping of words to feature indices.
      _char_vocab: dict. A mapping of chars to feature indices.
      _label_vocab: dict. A mapping of labels to feature indices.
class_docstr_tok: ["Convert","a","collection","of","raw","documents","to","a","document","id","matrix",".","Attributes",":","_use_char",":","boolean",".","Whether","to","use","char","feature",".","_num_norm",":","boolean",".","Whether","to","normalize","text",".","_word_vocab",":","dict",".","A","mapping","of","words","to","feature","indices",".","_char_vocab",":","dict",".","A","mapping","of","chars","to","feature","indices",".","_label_vocab",":","dict",".","A","mapping","of","labels","to","feature","indices","."]
docstr: Learn vocabulary from training set.
  
  Args:
      X : iterable. An iterable which yields either str, unicode or file objects.
  
  Returns:
      self : IndexTransformer.
docstr_tok: ["Learn","vocabulary","from","training","set",".","Args",":","X",":","iterable",".","An","iterable","which","yields","either","str",",","unicode","or","file","objects",".","Returns",":","self",":","IndexTransformer","."]
code: def fit(self, X, y):
      """Learn vocabulary from training set.
  
      Args:
          X : iterable. An iterable which yields either str, unicode or file objects.
  
      Returns:
          self : IndexTransformer.
      """
      self._word_vocab.add_documents(X)
      self._label_vocab.add_documents(y)
      if self._use_char:
          for doc in X:
              self._char_vocab.add_documents(doc)
  
      self._word_vocab.build()
      self._char_vocab.build()
      self._label_vocab.build()
  
      return self
  
imports: import re
  import numpy
  from allennlp.modules.elmo import Elmo, batch_to_ids
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.externals import joblib
  from keras.utils.np_utils import to_categorical
  from keras.preprocessing.sequence import pad_sequences
  from anago.utils import Vocabulary
label_desc: Use image node_id 2 for calling the IndexTransformer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self