From 7790485fe626cd90d3f4f8f6aed0bf8b39c8d3f9 Mon Sep 17 00:00:00 2001 From: "OPTIMUS-PRIME\\craig" Date: Sat, 26 May 2018 21:36:44 +0100 Subject: [PATCH] Renamed function: sort into groups. Meaning clearer. --- WetPancake/DataProcessing.fs | 4 ++-- WetPancake/DataServices.fs | 10 +++++----- WetPancake/DataStructuring.fs | 2 +- WetPancake/Script.fsx | 10 +++------- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/WetPancake/DataProcessing.fs b/WetPancake/DataProcessing.fs index 2305fbe..acdc322 100644 --- a/WetPancake/DataProcessing.fs +++ b/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 diff --git a/WetPancake/DataServices.fs b/WetPancake/DataServices.fs index 1b88280..1163fca 100644 --- a/WetPancake/DataServices.fs +++ b/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) - } \ No newline at end of file + let GenerateMarkovSentences noOfSentences map = 0 + //seq { + // for i in 0 .. noOfSentences do + // yield GenerateSentence map (PickStartWord startWords) + //} \ No newline at end of file diff --git a/WetPancake/DataStructuring.fs b/WetPancake/DataStructuring.fs index 236e90c..66eb055 100644 --- a/WetPancake/DataStructuring.fs +++ b/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 diff --git a/WetPancake/Script.fsx b/WetPancake/Script.fsx index 8d96300..8c32f6e 100644 --- a/WetPancake/Script.fsx +++ b/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 \ No newline at end of file +let dss_sentences = GenerateMarkovSentences 4 dss_text \ No newline at end of file