main :: IO ()
main = do
  putStrLn "Please enter the path to the database, or a newline for the default."
  path <- getLine
  print "got line"
  cpd <- loadChordProgressionDatabase (if path == "" then "./res/progressions.txt" else path)
  putStr "A"
  putStr $ "\"" ++ (show cpd) ++ "\""
  putStr "B"
  let topClasses = (getTestArtists cpd)
  putStrLn $ "Classes 0 through 3 and number of songs for each:\n" ++ (summary topClasses)
  --let hdms = map (\ (name, progs) -> buildHarmonyDistributionModel 2 (map toUntimedProgression progs)) topClasses

  --Has type ([(ChordProgression, Int)], [[ChordProgression]]) -- the Int is the index of the artist that the song belongs to
  let (test, training) = splitTrainingTest 3 (map ((map toUntimedProgression) . snd) topClasses)
  let hdms = makeHdms (map ((map toUntimedProgression) . snd) (getByArtist cpd)) training
  
  putStrLn $ concat (map (\ (prog, classIndex) -> "Song belonging to class " ++ (show classIndex) ++ "; class " ++ (show classIndex) ++ (" ranked #" ++ (show $ (getRank (inferStyle hdms prog) classIndex) + 1)) ++ " most likely to generate:\n\t" ++ (show $ inferStyle hdms prog) ++ "\n") test )

--TODO robustness testing.
main :: IO ()
main = do
  putStrLn "Please enter the path to the database, or a newline for the default."
  path <- getLine
  print "got line"
  cpd <- loadChordProgressionDatabase (if path == "" then "./res/progressions.txt" else path)
  putStr "A"
  putStr $ "\"" ++ (show cpd) ++ "\""
  putStr "B"
  let topClasses = (getTestArtists cpd)
  putStrLn $ "Classes 0 through 3 and number of songs for each:\n" ++ (summary topClasses)
  --let hdms = map (\ (name, progs) -> buildHarmonyDistributionModel 2 (map toUntimedProgression progs)) topClasses

  --Has type ([(ChordProgression, Int)], [[ChordProgression]]) -- the Int is the index of the artist that the song belongs to
  let (test, training) = splitTrainingTest 3 (map ((map toUntimedProgression) . snd) topClasses)
  let hdms = makeHdms (map ((map toUntimedProgression) . snd) (getByArtist cpd)) training
  
  putStrLn $ concat (map (\ (prog, classIndex) -> "Song belonging to class " ++ (show classIndex) ++ "; class " ++ (show classIndex) ++ (" ranked #" ++ (show $ (getRank (inferStyle hdms prog) classIndex) + 1)) ++ " most likely to generate:\n\t" ++ (show $ inferStyle hdms prog) ++ "\n") test )

--TODO robustness testing.
main = do
  putStrLn "Please enter the path to the database, or a newline for the default."
  path <- getLine
  print "got line"
  cpd <- loadChordProgressionDatabase (if path == "" then "./res/progressions.txt" else path)
  putStr "A"
  putStr $ "\"" ++ (show cpd) ++ "\""
  putStr "B"
  let topClasses = (getTestArtists cpd)
  putStrLn $ "Classes 0 through 3 and number of songs for each:\n" ++ (summary topClasses)
  --let hdms = map (\ (name, progs) -> buildHarmonyDistributionModel 2 (map toUntimedProgression progs)) topClasses

  --Has type ([(ChordProgression, Int)], [[ChordProgression]]) -- the Int is the index of the artist that the song belongs to
  let (test, training) = splitTrainingTest 3 (map ((map toUntimedProgression) . snd) topClasses)
  let hdms = makeHdms (map ((map toUntimedProgression) . snd) (getByArtist cpd)) training
  
  putStrLn $ concat (map (\ (prog, classIndex) -> "Song belonging to class " ++ (show classIndex) ++ "; class " ++ (show classIndex) ++ (" ranked #" ++ (show $ (getRank (inferStyle hdms prog) classIndex) + 1)) ++ " most likely to generate:\n\t" ++ (show $ inferStyle hdms prog) ++ "\n") test )

--TODO robustness testing.