- "Score a match between two strings with s1 being reference string"
- (let* ((word-list-1 (split-alphanumeric-string s1))
- (word-list-2 (split-alphanumeric-string s2))
- (n1 (length word-list-1))
- (n2 (length word-list-2))
- (unmatched n1)
- (score 0)
- (nlong 0)
- (nshort 0)
- short-list long-list)
- (declare (fixnum n1 n2 nshort nlong score unmatched))
- (if (> n1 n2)
- (progn
- (setq nlong n1)
- (setq nshort n2)
- (setq long-list word-list-1)
- (setq short-list word-list-2))
- (progn
- (setq nlong n2)
- (setq nshort n1)
- (setq long-list word-list-2)
- (setq short-list word-list-1)))
- (decf score (* 3 (- nlong nshort))) ;; reduce score for extra words
- (dotimes (iword nshort)
+ "Score a match between two strings with s1 being reference string.
+S1 can be a string or a list or strings/conses"
+ (let* ((word-list-1 (if (stringp s1)
+ (split-alphanumeric-string s1)
+ s1))
+ (word-list-2 (split-alphanumeric-string s2))
+ (n1 (length word-list-1))
+ (n2 (length word-list-2))
+ (unmatched n1)
+ (score 0))
+ (declare (fixnum n1 n2 score unmatched))
+ (decf score (* 4 (abs (- n1 n2))))
+ (dotimes (iword n1)