class_docstr: Test the text utilities for creating and cleaning features.
class_docstr_tok: ["Test","the","text","utilities","for","creating","and","cleaning","features","."]
code: def test_count_words(self):
      ## Bogus input type
      sa = tc.SArray([1, 2, 3])
      with self.assertRaises(RuntimeError):
          text_analytics.count_words(sa)
  
      ## Other languages
      expected = [
          {"this": 1, "http": 1, "someurl": 2, "is": 1},
          {"中文": 1, "应该也": 1, "行": 1},
          {"Сблъсъкът": 1, "между": 1},
      ]
      expected2 = [
          {"This": 1, "http": 1, "someurl": 2, "is": 1},
          {"中文": 1, "应该也": 1, "行": 1},
          {"Сблъсъкът": 1, "между": 1},
      ]
  
      result = text_analytics.count_words(self.languages)
      self.assertEqual(result.dtype, dict)
      self.sframe_comparer._assert_sarray_equal(result, expected)
  
      result = text_analytics.count_words(
          self.languages, to_lower=False
      )
      self.assertEqual(result.dtype, dict)
      self.sframe_comparer._assert_sarray_equal(result, expected2)
  
      ## Check that delimiters work properly by default and when modified.
      expected1 = [
          {
              "this": 1,
              "is": 1,
              "some": 1,
              "url": 1,
              "http": 1,
              "www": 1,
              "someurl": 1,
              "com": 1,
          },
          {"should": 2, "we": 2, "yes": 1},
      ]
      expected2 = [
          {"this is some url http://www.someurl.com": 1},
          {"should we": 1, " yes": 1, " we should.": 1},
      ]
  
      word_counts1 = text_analytics.count_words(self.punctuated)
      word_counts2 = text_analytics.count_words(
          self.punctuated, delimiters=["?", "!", ","]
      )
  
      self.assertEqual(word_counts1.dtype, dict)
      self.sframe_comparer._assert_sarray_equal(word_counts1, expected1)
      self.assertEqual(word_counts2.dtype, dict)
      self.sframe_comparer._assert_sarray_equal(word_counts2, expected2)
  
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 5 for calling the FeatureEngineeringTest obj's underlying member method code with example usage: obj.test_count_words() without return types