Browse Source

Wrote sort into word pairs function.

Tested it out in the script file.
master
Craig Oates 6 years ago
parent
commit
a0c38ba7a9
  1. 7
      WetPancake/DataProcessing.fs
  2. 6
      WetPancake/Script.fsx

7
WetPancake/DataProcessing.fs

@ -1,7 +1,12 @@
module internal DataProcessing
open System.Text.RegularExpressions
open DataCleaning
let MatchText pattern text = Regex.IsMatch(text, pattern)
let JoinWords words = String.concat " " words
let ConcatToString words = String.concat " " words
let SortIntoWordPairs pairSize text =
SplitText @"\s+" text // Splits text where there is a space.
|> Seq.windowed pairSize

6
WetPancake/Script.fsx

@ -50,4 +50,8 @@ let dp_failStart = MatchText @"^[A-Z]" "somewhere in the middle"
let dp_failEnd = MatchText @"\." "this is not the end"
let dp_words =
let words = ["This"; "is"; "a"; "test"; "."]
JoinWords words
ConcatToString words
let dp_words2 =
let words = "This is a test. And has serveral words in it."
SortIntoWordPairs 4 words
|> Seq.toList
Loading…
Cancel
Save