From 6313244eacf992fb10a5091bee28582e84540809 Mon Sep 17 00:00:00 2001 From: krasimir Date: Mon, 19 Apr 2010 09:38:36 +0000 Subject: use the native unicode support from GHC 6.12 --- src/compiler/GF/Quiz.hs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/compiler/GF/Quiz.hs') 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 -- cgit v1.2.3