mirror of
https://github.com/Jaxan/nominal-lstar.git
synced 2025-04-27 14:47:45 +02:00
Forgot to add the new Main2.hs file :-(
This commit is contained in:
parent
e91859b61f
commit
96ae5ba868
2 changed files with 43 additions and 0 deletions
10
run.sh
Executable file
10
run.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# To run with the external teacher in the
|
||||
# nominal-learning-ons repository
|
||||
|
||||
mkfifo qs ans
|
||||
time stack exec NominalAngluin2 NomLStarCol > qs < ans &
|
||||
../nominal-learning-orbitsets/external_teacher qs ans "$@"
|
||||
|
||||
rm qs ans
|
33
src/Main2.hs
Normal file
33
src/Main2.hs
Normal file
|
@ -0,0 +1,33 @@
|
|||
import Angluin
|
||||
import Bollig
|
||||
import Examples
|
||||
import Teacher
|
||||
import ObservationTable
|
||||
import NLStar
|
||||
|
||||
import System.Environment
|
||||
import System.IO
|
||||
import NLambda
|
||||
|
||||
data Learner = NomLStar | NomLStarCol | NomNLStar
|
||||
deriving (Show, Read)
|
||||
|
||||
learn alphSet = do
|
||||
[learnerName] <- getArgs
|
||||
let t = teacherWithIO2 alphSet
|
||||
let h = case read learnerName of
|
||||
NomLStar -> learnAngluinRows t
|
||||
NomLStarCol -> learnAngluin t
|
||||
NomNLStar -> learnBollig t
|
||||
hPrint stderr h
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
[learnerName] <- getArgs
|
||||
putStrLn "ALPHABET" -- ask for the alphabet from the teacher
|
||||
hFlush stdout
|
||||
alph <- getLine
|
||||
case alph of
|
||||
"ATOMS" -> learn atoms
|
||||
"FIFO" -> learn (NLambda.map Put atoms `union` NLambda.map Get atoms)
|
||||
_ -> error $ "Unknown alphabet " ++ alph
|
Loading…
Add table
Reference in a new issue