Switched similaity index
This commit is contained in:
@@ -87,7 +87,18 @@
|
|||||||
(let [fuzzy-match (->> clients
|
(let [fuzzy-match (->> clients
|
||||||
(mapcat (fn [{:keys [:client/matches :client/name] :as client :or {matches []}}]
|
(mapcat (fn [{:keys [:client/matches :client/name] :as client :or {matches []}}]
|
||||||
(map (fn [m]
|
(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))))
|
(conj matches name))))
|
||||||
(filter #(<= (second %) threshold))
|
(filter #(<= (second %) threshold))
|
||||||
(sort-by second)
|
(sort-by second)
|
||||||
|
|||||||
Reference in New Issue
Block a user