Predictive text based on Stupid Back-off N-gram model.

# S3 method for sbo_kgram_freqs
predict(object, input, lambda = 0.4, ...)

Arguments

object

a sbo_kgram_freqs object.

input

a length one character vector, containing the input for next-word prediction.

lambda

a numeric vector of length one. The back-off penalization in Stupid Back-off algorithm.

...

further arguments passed to or from other methods.

Value

A tibble containing the next-word probabilities for all words in the dictionary.

Author

Valerio Gherardi

Examples

predict(twitter_freqs, "i love")
#> # A tibble: 1,001 x 2 #> completion probability #> <chr> <dbl> #> 1 you 0.222 #> 2 it 0.0574 #> 3 my 0.0549 #> 4 the 0.0524 #> 5 your 0.0312 #> 6 this 0.0312 #> 7 that 0.0287 #> 8 how 0.0249 #> 9 u 0.0175 #> 10 when 0.0150 #> # … with 991 more rows