title: Creating NGrams in R
body: <p>I am trying to write ngram code in R. Below code works fine when I use stemDocument (corpus&lt;- tm_map(corp_inputFile, stemDocument)). But gives an error when I don't use stemDocument. </p>
  
  <pre><code>   BigramTokenizer &lt;- function(x) NGramTokenizer(x, Weka_control(min = 3, max = 3))
     tdm &lt;- TermDocumentMatrix(corpus, control = list(tokenize = BigramTokenizer))
     forExport &lt;- as.matrix(inspect(tdm))
     write.csv(forExport, 'C:/myfile.csv')
  </code></pre>
  
  <p>Error Message: </p>
  
  <pre><code>   Error in .jcall("RWekaInterfaces", "[S", "tokenize", .jcast(tokenizer,  : 
         java.lang.NullPointerException 
  </code></pre>
  
  <p>Please guide</p>