The purpose of this repository is to provide a way for people to generate random "placeholder text" -- with a Markov Chain.
https://www.craigoates.net/Software/project/12
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
733 B
26 lines
733 B
module internal DataProcessing |
|
|
|
open System.Text.RegularExpressions |
|
open DataCleaning |
|
open System |
|
|
|
let MatchText pattern text = Regex.IsMatch(text, pattern) |
|
|
|
let ConcatToString words = String.concat " " words |
|
|
|
let SortIntoGroups groupSize text = |
|
SplitText @"\s+" text // Splits text where there is a space. |
|
|> Seq.windowed groupSize |
|
|
|
let BisectWords words = |
|
let length = Array.length words |
|
let start = |
|
words |
|
|> Seq.take (length - 1) |
|
|> ConcatToString |
|
(start, words.[length - 1]) |
|
|
|
let CombineWords prev next = |
|
[prev; next] |
|
|> List.filter(fun s -> not (String.IsNullOrWhiteSpace s)) |
|
|> ConcatToString |