本文整理汇总了Python中detector.Detector.check_for_duplicates方法的典型用法代码示例。如果您正苦于以下问题:Python Detector.check_for_duplicates方法的具体用法?Python Detector.check_for_duplicates怎么用?Python Detector.check_for_duplicates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类detector.Detector
的用法示例。
在下文中一共展示了Detector.check_for_duplicates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Moore
# 需要导入模块: from detector import Detector [as 别名]
# 或者: from detector.Detector import check_for_duplicates [as 别名]
#! /usr/bin/env python
# Main near-duplicate detection "runner"
#
# Written by Parker Moore (pjm336)
# http://www.parkermoore.de
import operator, copy
from detector import Detector
if __name__ == "__main__":
# run the program
detector = Detector('./test')
print "Checking for duplicates using NDD..."
duplicates = detector.check_for_duplicates()
if duplicates:
print "Duplicates found (Jaccard coefficient > 0.5):"
print duplicates
print "Printing three nearest neighbors of the first 10 files..."
filenames_of_first_ten = [detector.filename("file%02d.txt") % (f,) for f in xrange(10)]
filenames_of_first_one_hundred = [detector.filename("file%02d.txt") % (f,) for f in xrange(100)]
for index1, j in enumerate(filenames_of_first_ten):
jaccard_coefficients = [0] * 100
for index2, d in enumerate(filenames_of_first_one_hundred):
if index1 != index2:
jaccard_coefficients[index2] = detector.index.get_jaccard(j, d)
three_nearest = []
nearest_count = -1
jcos = copy.deepcopy(jaccard_coefficients)
while len(three_nearest) < 3:
index,coefficient = max(enumerate(jcos), key=operator.itemgetter(1))