6 Replies Latest reply on Jul 15, 2018 11:50 PM by bharath.nair.0

    Python integration with Tableau - NLP tokenization

    bharath.nair.0

      Hi,

       

      I am trying to use TabPy to analyze text data in Tableau. I wanted to break down the text into words(tokenize) and then create their frequency counters using Python calculations.

       

       

      I was able to use nltk tokenizer, but was getting an error saying that string is expected; whereas the return value from python script was string, and calculation had script_Str. See below

       

       

      • An error occurred while communicating with the Predictive Service.
      • Error processing script
      • TypeError : expected string or bytes-like object

       

      Here is my calculation

       

      SCRIPT_STR(

      "from nltk.tokenize import word_tokenize


      data = _arg1

      return str(word_tokenize(data)[1])

      "

      ,ATTR([Comments]))

       

       

      Any help is highly appreciated.

      Thanks!