|
|
|
// Learn more about F# at http://fsharp.org
|
|
|
|
// See the 'F# Tutorial' project for more help.
|
|
|
|
|
|
|
|
#load "SystemServices.fs"
|
|
|
|
#load "DataAccess.fs"
|
|
|
|
#load "DataCleaning.fs"
|
|
|
|
#load "DataProcessing.fs"
|
|
|
|
#load "DataStructuring.fs"
|
|
|
|
#load "DataServices.fs"
|
|
|
|
#load "ProductServices.fs"
|
|
|
|
|
|
|
|
open SystemServices
|
|
|
|
open DataAccess
|
|
|
|
open DataCleaning
|
|
|
|
open System
|
|
|
|
open DataProcessing
|
|
|
|
|
|
|
|
// System Services
|
|
|
|
let ss_number = PickRandomNumber 10
|
|
|
|
let ss_item =
|
|
|
|
let items = seq {1 .. 10}
|
|
|
|
PickRandomItem (Random().Next) items
|
|
|
|
|
|
|
|
|
|
|
|
// Data Access
|
|
|
|
let da_sampleFilePath = CreateSampleTextFilesPath
|
|
|
|
let da_sampleTextFiles = FindSampleTextFiles da_sampleFilePath
|
|
|
|
let da_sampleFiles = ListSampleFiles
|
|
|
|
let da_randomSampleFile = SelectRandomSampleFile
|
|
|
|
let da_file = LoadFile da_randomSampleFile
|
|
|
|
|
|
|
|
// Data Cleaning
|
|
|
|
let dc_replace1 = ReplaceArtifact "\"" "dc_repl1 \" end."
|
|
|
|
let dc_replace2 = ReplaceArtifact "\n\nIn" "dc_repl2 \n\nIn end."
|
|
|
|
let dc_replace3 = ReplaceArtifact "\r" "dc_repl3 \r end."
|
|
|
|
let dc_replace4 = ReplaceArtifact "\n" "dc_repl4 \n end."
|
|
|
|
let dc_replace5 =
|
|
|
|
let testPath = "a1 \" a2 \n\nIn a3 \r a4 \n end."
|
|
|
|
testPath
|
|
|
|
|> ReplaceArtifact "\""
|
|
|
|
|> ReplaceArtifact "\n\nIn"
|
|
|
|
|> ReplaceArtifact "\r"
|
|
|
|
|> ReplaceArtifact "\n"
|
|
|
|
let dc_split = SplitText @"\s+" "This is a test string."
|
|
|
|
|
|
|
|
// Data Processing
|
|
|
|
let dp_isStart = MatchText @"^[A-Z]" "This is a test"
|
|
|
|
let dp_isEnd = MatchText @"\." "and the end is nigh."
|
|
|
|
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"; "."]
|
|
|
|
ConcatToString words
|
|
|
|
let dp_words2 =
|
|
|
|
let words = "This is a test. And has serveral words in it."
|
|
|
|
SortIntoWordPairs 4 words
|
|
|
|
|> Seq.toList
|
|
|
|
let dp_bisect =
|
|
|
|
let words = [|"This"; "is"; "a"; "test"; "."; "Contains"; "text"; "."|]
|
|
|
|
BisectWords words
|