'Transform documents to document-term matrix.
Extract token counts out of raw text documents using the vocabulary
fitted with fit or the one provided to the constructor.
Parameters
raw_documents : iterable
An iterable which yields either str, unicode or file objects.
Returns
X : sparse matrix, [n_samples, n_features]
Document-term matrix.'

def transform(self, raw_documents):

    if isinstance(raw_documents, six.string_types):
        raise ValueError(u'Iterable    over    raw    text    documents    expected,    string    object    received.')
    if (not hasattr(self, u'vocabulary_')):
        self._validate_vocabulary()
    self._check_vocabulary()
    (_, X) = self._count_vocab(raw_documents, fixed_vocab=True)
    if self.binary:
        X.data.fill(1)
    return X
