def transform(self, Z):
if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>self._validate_vocabulary()<EOL><DEDENT>self._check_vocabulary()<EOL>analyze = self.build_analyzer()<EOL>mapper = self.broadcast(self._count_vocab, Z.context)<EOL>Z = Z.transform(lambda X: list(map(analyze, X)), column='<STR_LIT:X>').transform(mapper, column='<STR_LIT:X>', dtype=sp.spmatrix)<EOL>return Z<EOL>
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.