Browse Source

Began writing the initial data structure map.

Test code in script, also, started.
master
Craig Oates 6 years ago
parent
commit
23554651ec
  1. 15
      WetPancake/DataStructuring.fs
  2. 18
      WetPancake/Script.fsx

15
WetPancake/DataStructuring.fs

@ -1 +1,14 @@
module internal DataStructuring
module internal DataStructuring
open DataProcessing
let UpdateMap (map:Map<_,_>) key value =
if map.ContainsKey key then
let exisitingValue = map.[key]
let map = map |> Map.remove key
map |> Map.add key (value :: exisitingValue)
else
map.Add (key, [value])
let InitialiseMap map text =
BisectWords text ||> UpdateMap map

18
WetPancake/Script.fsx

@ -9,11 +9,12 @@
#load "DataServices.fs"
#load "ProductServices.fs"
open System
open SystemServices
open DataAccess
open DataCleaning
open System
open DataProcessing
open DataStructuring
// System Services
let ss_number = PickRandomNumber 10
@ -59,9 +60,9 @@ let dp_bisect =
let words = [|"This"; "is"; "a"; "test"; "."; "Contains"; "text"; "."|]
BisectWords words
let dp_combine =
let previous = "This is the previous"
let prev = "This is the previous"
let next = "this is the next"
CombineWords previous next
CombineWords prev next
let dp_combine2 =
let prev = " "
let next = "Prev is whitespace"
@ -73,4 +74,13 @@ let dp_combine3 =
let dp_combine4 =
let prev = "Next is null"
let next = null
CombineWords prev next
CombineWords prev next
// Data Structuring
let ds_map = Map.empty
let ds_text = [|"This"; "is"; "a"; "test"; "string."|]
let ds_map2 = InitialiseMap ds_map ds_text
let ds_map3 =
let text = BisectWords ds_text
let result = UpdateMap ds_map (fst(text)) (snd(text))
result
Loading…
Cancel
Save