Train a markov model for string generation. This module provides some wrapper functionality around the markov
module so that you can do word generation. Sentence generation using markov models is fairly straight forward by using
lists of String
s as training data. Just like how the core String
module makes some character operations easier this
section helps to wrap List Char
operations into a more simpler String
interface. This module contains only the
operations that benefit from simplification not covered by the core library. This sections also serves as a good
template on how to extend the markov package for use in your own data.
Markov Basics.Int Char
A type alias for a markov graph which is used on determining probabilities of character transitions in words.
empty : MarkovString
Create an empty markov string object.
train : String -> MarkovString -> MarkovString
Train the markov model on a single string. This trains the model to store the transition probabilities of all the letters within the string as well as the probabilities to start with the first character and end with the last character.
trainList : List String -> MarkovString -> MarkovString
Train the model on a sample of data or an entire corpus.
encode : MarkovString -> Json.Encode.Value
Encode the markov string model into a json object.
decode : Json.Decode.Decoder MarkovString
Decode a json object into a markov string model.