-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.hs
More file actions
19 lines (16 loc) · 733 Bytes
/
Copy pathTest.hs
File metadata and controls
19 lines (16 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.FastText
import System.Exit (ExitCode (..), exitWith)
main :: IO ()
main = do
model <- loadModel "data/lid.176.ftz"
putStrLn $ "Loaded model with dimension " <> show (getDimension model)
let input = "og overalt gaar det tidligere undertrykte maal stadig fremad, trods brølene og trods dannelsen — akkurat som her"
expLabel = "__label__no"
res <- predictProbs model 2 0 input
case res of
(Prediction _ l) : _ | l == expLabel -> print res >> exitWith ExitSuccess
_ -> do
putStrLn $ "Test failed, expected " <> show expLabel <> " as top label, result, got:\n " <> show res <> " ... "
exitWith (ExitFailure 1)