I read a text into R using the readChar() function. I aim at testing the hypothesis that the sentences of the text have as many occurrences of letter “a” as occurrences of letter “b”. I recently discovered the {stringr} package, which helped me a great deal to do useful things with my text such as counting the number of characters and the total number of occurrences of each letter in the entire text. Now, I need to know the number of sentences in the whole text. Does R have any function, which can help me do that? Thank you very much!
I read a text into R using the readChar() function. I aim at testing
Share
Thank you @gui11aume for your answer. A very good package I just found that can help do the work is
{openNLP}. This is the code to do that:The
{openNLP}package is really great for natural language processing in R and you can find a good and short intro to it here or you can check out the package’s documentation here.Three more languages are supported in the package. You just need to install and load the corresponding model files.
{openNLPmodels.es}for Spanish{openNLPmodels.ge}for German{openNLPmodels.th}for Thai