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]) // Not the best name... let ConstructMap map text = BisectWords text ||> UpdateMap map let GenerateMap<'a> = Seq.fold ConstructMap Map.empty let SeperateStartWords map = let startWords = map |> Map.partition (fun k _ -> MatchText @"^[A-Z]" k) startWords