'Learn a list of feature name -> indices mappings.
Parameters
X : Mapping or iterable over Mappings
Dict(s) or Mapping(s) from feature names (arbitrary Python
objects) to feature values (strings or convertible to dtype).
y : (ignored)
Returns
self'

def fit(self, X, y=None):

    feature_names = []
    vocab = {}
    for x in X:
        for (f, v) in six.iteritems(x):
            if isinstance(v, six.string_types):
                f = ('%s%s%s' % (f, self.separator, v))
            if (f not in vocab):
                feature_names.append(f)
                vocab[f] = len(vocab)
    if self.sort:
        feature_names.sort()
        vocab = dict(((f, i) for (i, f) in enumerate(feature_names)))
    self.feature_names_ = feature_names
    self.vocabulary_ = vocab
    return self
