reworked modules to allow for multiple executables

This commit is contained in:
IGI-111
2015-04-04 02:15:06 +02:00
parent ee984a685d
commit 24d0dcba96
4 changed files with 56 additions and 41 deletions

18
phase1.hs Normal file
View File

@@ -0,0 +1,18 @@
import CSVParser
import FrequentPatterns
import DataModel
import qualified Data.Set as Set
import System.Environment(getArgs)
import Control.Monad(when)
main :: IO()
main = do
args <- getArgs
when (2 /= length args) (error "Usage: Main <file.csv> <threshold>")
let filename = head args
let threshold = read $ last args
file <- readFile filename
case parseCSV file of
Left _ -> error "Could not parse out.csv"
Right val -> mapM_ (\x -> putStrLn (show x ++ "(" ++ show (count table x) ++ ")")) (concat (frequentPatterns threshold table)) where
table = map (ItemSet. Set.fromList .map Item) val