added arguments

This commit is contained in:
IGI-111
2015-04-03 23:12:35 +02:00
parent 5ba00085d1
commit 8208f03f82

View File

@@ -3,11 +3,15 @@ module Main where
import CSVParser import CSVParser
import Apriori import Apriori
import qualified Data.Set as Set import qualified Data.Set as Set
import System.Environment (getArgs)
main :: IO() main :: IO()
main = do main = do
file <- readFile "out.csv" args <- getArgs
let filename = head args
let threshold = read $ last args
file <- readFile filename
case parseCSV file of case parseCSV file of
Left _ -> putStrLn "Could not parse out.csv" Left _ -> putStrLn "Could not parse out.csv"
Right val -> mapM_ (\x -> putStrLn (show x ++ "(" ++ show (count table x) ++ ")")) (concat (frequentPatterns 0.6 table)) where Right val -> mapM_ (\x -> putStrLn (show x ++ "(" ++ show (count table x) ++ ")")) (concat (frequentPatterns threshold table)) where
table = map (ItemSet. Set.fromList .map Item) val table = map (ItemSet. Set.fromList .map Item) val