Skip to main content

A Python implementation of the Winnowing (local algorithms for document fingerprinting)

Project description

Winnowing

A Python implementation of the Winnowing (local algorithms for document fingerprinting)

Original Work

The original research paper can be found at http://dl.acm.org/citation.cfm?id=872770.

Installation

You may install winnowing package via pip as follows:

pip install winnowing

Alternatively, you may also install the package by cloning this repository.

git clone https://github.com/suminb/winnowing.git
cd winnowing && python setup.py install

Usage

>>> from winnowing import winnow

>>> winnow('A do run run run, a do run run')
set([(5, 23942), (14, 2887), (2, 1966), (9, 23942), (20, 1966)])

>>> winnow('run run')
set([(0, 23942)]) # match found!

Default Hash Function

Quite honestly, I did not know what hash function to use. The paper did not talk about it. So I decided to use a part of SHA-1; more precisely, the last 16 bits of the digest.

Custom Hash Function

You may use your own hash function as demonstrated below.

def hash_md5(text):
    import hashlib

    hs = hashlib.md5(text)
    hs = hs.hexdigest()
    hs = int(hs, 16)

    return hs

# Override the hash function
winnow.hash_function = hash_md5

winnow('The cake was a lie')

Lower Bound of Fingerprint Density

(TODO: Write this section)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

winnowing-0.2.1.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file winnowing-0.2.1.tar.gz.

File metadata

  • Download URL: winnowing-0.2.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for winnowing-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b74cf6fc2dbe1f3bec7d04ba0f593dc1bdad49553e0c7cec755b99792b512447
MD5 62165000bbe91421f59f49588b5cd30d
BLAKE2b-256 a733447e433810d348f5e435cf1db0537100feb2e03946a119165f77612ff94e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page