(toks <- tokenize('This is a first sentence . This is a second sentence .',
re_token_splitter = '\\s+'))
trunc_at(toks, re("[.]"))
trunc_at(toks, re("[.]"), last_match = TRUE)
trunc_at(toks, re("[.]"), last_match = TRUE, from_end = TRUE)
Run the code above in your browser using DataLab