Browse Source

Renamed function: sort into groups. Meaning clearer.

master
Craig Oates 6 years ago
parent
commit
7790485fe6
  1. 4
      WetPancake/DataProcessing.fs
  2. 10
      WetPancake/DataServices.fs
  3. 2
      WetPancake/DataStructuring.fs
  4. 10
      WetPancake/Script.fsx

4
WetPancake/DataProcessing.fs

@ -8,9 +8,9 @@
let ConcatToString words = String.concat " " words let ConcatToString words = String.concat " " words
let SortIntoPairs pairSize text = let SortIntoGroups groupSize text =
SplitText @"\s+" text // Splits text where there is a space. SplitText @"\s+" text // Splits text where there is a space.
|> Seq.windowed pairSize |> Seq.windowed groupSize
let BisectWords words = let BisectWords words =
let length = Array.length words let length = Array.length words

10
WetPancake/DataServices.fs

@ -15,8 +15,8 @@
let result = "Not done yet" let result = "Not done yet"
result result
let GenerateMarkovSentences sentences map startWords = let GenerateMarkovSentences noOfSentences map = 0
seq { //seq {
for i in 1 .. sentences do // for i in 0 .. noOfSentences do
yield GenerateSentence map (PickStartWord startWords) // yield GenerateSentence map (PickStartWord startWords)
} //}

2
WetPancake/DataStructuring.fs

@ -10,7 +10,7 @@
else else
map.Add (key, [value]) map.Add (key, [value])
// Not the bast name... // Not the best name...
let ConstructMap map text = let ConstructMap map text =
BisectWords text ||> UpdateMap map BisectWords text ||> UpdateMap map

10
WetPancake/Script.fsx

@ -55,7 +55,7 @@ let dp_words =
ConcatToString words ConcatToString words
let dp_words2 = let dp_words2 =
let words = "This is a test. And has serveral words in it." let words = "This is a test. And has serveral words in it."
SortIntoPairs 2 words SortIntoGroups 2 words
|> Seq.toList |> Seq.toList
let dp_bisect = let dp_bisect =
let words = [|"This"; "is"; "a"; "test"; "."; "Contains"; "text"; "."|] let words = [|"This"; "is"; "a"; "test"; "."; "Contains"; "text"; "."|]
@ -113,10 +113,6 @@ let dss_text =
|> ReplaceArtifact "\n" |> ReplaceArtifact "\n"
|> SplitText @"\s+" |> SplitText @"\s+"
|> ConcatToString |> ConcatToString
|> SortIntoPairs 6 |> SortIntoGroups 6
|> GenerateMap |> GenerateMap
let dss_startword = PickStartWord dss_startwords let dss_sentences = GenerateMarkovSentences 4 dss_text
let dss_startword2 = snd(dss_startword)
dss_startword2.["see"]
let dds_startword3 = dss_map.[0]
//let dss_sentences = GenerateMarkovSentences 4 dss_map dss_startwords
Loading…
Cancel
Save