Commit f0ee8a26 authored by Jim Fulton's avatar Jim Fulton

Chris' changes, I think....

parent 92b0ff07
......@@ -30,7 +30,7 @@ Example usage:
print i['blah']
$Id: InvertedIndex.py,v 1.28 1997/03/31 23:17:53 jim Exp $'''
$Id: InvertedIndex.py,v 1.29 1997/04/08 00:14:22 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
......@@ -82,6 +82,9 @@ $Id: InvertedIndex.py,v 1.28 1997/03/31 23:17:53 jim Exp $'''
# (540) 371-6909
#
# $Log: InvertedIndex.py,v $
# Revision 1.29 1997/04/08 00:14:22 jim
# Chris' changes, I think....
#
# Revision 1.28 1997/03/31 23:17:53 jim
# I put back the list_class hook.
#
......@@ -181,7 +184,7 @@ $Id: InvertedIndex.py,v 1.28 1997/03/31 23:17:53 jim Exp $'''
#
#
#
__version__='$Revision: 1.28 $'[11:-2]
__version__='$Revision: 1.29 $'[11:-2]
import regex, regsub, string, copy
......@@ -362,27 +365,35 @@ class ResultList:
result = self.__class__()
for key,v in self.items():
try: value = x[key]
except KeyError: value=None
if value is None: continue
for key, v in self.items():
try:
value = x[key]
except KeyError:
value = None
positions = v[1]+value[1]
if value is None:
continue
positions = v[1] + value[1]
positions.sort()
positionsr=[]
positionsr = []
rel = pow(v[0] * value[0], 0.5)
pl=positions[0]
rl=-1
for i in range(1,len(positions)):
p=positions[i]
d=p-pl
pl = positions[0]
rl = -1
for i in range(1, len(positions)):
p = positions[i]
d = p - pl
if d > 0 and d <= distance:
if pl != rl: positionsr.append(pl)
if pl != rl:
positionsr.append(pl)
positionsr.append(p)
rl=p
pl=p
result[key]=positionsr
rl = p
pl = p
if (len(positionsr)):
result[key] = positionsr
return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment