if (FALSE) {
# Example 1: File path
test_file_path <- tempfile()
writeLines("This is a test.", test_file_path)
expect_equal(count_tokens(test_file_path), 5)
file.remove(test_file_path)
# Example 2: URL
url <- "https://www.gutenberg.org/files/2701/2701-0.txt"
count_tokens(url)
# Example 3: Character string
text <- "This is a test string."
count_tokens(text)
}
Run the code above in your browser using DataLab