Commit d04b21c2 authored by Georgi Angelov's avatar Georgi Angelov
Browse files

Added function to return explanation with answer

parent c3850bbc
......@@ -47,6 +47,9 @@ solve clue
solveReturn clue
= returnSolutions False clue "" id head' False
solveReturnExpl clue
= returnSolutionsAndExplanations False clue "" id head' False
solveFull clue
= showSolutions True clue "" id head' False
......@@ -121,6 +124,24 @@ returnSolutions displayFull clue answer prefilter postProcess evalCacheOn = extr
extractSol (_,_,_, R (sol, _)) = sol
returnSolutionsAndExplanations displayFull clue answer prefilter postProcess evalCacheOn
= map formatSolution (zip extractSols (map (showSol pCache) sols'))
where
formatSolution (sol, expl) = sol ++ ": " ++ expl
acceptAnyDef = not (null answer)
(parses, pCache) = if null answer
then prunedParses clue
else prunedParsesWithAnswer clue answer
parses' = prefilter parses
sols = evaluate parses' pCache clue answer evalCacheOn
sols' = postProcess sols
extractSols = map extractSol sols'
extractSol (_,_,_, R (sol, _)) = sol
dumpIndicators :: (IndicatorPredicateSet, String, [String]) -> IO ()
dumpIndicators (inds, textString, stemmedTextWords)
= mapM_ showInd [i | i <- [minBound .. maxBound], inds ! i]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment