Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JasonKessler/0413027fe9177524b75d4eadf2d31242 to your computer and use it in GitHub Desktop.
Save JasonKessler/0413027fe9177524b75d4eadf2d31242 to your computer and use it in GitHub Desktop.
four_square_corpus_phrases = (st.CorpusFromParsedDocuments(reviews_df, category_col = 'category', parsed_col = 'parse',
feats_from_spacy_doc=st.PhraseMachinePhrases())
.build().compact(st.ClassPercentageCompactor(term_count=1)))
four_square_axes = st.FourSquareAxes(four_square_corpus_phrases,
left_categories=['Accept, Positive'],
right_categories=['Accept, Negative'],
top_categories=['Reject, Positive'],
bottom_categories=['Reject, Negative'],
labels = {'a': 'Positive',
'b': 'Review that was Contrary to Accpetance Decision',
'not_a': 'Negative',
'not_b': 'Review that in Line With Acceptance Decision'},
term_ranker=st.OncePerDocFrequencyRanker)
html = st.produce_four_square_axes_explorer(
four_square_axes=four_square_axes,
x_label="Accepts: Pos-Neg",
y_label='Rejects: Neg-Pos',
use_full_doc=True,
pmi_threshold_coefficient=0,
censor_points=False,
metadata=four_square_corpus_phrases.get_df()['metadata'],
color_func='(function(d) {return d3.rgb(230, 220, 230)})',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment