class_docstr: Test the text utilities for creating and cleaning features.
class_docstr_tok: ["Test","the","text","utilities","for","creating","and","cleaning","features","."]
docstr: Check correctness of the tf-idf mapping.
docstr_tok: ["Check","correctness","of","the","tf-idf","mapping","."]
code: def test_tf_idf(self):
      """
      Check correctness of the tf-idf mapping.
      """
      # Use the example on wikipedia
      tfidf_docs = text_analytics.tf_idf(self.docs)
  
      self.assertAlmostEqual(tfidf_docs[1]["example"], 3 * math.log(2))
      self.assertAlmostEqual(tfidf_docs[0]["is"], 1 * math.log(1))
  
      empty_sa = text_analytics.tf_idf(tc.SArray())
      self.assertEqual(len(empty_sa), 0)
  
      empty_dict_sf = text_analytics.tf_idf(tc.SArray([{}]))
      assert len(empty_dict_sf) == 1
      assert len(empty_dict_sf.apply(lambda x: len(x) == 0)) == 1
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import math
  import unittest
  import warnings
  import turicreate
  import turicreate.toolkits.text_analytics
  from .None import util
label_desc: Use image node_id 7 for calling the FeatureEngineeringTest obj's underlying member method code with example usage: obj.test_tf_idf() without return types