Fuzzy Text Matching

Challenge

To be able to find a bibtex entry submitted for a paper, when another user has the same paper, however in a slightly different version (marked up PDF, or pre-print vs publisher's version).

Extract text (for example with texttopdf), and use some kind of perceptual hash.

Benchmarks

I got ssdeep and simhash running (both below). SSDeep was able to index 150,000 Wikipedia HTML pages in 10 minutes (using 16% CPU, could probably be parallelized and speeded up a lot), and it correctly recognized one file that had been modified in a few ways in 0.5s.

However, when comparing the output of pdftotext of a pre-print at ijCSCL with the pdftotext of the final article on Springer, it gave a 0 match, whereas Simhash gave .77.

Discussions

General papers

Simhash

Developed by Google, apparently patented by them. A number of implementations.

About (formal)

About (informal)

Implementations

Usage (C implementation)

simhash -w *.txt

write hash for each file to <file>.sim

simhash -c hashfile1 hashfile2

show distance between two hash files (normalized to 0..1)

simhash -m *.txt

output similarity matrix for all files

SSDeep

Usage

ssdeep -p *.txt 

finds all matches among all the files selected

ssdeep *.txt > hashes.txt

writes hashes for each file to stdout (or hashes.txt with redirect)

ssdeep -m hashes.txt newfile.txt 

matches a new textfile to the list of hashes in hashes.txt

PHash

Does images, video and audio, as well as text. Has a Ruby gem. C library has a way of persisting hashes and rapidly matching large numbers, but no Ruby bridge exists.

Bibliographic Hash Key

BibSonomy has apparently developed a way of hashing a bibtex entry to be able to deduplicate publication submissions

Other

Toolbox