diff python/utils.py @ 323:efd4dd4665ac

corrected issues with large deltas
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 08 May 2013 00:19:28 +0200
parents 28661c5887d3
children 99ca91a46007
line wrap: on
line diff
--- a/python/utils.py	Tue May 07 18:43:40 2013 +0200
+++ b/python/utils.py	Wed May 08 00:19:28 2013 +0200
@@ -210,11 +210,11 @@
         l2 = _l2
     n1 = len(l1)
     n2 = len(l2)
-    # for i in xrange(delta, n1+n2-delta): # i is the alignment of the end of l1 in l2
+    # for i in xrange(min(delta,n1), max(n1+n2-delta, n2+1)): # i is the alignment of the end of l1 in l2
     #     print l1[min(-i-1,n1):] # min(n1+n2-i,n1)
     #     print l2[max(0,i-n1):]
     #     print LCSS(l1[min(-i-1,n1):], l2[max(0,i-n1):], threshold, distance, delta)
-    lcss = [LCSS(l1[min(-i-1,n1):], l2[max(0,i-n1):], threshold, distance, delta) for i in xrange(delta, n1+n2-delta)]
+    lcss = [LCSS(l1[min(-i-1,n1):], l2[max(0,i-n1):], threshold, distance, delta) for i in xrange(min(delta,n1), max(n1+n2-delta, n2+1))]
     return max(lcss)
 
 def normalizedAlignedLCSS(l1, l2, threshold, distance, delta, lengthMethod = min):