def produce_characteristic_explorer(corpus,
                                    category,
                                    category_name=None,
                                    not_category_name=None,
                                    not_categories=None,
                                    characteristic_scorer=DenseRankCharacteristicness(),
                                    term_ranker=termranking.AbsoluteFrequencyRanker,
                                    term_scorer=RankDifference(),
                                    **kwargs):
    '''
    Parameters
    ----------
    corpus : Corpus
        It is highly recommended to use a stoplisted, unigram corpus-- `corpus.get_stoplisted_unigram_corpus()`
    category : str
    category_name : str
    not_category_name : str
    not_categories : list
    characteristic_scorer : CharacteristicScorer
    term_ranker
    term_scorer
    term_acceptance_re : SRE_Pattern
        Regular expression to identify valid terms
    kwargs : dict
        remaining produce_scattertext_explorer keywords

    Returns
    -------
    str HTML of visualization

    '''
    if not_categories is None:
        not_categories = [c for c in corpus.get_categories() if c != category]

    category_name, not_category_name = get_category_names(
        category, category_name, not_categories, not_category_name)

    zero_point, characteristic_scores = characteristic_scorer.get_scores(corpus)
    corpus = corpus.remove_terms(set(corpus.get_terms()) - set(characteristic_scores.index))
    characteristic_scores = characteristic_scores.loc[corpus.get_terms()]
    term_freq_df = term_ranker(corpus).get_ranks()
    scores = term_scorer.get_scores(
        term_freq_df[category + ' freq'],
        term_freq_df[[c + ' freq' for c in not_categories]].sum(axis=1)
    )
    kwargs['scores'] = kwargs.get('scores', scores)
    max_score = np.floor(np.max(kwargs['scores']) * 100) / 100
    min_score = np.ceil(np.min(kwargs['scores']) * 100) / 100
    if min_score < 0 and max_score > 0:
        central = 0
    else:
        central = 0.5
    scores_scaled_for_charting = scale_neg_1_to_1_with_zero_mean_abs_max(kwargs['scores'])
    html = produce_scattertext_explorer(
        corpus=corpus,
        category=category,
        category_name=category_name,
        not_category_name=not_category_name,
        not_categories=not_categories,
        minimum_term_frequency=0,
        sort_by_dist=False,
        x_coords=characteristic_scores,
        y_coords=scores_scaled_for_charting,
        y_axis_labels=kwargs.get('y_axis_labels',
                                 ['More ' + not_category_name,
                                  'Even',
                                  'More ' + category_name]),
        x_label=kwargs.get('x_label', 'Characteristic to Corpus'),
        y_label=kwargs.get('y_label', term_scorer.get_name()),
        vertical_lines=kwargs.get('vertical_lines', []),
        characteristic_scorer=kwargs.get('characteristic_scorer', characteristic_scorer),
        **kwargs
    )
    return html
def produce_characteristic_explorer ( corpus , category , category_name = None , not_category_name = None , not_categories = None , characteristic_scorer = DenseRankCharacteristicness ( ) , term_ranker = termranking . AbsoluteFrequencyRanker , term_scorer = RankDifference ( ) , ** kwargs ) : if not_categories is None : not_categories = [ c for c in corpus . get_categories ( ) if c != category ] category_name , not_category_name = get_category_names ( category , category_name , not_categories , not_category_name ) zero_point , characteristic_scores = characteristic_scorer . get_scores ( corpus ) corpus = corpus . remove_terms ( set ( corpus . get_terms ( ) ) - set ( characteristic_scores . index ) ) characteristic_scores = characteristic_scores . loc [ corpus . get_terms ( ) ] term_freq_df = term_ranker ( corpus ) . get_ranks ( ) scores = term_scorer . get_scores ( term_freq_df [ category + ' freq' ] , term_freq_df [ [ c + ' freq' for c in not_categories ] ] . sum ( axis = 1 ) ) kwargs [ 'scores' ] = kwargs . get ( 'scores' , scores ) max_score = np . floor ( np . max ( kwargs [ 'scores' ] ) * 100 ) / 100 min_score = np . ceil ( np . min ( kwargs [ 'scores' ] ) * 100 ) / 100 if min_score < 0 and max_score > 0 : central = 0 else : central = 0.5 scores_scaled_for_charting = scale_neg_1_to_1_with_zero_mean_abs_max ( kwargs [ 'scores' ] ) html = produce_scattertext_explorer ( corpus = corpus , category = category , category_name = category_name , not_category_name = not_category_name , not_categories = not_categories , minimum_term_frequency = 0 , sort_by_dist = False , x_coords = characteristic_scores , y_coords = scores_scaled_for_charting , y_axis_labels = kwargs . get ( 'y_axis_labels' , [ 'More ' + not_category_name , 'Even' , 'More ' + category_name ] ) , x_label = kwargs . get ( 'x_label' , 'Characteristic to Corpus' ) , y_label = kwargs . get ( 'y_label' , term_scorer . get_name ( ) ) , vertical_lines = kwargs . get ( 'vertical_lines' , [ ] ) , characteristic_scorer = kwargs . get ( 'characteristic_scorer' , characteristic_scorer ) , ** kwargs ) return html
Parameters
    ----------
    corpus : Corpus
        It is highly recommended to use a stoplisted, unigram corpus-- `corpus.get_stoplisted_unigram_corpus()`
    category : str
    category_name : str
    not_category_name : str
    not_categories : list
    characteristic_scorer : CharacteristicScorer
    term_ranker
    term_scorer
    term_acceptance_re : SRE_Pattern
        Regular expression to identify valid terms
    kwargs : dict
        remaining produce_scattertext_explorer keywords

    Returns
    -------
    str HTML of visualization