def search(self, ngram, non_text: bool=False):
        '''
        Parameters
        ----------
        ngram str or unicode, string to search for

        Returns
        -------
        pd.DataFrame, {'texts': <matching texts>, 'categories': <corresponding categories>}

        '''
        mask = self._document_index_mask(ngram, non_text=non_text)
        return pd.DataFrame({
            'text': self.get_texts()[mask],
            'category': [self._category_idx_store.getval(idx)
                         for idx in self._y[mask]]
        })

        Parameters
        ----------
        ngram str or unicode, string to search for

        Returns
        -------
        pd.DataFrame, {'texts': <matching texts>, 'categories': <corresponding categories>}

        
scattertext/Corpus.py