how to gernerate the fingerprints of a documents in python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spaingermany
    New Member
    • Sep 2008
    • 1

    #1

    how to gernerate the fingerprints of a documents in python

    i want to write a application for detecting near to duplicate document using rabin karp algorithm for generating fingerprint technique.
    please any body can write a small code to generate fingerprints of a document using this algorithm or winnowing algorithm in python script.
    please help me as soon as possible
    thanks
  • kudos
    Recognized Expert New Member
    • Jul 2006
    • 127

    #2
    Hi! Wasn't that algorithm something like this:

    import hashlib

    def rabinkarp(s0,s1 ):
    n = hashlib.md5(s0) .hexdigest()
    m = hashlib.md5(s1) .hexdigest()
    for i in range((len(s1)-len(s0)+1)):
    if(m == n):
    return True;
    m = hashlib.md5(s1[i:i+len(s0)]).hexdigest()
    return False

    print rabinkarp("tedd y","I just want to be your teddy bear")

    (it should return true :)

    -kudos

    Comment

    Working...