def get_doc_metadata(self, doc, prefix=''):
        '''

        :param doc: spacy.Doc
        :param prefix: str, default is ''
        :return: pd.Series
        '''
        out_series = pd.merge(
            pd.DataFrame(pd.Series([tok.lemma_ if self._use_lemmas else tok.lower_
                                    for tok in doc]).value_counts(), columns=['count']),
            self._lexicon_df, left_index=True, right_index=True
        ).drop(columns=['count']).mean(axis=0)
        if prefix == '':
            return out_series
        return pd.Series(out_series.values, index=[prefix + x for x in out_series.index])


        :param doc: spacy.Doc
        :param prefix: str, default is ''
        :return: pd.Series
        
scattertext/features/FeatsFromScoredLexicon.py