@@ -92,10 +92,11 @@ def getLocations(self, text, start, length, asPercentages=False):
92
92
return locations
93
93
94
94
def getMatch (self , match , textA , textB , context ):
95
- wordsA = self .getContext (textA , match .a , match .size , context )
96
- wordsB = self .getContext (textB , match .b , match .size , context )
97
- spansA = self .getLocations (textA , match .a , match .size )
98
- spansB = self .getLocations (textB , match .b , match .size )
95
+ length = match .size + self .ngramSize - 1 # offset according to nGram size
96
+ wordsA = self .getContext (textA , match .a , length , context )
97
+ wordsB = self .getContext (textB , match .b , length , context )
98
+ spansA = self .getLocations (textA , match .a , length )
99
+ spansB = self .getLocations (textB , match .b , length )
99
100
self .locationsA .append (spansA )
100
101
self .locationsB .append (spansB )
101
102
line1 = ('%s: %s %s' % (colored (textA .filename , 'green' ), spansA , wordsA ) )
@@ -121,7 +122,8 @@ def match(self):
121
122
print ('%s total matches found.' % numBlocks , flush = True )
122
123
123
124
for num , match in enumerate (highMatchingBlocks ):
124
- out = self .getMatch (match , self .textA , self .textB , 3 )
125
+ print ('match: ' , match )
126
+ out = self .getMatch (match , self .textA , self .textB , 5 )
125
127
print ('\n ' )
126
128
print ('match %s:' % (num + 1 ), flush = True )
127
129
print (out , flush = True )
0 commit comments