Further improve Middle Character and Twitter
Upon further inspection, Richard and I realized that we didn't need to have `parsed-outputs` at all in problems that just return a string (take the top value from the `:string` stack). So we removed all that from the Middle Character and Twitter problems, and removed the unnecessary calls to `str` in the `levenshtein-distance` calls. Co-authored-by: RichardLussier <lussi036@morris.umn.edu>
This commit is contained in:
parent
cb33af755a
commit
404e640cfb
@ -47,19 +47,14 @@
|
||||
(:step-limit argmap))
|
||||
:string))
|
||||
inputs)
|
||||
parsed-outputs (map (fn [output]
|
||||
(if (= output :no-stack-item)
|
||||
1000.0
|
||||
output))
|
||||
outputs)
|
||||
errors (map (fn [correct-output output]
|
||||
(if (= output :no-stack-item)
|
||||
10000
|
||||
(metrics/levenshtein-distance (str correct-output) (str output))))
|
||||
(metrics/levenshtein-distance correct-output output)))
|
||||
correct-outputs
|
||||
parsed-outputs)]
|
||||
outputs)]
|
||||
(assoc individual
|
||||
:behaviors parsed-outputs
|
||||
:behaviors outputs
|
||||
:errors errors
|
||||
:total-error #?(:clj (apply +' errors)
|
||||
:cljs (apply + errors)))))
|
||||
|
@ -50,19 +50,14 @@
|
||||
(:step-limit argmap))
|
||||
:string))
|
||||
inputs)
|
||||
parsed-outputs (map (fn [output]
|
||||
(try (read-string output)
|
||||
#?(:clj (catch Exception e 1000.0)
|
||||
:cljs (catch js/Error. e 1000.0))))
|
||||
outputs)
|
||||
errors (map (fn [correct-output output]
|
||||
(if (= output :no-stack-item)
|
||||
10000
|
||||
(metrics/levenshtein-distance (str correct-output) (str output))))
|
||||
(metrics/levenshtein-distance correct-output output)))
|
||||
correct-outputs
|
||||
parsed-outputs)]
|
||||
outputs)]
|
||||
(assoc individual
|
||||
:behaviors parsed-outputs
|
||||
:behaviors outputs
|
||||
:errors errors
|
||||
:total-error #?(:clj (apply +' errors)
|
||||
:cljs (apply + errors)))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user