|
|
|
@ -9,7 +9,8 @@
|
|
|
|
|
let rec GenerateMarkovChain (map: Map<string, string List>) (state:string) chain = |
|
|
|
|
// up to here need to break th circuit at this point. |
|
|
|
|
let mutable nextChoice = "" |
|
|
|
|
if ((Seq.length map) = 0) then nextChoice <- "fallback word." |
|
|
|
|
if ((List.length map.[state]) <= 1) then |
|
|
|
|
nextChoice <- "." |
|
|
|
|
else |
|
|
|
|
nextChoice <- map.[state] |> PickNextWord |
|
|
|
|
//let nextChoice = map.[state] |> PickNextWord |
|
|
|
@ -51,13 +52,13 @@
|
|
|
|
|
*) |
|
|
|
|
let GenerateMarkovTextTesting noOfSentences map = |
|
|
|
|
let startWords = fst(SeperateStartWords map) |
|
|
|
|
if Seq.isEmpty startWords then |
|
|
|
|
if ((Map.count startWords) <= 1) then |
|
|
|
|
"Failed to generate a result" |
|
|
|
|
else |
|
|
|
|
let result = |
|
|
|
|
seq { |
|
|
|
|
for i in 1 .. noOfSentences do |
|
|
|
|
Thread.Sleep(100) |
|
|
|
|
yield GenerateMarkovSentence map (PickRandomItem startWords).Key |
|
|
|
|
yield GenerateMarkovSentence map (PickRandomItem startWords).Key |
|
|
|
|
} |
|
|
|
|
result |> ConcatToString |