repo_description: Beautiful visualizations of how language differs among document types.
repo_topics: computational-social-science d3 eda exploratory-data-analysis japanese-language machine-learning natural-language-processing nlp scatter-plot semiotic-squares sentiment stylometric stylometry text-as-data text-mining text-visualization topic-modeling visualization word-embeddings word2vec
code: import scattertext as st
  
  df = st.SampleCorpora.ConventionData2012.get_data().assign(
      parse=lambda df: df.text.apply(st.whitespace_nlp_with_sentences)
  )
  
  corpus = st.CorpusFromParsedDocuments(
      df, category_col='party', parsed_col='parse'
  ).build().get_unigram_corpus()
  
  html = st.produce_scattertext_explorer(
      corpus,
      category='democrat',
      category_name='Democratic',
      not_category_name='Republican',
      minimum_term_frequency=0, pmi_threshold_coefficient=0,
      width_in_pixels=1000, metadata=corpus.get_df()['speaker'],
      transform=st.Scalers.percentile_dense,
      show_diagonal=True,
      max_overlapping=3
  )
  open('./demo_log_scale.html', 'w').write(html)
  print('open ./demo_log_scale.html in Chrome')
  