tests/testthat/test-sample_sentences.R

test_that("sample_sentences() returns a character of the correct length", {
        model <- language_model(kgram_freqs("a a b a b b a", 3), "add_k", k = 1)
        len <- 7
        res <- sample_sentences(model, n = len, max_length = 100)
        
        expect_vector(res, character(), len)
})

Try the kgrams package in your browser

Any scripts or data that you put into this service are public.

kgrams documentation built on Oct. 6, 2023, 5:06 p.m.