import numpy as np
from gensim import matutils
from gensim.corpora import Dictionary


class BaseVectorizer:
    """Base class for vectorization objects. """
    name = NotImplemented

    def transform(self, corpus, copy=True):
        """Transforms a corpus to a new one with additional attributes. """
        if copy:
            corpus = corpus.copy()
        if not len(corpus.dictionary):
            return corpus
        else:
            return self._transform(corpus)

    def _transform(self, corpus):
        raise NotImplementedError

    def report(self):
        """Reports configuration items."""
        raise NotImplementedError

    @staticmethod
    def add_features(corpus, X, dictionary):
        order = np.argsort([dictionary[i] for i in range(len(dictionary))])
        corpus.extend_attributes(X[:, order], feature_names=(dictionary[i] for
            i in order), var_attrs={'hidden': True})
        corpus.ngrams_corpus = matutils.Sparse2Corpus(X.T)

c63ee30c49c9c63fbd6d77919e00a2fb4806383c
<mask token>


class BaseVectorizer:
    <mask token>
    <mask token>
    <mask token>

    def _transform(self, corpus):
        raise NotImplementedError

    def report(self):
        """Reports configuration items."""
        raise NotImplementedError

    @staticmethod
    def add_features(corpus, X, dictionary):
        order = np.argsort([dictionary[i] for i in range(len(dictionary))])
        corpus.extend_attributes(X[:, order], feature_names=(dictionary[i] for
            i in order), var_attrs={'hidden': True})
        corpus.ngrams_corpus = matutils.Sparse2Corpus(X.T)

<mask token>


class BaseVectorizer:
    <mask token>
    <mask token>

    def transform(self, corpus, copy=True):
        """Transforms a corpus to a new one with additional attributes. """
        if copy:
            corpus = corpus.copy()
        if not len(corpus.dictionary):
            return corpus
        else:
            return self._transform(corpus)

    def _transform(self, corpus):
        raise NotImplementedError

    def report(self):
        """Reports configuration items."""
        raise NotImplementedError

    @staticmethod
    def add_features(corpus, X, dictionary):
        order = np.argsort([dictionary[i] for i in range(len(dictionary))])
        corpus.extend_attributes(X[:, order], feature_names=(dictionary[i] for
            i in order), var_attrs={'hidden': True})
        corpus.ngrams_corpus = matutils.Sparse2Corpus(X.T)

<mask token>


class BaseVectorizer:
    <mask token>
    name = NotImplemented

    def transform(self, corpus, copy=True):
        """Transforms a corpus to a new one with additional attributes. """
        if copy:
            corpus = corpus.copy()
        if not len(corpus.dictionary):
            return corpus
        else:
            return self._transform(corpus)

    def _transform(self, corpus):
        raise NotImplementedError

    def report(self):
        """Reports configuration items."""
        raise NotImplementedError

    @staticmethod
    def add_features(corpus, X, dictionary):
        order = np.argsort([dictionary[i] for i in range(len(dictionary))])
        corpus.extend_attributes(X[:, order], feature_names=(dictionary[i] for
            i in order), var_attrs={'hidden': True})
        corpus.ngrams_corpus = matutils.Sparse2Corpus(X.T)

import numpy as np
from gensim import matutils
from gensim.corpora import Dictionary


class BaseVectorizer:
    """Base class for vectorization objects. """
    name = NotImplemented

    def transform(self, corpus, copy=True):
        """Transforms a corpus to a new one with additional attributes. """
        if copy:
            corpus = corpus.copy()
        if not len(corpus.dictionary):
            return corpus
        else:
            return self._transform(corpus)

    def _transform(self, corpus):
        raise NotImplementedError

    def report(self):
        """Reports configuration items."""
        raise NotImplementedError

    @staticmethod
    def add_features(corpus, X, dictionary):
        order = np.argsort([dictionary[i] for i in range(len(dictionary))])
        corpus.extend_attributes(X[:, order], feature_names=(dictionary[i] for
            i in order), var_attrs={'hidden': True})
        corpus.ngrams_corpus = matutils.Sparse2Corpus(X.T)
