Update scattertext example code (#11937)

* Update scattertext example code

* Remove PMI Filter Threshold
This commit is contained in:
Paul O'Leary McCann 2022-12-07 18:09:04 +09:00 committed by GitHub
parent 27fac7df2e
commit 916191848a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 6 deletions

View File

@ -1468,13 +1468,26 @@
"image": "https://jasonkessler.github.io/2012conventions0.0.2.2.png",
"code_example": [
"import spacy",
"import scattertext as st",
"",
"nlp = spacy.load('en')",
"corpus = st.CorpusFromPandas(convention_df,",
" category_col='party',",
" text_col='text',",
" nlp=nlp).build()"
"from scattertext import SampleCorpora, produce_scattertext_explorer",
"from scattertext import produce_scattertext_html",
"from scattertext.CorpusFromPandas import CorpusFromPandas",
"",
"nlp = spacy.load('en_core_web_sm')",
"convention_df = SampleCorpora.ConventionData2012.get_data()",
"corpus = CorpusFromPandas(convention_df,",
" category_col='party',",
" text_col='text',",
" nlp=nlp).build()",
"",
"html = produce_scattertext_html(corpus,",
" category='democrat',",
" category_name='Democratic',",
" not_category_name='Republican',",
" minimum_term_frequency=5,",
" width_in_pixels=1000)",
"open('./simple.html', 'wb').write(html.encode('utf-8'))",
"print('Open ./simple.html in Chrome or Firefox.')"
],
"author": "Jason Kessler",
"author_links": {