From 6f4a499d173d224c078a579d69929b3128783415 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Sat, 22 Jan 2022 07:39:16 -0800 Subject: [PATCH] Switched similaity index --- src/clj/auto_ap/parse.clj | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/clj/auto_ap/parse.clj b/src/clj/auto_ap/parse.clj index 2821ccbc..bd266b5b 100644 --- a/src/clj/auto_ap/parse.clj +++ b/src/clj/auto_ap/parse.clj @@ -87,7 +87,18 @@ (let [fuzzy-match (->> clients (mapcat (fn [{:keys [:client/matches :client/name] :as client :or {matches []}}] (map (fn [m] - [client (m/jaccard (.toLowerCase invoice-client-name) (.toLowerCase m))]) + (let [similarity-index (m/jaccard (.toLowerCase invoice-client-name) (.toLowerCase m)) + similarity-index (cond + (and (= 0 similarity-index) + (= (.toLowerCase invoice-client-name) (.toLowerCase m))) + 0 + + (= 0 similarity-index) + 0.1 + + :else + similarity-index)] + [client similarity-index])) (conj matches name)))) (filter #(<= (second %) threshold)) (sort-by second)