(build-map-from-seqs chainlen input-sequences)
Build a Markov chain map whose chains have a length chainlen
from
an collection of sequences input-sequences
. Example:
(build-map-from-seqs 2 [["A" "dog" "is" "not" "a" "cat"]
["A" "dog" "is" "hungry"]])
;;=>
{("A" "dog") #{"is"}
("dog" "is") #{"not" "hungry"}
("is" "not") #{"a"}
("not" "a") #{"cat"}
("a" "cat") #{STOP-STATE}
("is" "hungry") #{STOP-STATE}}
Build a Markov chain map whose chains have a length `chainlen` from an collection of sequences `input-sequences`. Example: (build-map-from-seqs 2 [["A" "dog" "is" "not" "a" "cat"] ["A" "dog" "is" "hungry"]]) ;;=> {("A" "dog") #{"is"} ("dog" "is") #{"not" "hungry"} ("is" "not") #{"a"} ("not" "a") #{"cat"} ("a" "cat") #{STOP-STATE} ("is" "hungry") #{STOP-STATE}}
(build-map-from-strings chainlen strings)
Similar to build-map-from-seqs
but takes a collection of strings
as inputs.
Similar to `build-map-from-seqs` but takes a collection of strings as inputs.
(generate-sequence nextmap)
Generate a sequence using Markov chain by following choices captured
in nextmap
. Start with an initial sequence/key randomly chosen
from the keys in the map. Select next letter randomly based on the
available ones for that key. Collect all letters this way, adding
them and changing the current key until STOP-STATE
symbol is
reached, or there are no available choices for the current position
in the chain.
Generate a sequence using Markov chain by following choices captured in `nextmap`. Start with an initial sequence/key randomly chosen from the keys in the map. Select next letter randomly based on the available ones for that key. Collect all letters this way, adding them and changing the current key until `STOP-STATE` symbol is reached, or there are no available choices for the current position in the chain.
(generate-single-name nextmap)
For a sequence of letters, captialize and return as string.
For a sequence of letters, captialize and return as string.
(make-nextmap chainlen parts)
Make a map of next values in a Markov chain, given a vector of
input sequences with length == chainlen+1, where the first
chainlen
values of each are the keys, and the values are a vector
of the last letter seen following that sequence. For example,
((a l f r) (a l f i)) --> {(a l f) [r i]}
Make a map of next values in a Markov chain, given a vector of input sequences with length == chainlen+1, where the first `chainlen` values of each are the keys, and the values are a vector of the last letter seen following that sequence. For example, `((a l f r) (a l f i)) --> {(a l f) [r i]}`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close