code: def test_get_term_idx_and_x(self):
      docs = [whitespace_nlp("aa aa bb."), whitespace_nlp("bb aa a.")]
      df = pd.DataFrame({"category": ["a", "b"], "parsed": docs})
      # corpus_fact = CorpusFromParsedDocuments(convention_df, 'category', 'parsed')
      corpus_fact = CorpusFromParsedDocuments(
          df, category_col="category", parsed_col="parsed"
      )
      corpus = corpus_fact.build()
  
      kvs = list(corpus_fact._term_idx_store.items())
      keys = [k for k, v in kvs]
      values = [v for k, v in kvs]
      self.assertEqual(sorted(keys), list(range(7)))
      self.assertEqual(
          sorted(values),
          ["a", "aa", "aa a", "aa aa", "aa bb", "bb", "bb aa"],
      )
  
      def assert_word_in_doc_cnt(doc, word, count):
          self.assertEqual(
              corpus._X[doc, corpus._term_idx_store.getidx(word)], count
          )
  
      assert_word_in_doc_cnt(0, "aa", 2)
      assert_word_in_doc_cnt(0, "bb", 1)
      assert_word_in_doc_cnt(0, "aa aa", 1)
      assert_word_in_doc_cnt(0, "aa bb", 1)
      assert_word_in_doc_cnt(0, "bb aa", 0)
      assert_word_in_doc_cnt(1, "bb", 1)
      assert_word_in_doc_cnt(1, "aa", 1)
      assert_word_in_doc_cnt(1, "a", 1)
      assert_word_in_doc_cnt(1, "bb aa", 1)
      assert_word_in_doc_cnt(1, "aa aa", 0)
      assert_word_in_doc_cnt(1, "aa a", 1)
      self.assertTrue(isinstance(corpus, ParsedCorpus))
  
imports: import json
  import os
  import pkgutil
  import re
  from unittest import TestCase
  import numpy
  import pandas
  from scattertext.ParsedCorpus import ParsedCorpus
  from scattertext.CorpusFromParsedDocuments import CorpusFromParsedDocuments
  from scattertext.WhitespaceNLP import whitespace_nlp
  from scattertext.TermDocMatrixFactory import TermDocMatrixFactory
  from scattertext.test.test_TermDocMat import get_hamlet_docs, get_hamlet_snippet_binary_category
  from scattertext.test.test_corpusFromPandas import get_docs_categories
label_desc: Use image node_id 5 for calling the TestCorpusFromParsedDocuments obj's underlying member method code with example usage: obj.test_get_term_idx_and_x() without return types