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)