def compact_to_bow(self, word_compact, max_compact_index=None):
        if max_compact_index is None:
            max_compact_index = word_compact.max()

        def bincount(x):
            return np.bincount(x, minlength=max_compact_index + 1)
        axis = len(word_compact.shape) - 1
        bow = np.apply_along_axis(bincount, axis, word_compact)
        return bow
Given a 2D array of compact indices, return the bag of words
dataset/ETHPy150Open cemoody/lda2vec/lda2vec/corpus.py/Corpus.compact_to_bow