Skip to content

Commit 376e1b2

Browse files
committed
clean up TextInterface, prettyPrint and other unused functions
1 parent 2da8268 commit 376e1b2

File tree

5 files changed

+27
-460
lines changed

5 files changed

+27
-460
lines changed

src/GraphicInterface.hs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
21
module GraphicInterface where
32

43

4+
import System.Directory
5+
import Data.List
6+
57

68
{--
79
example path: "data/traindata/img/10_12/big_numbers/0.pgm"
@@ -22,3 +24,23 @@ readPPMFile fn = do
2224
normalize x = norm where
2325
z = read x :: Double
2426
norm = z / 255
27+
28+
29+
-- returns a list of inputvalues from the given ppm folder.
30+
-- reads every ppm and generates its inputValues from the pixels values
31+
getPPMInput :: String -> IO [[Double]]
32+
getPPMInput path = do
33+
let fullPath = path--dataPath ++ path
34+
nameList <- getPgmList fullPath
35+
fileList <- mapM readPPMFile (map (\x -> fullPath ++ x) nameList)
36+
37+
return fileList
38+
39+
40+
-- scans a directory for ppm files and returns a list of their filenames
41+
getPgmList :: String -> IO [String]
42+
getPgmList path = do
43+
dirContent <- getDirectoryContents path
44+
let pgmList = filter (isSuffixOf ".pgm") dirContent
45+
return $ sort pgmList
46+

src/Gui.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Neuron
55
import Trainingdata
66
import Backpropagation
77
import Utils
8-
import Config
98
import TopologyParser
109
import TraindataParser
1110
import GraphicInterface

src/Main.hs

Lines changed: 1 addition & 14 deletions
Large diffs are not rendered by default.

src/TextInterface.hs

Lines changed: 0 additions & 248 deletions
This file was deleted.

0 commit comments

Comments
 (0)