Browse Source

Added bisect words function.

Wrote test code in script.
master
Craig Oates 6 years ago
parent
commit
45c25749c5
  1. 10
      WetPancake/DataProcessing.fs
  2. 5
      WetPancake/Script.fsx

10
WetPancake/DataProcessing.fs

@ -9,4 +9,12 @@
let SortIntoWordPairs pairSize text =
SplitText @"\s+" text // Splits text where there is a space.
|> Seq.windowed pairSize
|> Seq.windowed pairSize
let BisectWords words =
let length = Array.length words
let start =
words
|> Seq.take (length - 1)
|> ConcatToString
(start, words.[length - 1])

5
WetPancake/Script.fsx

@ -54,4 +54,7 @@ let dp_words =
let dp_words2 =
let words = "This is a test. And has serveral words in it."
SortIntoWordPairs 4 words
|> Seq.toList
|> Seq.toList
let dp_bisect =
let words = [|"This"; "is"; "a"; "test"; "."; "Contains"; "text"; "."|]
BisectWords words
Loading…
Cancel
Save