So I wrote a codelab for comment spam detection here that may touch on some related areas - tokenization etc that may be of use for you here:

  
      

      Google Codelabs
  

  
    

TensorFlow.js: Build a comment spam detection system  |  Google... 1

  In this codelab, you’ll learn how to build a simple web page that has commenting ability akin to a blog post article and integrate it with a pre trained machine learning model to detect comment spam posts, enabling you to filter these out before they...