'Extract token counts out of raw text documents using the vocabulary
fitted with fit or the one provided in the constructor.
Parameters
raw_documents: iterable
an iterable which yields either str, unicode or file objects
Returns
vectors: sparse matrix, [n_samples, n_features]'

def transform(self, raw_documents):

    if ((not hasattr(self, 'vocabulary_')) or (len(self.vocabulary_) == 0)):
        raise ValueError("Vocabulary    wasn't    fitted    or    is    empty!")
    analyze = self.build_analyzer()
    term_counts_per_doc = [Counter(analyze(doc)) for doc in raw_documents]
    return self._term_count_dicts_to_matrix(term_counts_per_doc)
