'Transform feature->value dicts to array or sparse matrix.
Named features not encountered during fit or fit_transform will be
silently ignored.
Parameters
X : Mapping or iterable over Mappings, length = n_samples
Dict(s) or Mapping(s) from feature names (arbitrary Python
objects) to feature values (strings or convertible to dtype).
Returns
Xa : {array, sparse matrix}
Feature vectors; always 2-d.'

def transform(self, X):

    if self.sparse:
        return self._transform(X, fitting=False)
    else:
        dtype = self.dtype
        vocab = self.vocabulary_
        X = _tosequence(X)
        Xa = np.zeros((len(X), len(vocab)), dtype=dtype)
        for (i, x) in enumerate(X):
            for (f, v) in six.iteritems(x):
                if isinstance(v, six.string_types):
                    f = ('%s%s%s' % (f, self.separator, v))
                    v = 1
                try:
                    Xa[(i, vocab[f])] = dtype(v)
                except KeyError:
                    pass
        return Xa
