code: def test_hamlet(self):
      raw_docs = get_hamlet_docs()
      categories = [
          get_hamlet_snippet_binary_category(doc) for doc in raw_docs
      ]
      docs = [whitespace_nlp(doc) for doc in raw_docs]
      df = pd.DataFrame({"category": categories, "parsed": docs})
      corpus_fact = CorpusFromParsedDocuments(df, "category", "parsed")
      corpus = corpus_fact.build()
      tdf = corpus.get_term_freq_df()
      self.assertEqual(list(tdf.loc["play"]), [37, 5])
      self.assertFalse(
          any(
              corpus.search("play").apply(
                  lambda x: "plfay" in str(x["parsed"]), axis=1
              )
          )
      )
      self.assertTrue(
          all(
              corpus.search("play").apply(
                  lambda x: "play" in str(x["parsed"]), axis=1
              )
          )
      )
  
      # !!! to do verify term doc matrix
      play_term_idx = corpus_fact._term_idx_store.getidx("play")
      play_X = corpus._X.todok()[:, play_term_idx]
  
      self.assertEqual(play_X.sum(), 37 + 5)
  
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 6 for calling the TestCorpusFromParsedDocuments obj's underlying member method code with example usage: obj.test_hamlet() without return types