Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Angelov, Georgi
cryptic-solver-haskell
Commits
d04b21c2
Commit
d04b21c2
authored
Oct 25, 2021
by
Georgi Angelov
Browse files
Added function to return explanation with answer
parent
c3850bbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Solver.hs
View file @
d04b21c2
...
...
@@ -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
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment