diff options
| author | krasimir <krasimir@chalmers.se> | 2010-04-19 09:38:36 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-04-19 09:38:36 +0000 |
| commit | 6313244eacf992fb10a5091bee28582e84540809 (patch) | |
| tree | 8208fb18a5e1ab9447bd060cf08a3d78ed0a8c0a /src/compiler/GF/Quiz.hs | |
| parent | 8b5827fc892c2f395ae26f1811da2d4cc3b1669d (diff) | |
use the native unicode support from GHC 6.12
Diffstat (limited to 'src/compiler/GF/Quiz.hs')
| -rw-r--r-- | src/compiler/GF/Quiz.hs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/compiler/GF/Quiz.hs b/src/compiler/GF/Quiz.hs index 9a3540645..4a4caafc8 100644 --- a/src/compiler/GF/Quiz.hs +++ b/src/compiler/GF/Quiz.hs @@ -23,7 +23,6 @@ import PGF.Linearize import GF.Data.Operations import GF.Infra.UseIO import GF.Infra.Option -import GF.Text.Coding import PGF.Probabilistic import System.Random @@ -33,9 +32,9 @@ import Data.List (nub) -- generic quiz function -mkQuiz :: Encoding -> String -> [(String,[String])] -> IO () -mkQuiz cod msg tts = do - let qas = [ (encodeUnicode cod q, mkAnswer cod as) | (q,as) <- tts] +mkQuiz :: String -> [(String,[String])] -> IO () +mkQuiz msg tts = do + let qas = [(q, mkAnswer as) | (q,as) <- tts] teachDialogue qas msg translationList :: @@ -62,14 +61,13 @@ morphologyList mex mprobs pgf ig typ number = do (pwss@(pws0:_),i) <- zip ss forms, let ws = map (\pws -> snd (pws !! i)) pwss] -- | compare answer to the list of right answers, increase score and give feedback -mkAnswer :: Encoding -> [String] -> String -> (Integer, String) -mkAnswer cod as s = +mkAnswer :: [String] -> String -> (Integer, String) +mkAnswer as s = if (elem (norm s) as) then (1,"Yes.") - else (0,"No, not" +++ s ++ ", but" ++++ enc (unlines as)) + else (0,"No, not" +++ s ++ ", but" ++++ unlines as) where - norm = unwords . words . decodeUnicode cod - enc = encodeUnicode cod + norm = unwords . words norml = unwords . words |
