class_docstr: Create a visualization of a semiotic square.  Requires Corpus to have
  at least three categories.
  >>> newsgroups_train = fetch_20newsgroups(subset='train',
  ...   remove=('headers', 'footers', 'quotes'))
  >>> vectorizer = CountVectorizer()
  >>> X = vectorizer.fit_transform(newsgroups_train.data)
  >>> corpus = st.CorpusFromScikit(
  ...         X=X,
  ...         y=newsgroups_train.target,
  ...         feature_vocabulary=vectorizer.vocabulary_,
  ...         category_names=newsgroups_train.target_names,
  ...         raw_texts=newsgroups_train.data
  ...         ).build()
  >>> semseq = SemioticSquare(corpus,
  ...         category_a = 'alt.atheism',
  ...         category_b = 'soc.religion.christian',
  ...         neutral_categories = ['talk.religion.misc']
  ... )
  >>> # A simple HTML table
  >>> html = SemioticSquareViz(semseq).to_html()
  >>> # The table with an interactive scatterplot below it
  >>> html = st.produce_semiotic_square_explorer(semiotic_square,
  ...                                            x_label='More Atheism, Less Xtnity',
  ...                                            y_label='General Religious Talk')
class_docstr_tok: ["Create","a","visualization","of","a","semiotic","square",".","Requires","Corpus","to","have","at","least","three","categories",".",">",">",">","newsgroups_train","=","fetch_20newsgroups","(","subset='train","'",",","...","remove=","(","'headers","'",",","'footers","'",",","'quotes","'",")",")",">",">",">","vectorizer","=","CountVectorizer","(",")",">",">",">","X","=","vectorizer.fit_transform","(","newsgroups_train.data",")",">",">",">","corpus","=","st.CorpusFromScikit","(","...","X=X",",","...","y=newsgroups_train.target",",","...","feature_vocabulary=vectorizer.vocabulary_",",","...","category_names=newsgroups_train.target_names",",","...","raw_texts=newsgroups_train.data","...",")",".build","(",")",">",">",">","semseq","=","SemioticSquare","(","corpus",",","...","category_a","=","'alt.atheism","'",",","...","category_b","=","'soc.religion.christian","'",",","...","neutral_categories","=","[","'talk.religion.misc","'","]","...",")",">",">",">","#","A","simple","HTML","table",">",">",">","html","=","SemioticSquareViz","(","semseq",")",".to_html","(",")",">",">",">","#","The","table","with","an","interactive","scatterplot","below","it",">",">",">","html","=","st.produce_semiotic_square_explorer","(","semiotic_square",",","...","x_label='More","Atheism",",","Less","Xtnity","'",",","...","y_label='General","Religious","Talk","'",")"]
docstr: Parameters
  ----------
  term_doc_matrix : TermDocMatrix
      TermDocMatrix (or descendant) which will be used in constructing square.
  category_a : str
      Category name for term A
  category_b : str
      Category name for term B (in opposition to A)
  neutral_categories : list[str]
      List of category names that A and B will be contrasted to.  Should be in same domain.
  labels : dict
      None by default. Labels are dictionary of {'a_and_b': 'A and B', ...} to be shown
      above each category.
  term_ranker : TermRanker
      Class for returning a term-frequency convention_df
  scorer : termscoring class, optional
      Term scoring class for lexicon mining. Default: `scattertext.termscoring.ScaledFScore`
docstr_tok: ["Parameters","--","--","--","--","--","term_doc_matrix",":","TermDocMatrix","TermDocMatrix","(","or","descendant",")","which","will","be","used","in","constructing","square",".","category_a",":","str","Category","name","for","term","A","category_b",":","str","Category","name","for","term","B","(","in","opposition","to","A",")","neutral_categories",":","list","[","str","]","List","of","category","names","that","A","and","B","will","be","contrasted","to",".","Should","be","in","same","domain",".","labels",":","dict","None","by","default",".","Labels","are","dictionary","of","{","'a_and_b","'",":","'","A","and","B","'",",","...","}","to","be","shown","above","each","category",".","term_ranker",":","TermRanker","Class","for","returning","a","term-frequency","convention_df","scorer",":","termscoring","class",",","optional","Term","scoring","class","for","lexicon","mining",".","Default",":","`","scattertext.termscoring.ScaledFScore","`"]
code: def __init__(
      self,
      term_doc_matrix,
      category_a,
      category_b,
      neutral_categories,
      labels=None,
      term_ranker=AbsoluteFrequencyRanker,
      scorer=None,
  ):
      """
      Parameters
      ----------
      term_doc_matrix : TermDocMatrix
          TermDocMatrix (or descendant) which will be used in constructing square.
      category_a : str
          Category name for term A
      category_b : str
          Category name for term B (in opposition to A)
      neutral_categories : list[str]
          List of category names that A and B will be contrasted to.  Should be in same domain.
      labels : dict
          None by default. Labels are dictionary of {'a_and_b': 'A and B', ...} to be shown
          above each category.
      term_ranker : TermRanker
          Class for returning a term-frequency convention_df
      scorer : termscoring class, optional
          Term scoring class for lexicon mining. Default: `scattertext.termscoring.ScaledFScore`
      """
      assert category_a in term_doc_matrix.get_categories()
      assert category_b in term_doc_matrix.get_categories()
      for category in neutral_categories:
          assert category in term_doc_matrix.get_categories()
      if len(neutral_categories) == 0:
          raise EmptyNeutralCategoriesError()
      self.category_a_ = category_a
      self.category_b_ = category_b
      self.neutral_categories_ = neutral_categories
      self._build_square(term_doc_matrix, term_ranker, labels, scorer)
  
imports: import numpy
  import pandas
  from scattertext.termranking import AbsoluteFrequencyRanker
  from scattertext.termscoring.RankDifference import RankDifference
label_desc: Use image node_id 1 to create a new SemioticSquare object from inherited base classes: SemioticSquareBase with example: obj = SemioticSquare(term_doc_matrix, category_a, category_b, neutral_categories, labels, term_ranker, scorer)