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 SortIntoPairs pairSize text =
let SortIntoGroups groupSize text =
SplitText @"\s+" text // Splits text where there is a space.
|> Seq.windowed pairSize
|> Seq.windowed groupSize
let BisectWords words =
let length = Array.length words

10
WetPancake/DataServices.fs

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

2
WetPancake/DataStructuring.fs

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

10
WetPancake/Script.fsx

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