code: def _count_ngrams(self, n=2, method="word", to_lower=True, ignore_space=True):
          
          if (self.dtype != str):
              raise TypeError("Only SArray of string type is supported for counting n-grams")
  
          if (type(n) != int):
              raise TypeError("Input 'n' must be of type int")
  
          if (n < 1):
              raise ValueError("Input 'n' must be greater than 0")
  
          if (n > 5):
              warnings.warn("It is unusual for n-grams to be of size larger than 5.")
  
  
          # construct options, will extend over time
          options = dict()
          options["to_lower"] = to_lower == True
          options["ignore_space"] = ignore_space == True
  
  
          if method == "word":
              with cython_context():
                  return SArray(_proxy=self.__proxy__.count_ngrams(n, options))
          elif method == "character" :
              with cython_context():
                  return SArray(_proxy=self.__proxy__.count_character_ngrams(n, options))
          else:
              raise ValueError("Invalid 'method' input  value. Please input either 'word' or 'character' ")
docs: For documentation, see turicreate.text_analytics.count_ngrams().
  
          ..WARNING:: This function is deprecated, and will be removed in future
          versions of Turi Create. Please use the `text_analytics.count_words`
          function instead.