From 5228f025079d2904759a8f5c42975d0534a032ef Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Thu, 19 Dec 2019 16:57:26 -0800 Subject: [PATCH] Fixed a/an generation for, for example, "Eurocopter". --- src/main/lemondronor/circlebot.cljs | 4 ++-- src/main/lemondronor/circlebot/generation.cljc | 3 ++- src/test/lemondronor/circlebot/generation_test.cljs | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/lemondronor/circlebot.cljs b/src/main/lemondronor/circlebot.cljs index d4fcb0d..3462051 100644 --- a/src/main/lemondronor/circlebot.cljs +++ b/src/main/lemondronor/circlebot.cljs @@ -296,8 +296,8 @@ :icao 1 :neighbourhood 3 :locality 3}}))] - (log-info "Top description candidates (%s total):" (count results)) - (log-table results [:score :text]) + ;;(log-info "Top description candidates (%s total):" (count results)) + ;;(log-table results [:score :text]) (first results))) diff --git a/src/main/lemondronor/circlebot/generation.cljc b/src/main/lemondronor/circlebot/generation.cljc index 526d4f9..865cacc 100644 --- a/src/main/lemondronor/circlebot/generation.cljc +++ b/src/main/lemondronor/circlebot/generation.cljc @@ -61,7 +61,8 @@ (not (vowels (string/lower-case c)))) (defn starts-with-consonant? [s] - (is-consonant? (subs s 0 1))) + (or (is-consonant? (subs s 0 1)) + (string/starts-with? (string/lower-case s) "eur"))) (def filters diff --git a/src/test/lemondronor/circlebot/generation_test.cljs b/src/test/lemondronor/circlebot/generation_test.cljs index 4873cbb..0637b05 100644 --- a/src/test/lemondronor/circlebot/generation_test.cljs +++ b/src/test/lemondronor/circlebot/generation_test.cljs @@ -80,7 +80,9 @@ (is (= "It is an animal" (generation/generate templates {:thing "animal"}))) (is (= "It is an Animal" - (generation/generate templates {:thing "Animal"}))))) + (generation/generate templates {:thing "Animal"}))) + (is (= "It is a Eurocopter" + (generation/generate templates {:thing "Eurocopter"}))))) ;; (deftest var-paths ;; (is (= "Hello, John"