|
|
|
@ -12,14 +12,6 @@
|
|
|
|
|
ListSampleFiles |
|
|
|
|
|> Array.contains filePath |
|
|
|
|
|
|
|
|
|
let RemoveArtifactSentences noOfSentences text = |
|
|
|
|
text |
|
|
|
|
|> SplitText @"(?<=[\.\!\?]\s)" |
|
|
|
|
|> Array.take noOfSentences |
|
|
|
|
|> ConcatToString |
|
|
|
|
|> ReplaceArtifact " " |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let rec GenerateMarkovChain (map: Map<string, string List>) (state:string) chain = |
|
|
|
|
if map.ContainsKey state then |
|
|
|
|
let nextChoice = map.[state] |> PickRandomItem |
|
|
|
@ -69,8 +61,7 @@
|
|
|
|
|
|
|
|
|
|
As this NuGet package is about generating random text, this should not be a problem for the most part. |
|
|
|
|
With that said, when this happens, it is an incorrect result -- from the end-users point-of-view. |
|
|
|
|
So, to get a more accurate result, pass the result of this function through the data-cleaner function. |
|
|
|
|
(THE DATA-CLEANER FUNCTION HAS NOT BEEN MADE YET.) |
|
|
|
|
So, to get a more accurate result, pass the result of this function through to the RemoveArtifactSentences function. |
|
|
|
|
*) |
|
|
|
|
let GenerateMarkovText noOfSentences map = |
|
|
|
|
let startWords = fst(SeperateStartWords map) |
|
|
|
@ -80,4 +71,11 @@
|
|
|
|
|
Thread.Sleep(100) |
|
|
|
|
yield GenerateMarkovSentence map (PickRandomItem startWords).Key |
|
|
|
|
} |
|
|
|
|
result |> ConcatToString |
|
|
|
|
result |> ConcatToString |
|
|
|
|
|
|
|
|
|
let RemoveArtifactSentences noOfSentences text = |
|
|
|
|
text |
|
|
|
|
|> SplitText @"(?<=[\.\!\?]\s)" |
|
|
|
|
|> Array.take noOfSentences |
|
|
|
|
|> ConcatToString |
|
|
|
|
|> ReplaceArtifact " " |