Browse Source

Started to refactor the request random text code.

Added axtra function to test reproduction quality of the functions.
master
Craig Oates 6 years ago
parent
commit
e2a5b3d831
  1. 24
      WetPancake/ProductServices.fs
  2. 9
      WetPancake/Script.fsx
  3. 13
      WetPancakeCLI/ConsoleCommands.cs

24
WetPancake/ProductServices.fs

@ -2,7 +2,6 @@
module Pancake =
open System
open SystemServices
open DataAccess
open DataCleaning
@ -10,8 +9,17 @@ module Pancake =
open DataStructuring
open DataServices
let ApplyStandardSetup text =
text
|> ReplaceArtifact "\""
|> ReplaceArtifact "\n\nIn"
|> ReplaceArtifact "\r"
|> ReplaceArtifact "\n"
|> SplitText @"\s+"
|> ConcatToString
let RequestRandomText =
let dss_text =
let data =
LoadFile SelectRandomSampleFile
|> ReplaceArtifact "\""
|> ReplaceArtifact "\n\nIn"
@ -19,9 +27,17 @@ module Pancake =
|> ReplaceArtifact "\n"
|> SplitText @"\s+"
|> ConcatToString
|> SortIntoGroups 10
|> SortIntoGroups (PickRandomNumber 10)
|> GenerateMap
GenerateMarkovText 2 dss_text
GenerateMarkovText (PickRandomNumber 10) data
let RequestRandomText2 =
let data2 =
LoadFile SelectRandomSampleFile
|> ApplyStandardSetup
|> SortIntoGroups (PickRandomNumber 10)
|> GenerateMap
GenerateMarkovText (PickRandomNumber 10) data2
//let RequestText (gibberishLevel: int) (sentences: int)

9
WetPancake/Script.fsx

@ -16,6 +16,7 @@ open DataCleaning
open DataProcessing
open DataStructuring
open DataServices
open WetPancake
// System Services
let ss_number = PickRandomNumber 10
@ -115,6 +116,10 @@ let dss_text =
|> ConcatToString
|> SortIntoGroups 2
|> GenerateMap
//let dss_startwords = SeperateStartWords dss_text
let dss_startwords = SeperateStartWords dss_text
let dss_sentences = GenerateMarkovText 2 dss_text
printfn "Text: %A" dss_sentences
printfn "Text: %A" dss_sentences
// (WetPancake) Pancake
let p_result = Pancake.RequestRandomText
let p_result2 = Pancake.RequestRandomText2

13
WetPancakeCLI/ConsoleCommands.cs

@ -2,7 +2,7 @@
using Console.Waterworks.Attributes;
using System;
using WetPancake;
//using WetPancake;
using static WetPancake.Pancake;
using static System.Environment;
namespace WetPancakeCLI
@ -28,18 +28,19 @@ namespace WetPancakeCLI
public static void Exit() => Environment.Exit(ExitCode);
[ListCommand]
[Description("Generates random text, the number of sentences generated is determined by the user.")]
[Parameters("int: sentenences")]
[Description("Generates random text, the number of sentences generated is randomly determined.")]
[Parameters("none")]
[Usage("> GenerateRandomText")]
public static string GenerateRandomText(int sentences)
public static string GenerateRandomText()
{
var result = Pancake.RequestRandomText;
var result = RequestRandomText2;
return result;
}
public static string test1()
{
return "This is a test method for quickly testing things out";
var result = RequestRandomText;
return result;
}
}
}

Loading…
Cancel
Save