in reply to Re: Fingerprinting text documents for approximate comparison
in thread Fingerprinting text documents for approximate comparison

I downloaded Digest::Nilsimsa and started to toy around with it. What I don't understand, and the referenced site does not explain, is how to get from two 256-bit values to the scale of -128 to +128. Anyone have any thoughts? (I emailed the module author, but since this code is a couple of years old I have no expectation that I will reach him.)
--
Jeff Boes
Database Engineer
Nexcerpt, Inc.
vox 269.226.9550 ext 24
fax 269.349.9076
 http://www.nexcerpt.com
...Nexcerpt...Connecting People With Expertise

Replies are listed 'Best First'.
Re^3: Fingerprinting text documents for approximate comparison
by ww (Archbishop) on Mar 24, 2005 at 19:39 UTC
    Jeff
    back to a doc I don't fully grok... but...

    The scale -128 to +128 appears to be arbitrary and could just as well be 0-255.

    That inference comes from the author's statement re his example output from two slightly variant sources: "The nilsimsa of these two codes is 92 on a scale of -128 to +128. That means that 36 bits are different and 220 bits the same. Any nilsimsa over 24 (which is 3 sigma) indicates that the two messages are probably not independently generated."

    BTW, I attach high value to the observations (below) from BrowserUK and sfink (but am not sure I'm ready to buy (no offense intended, BrowserUK!) BUK's "no easy way" as (1)gospel nor (2, and more important) as any reason not to search for a way.

      no offense intended, BrowserUK!)

      None taken :)

      My statement "no easy way" derives from several attempts that I have had at doing this. I've achieved a degree of success, but it is very easily thrown.

      The problem with reducing your signature to a numerical value is that two identical pieces of text, except one has a spelling error in an otherwise insignificant word, promotes that word to the realms of a 'rare' word. When you now derive your numeric value, that typo can completely change the value derived and so, the two pieces of text no longer compare favourably.

      My best attempt at working around that was to effectively spell check the document. That is to say, I only used words that appeared in my dictionary file when building my lists of N-rare words.

      Whilst that removes typos of common words from being considered rare words, it also excludes many proper nouns and similar that would otherwise form very good components of a signature.

      For example, people's names and place names often form a very strong correlative indicator for news stories, but if you only accept "correctly spelt words" as candidates, then you exclude many names that will likely not appear in your dictionary.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco.
      Rule 1 has a caveat! -- Who broke the cabal?
        maybe this is too dumb for words, but it's late...zzzZzzzzz....

        Couldn't the OP use your technique... AND in parallel, run a m// on the rejected (ie, misspelt, propernames, typos), etc, for a simple correlation of those, and weight the value of the extent into the other? Or does that load this up so heavily that his concern for processing time overwhelms his project?

        .oO noodling...

        And a third test for common-misspellings and typos to eliminate most of their noise? Think I've seen somewhere a "dictionary" of (allegedly statistically sound) typos/misspellings.

      Yeah ... I don't get where he gets "92" from. Like I said, I thought of ANDing the two 256-bit numbers together and counting 1s.
      --
      Jeff Boes
      Database Engineer
      Nexcerpt, Inc.
      vox 269.226.9550 ext 24
      fax 269.349.9076
       http://www.nexcerpt.com
      ...Nexcerpt...Connecting People With Expertise
        re "92" -- 92 decimal = 128 - 36

        re AND
        sprintf to binary, first??
         sprintf (%b,($num0 & $num1))
        then count the "1"s in the return....

        . o O: hope I'm not "teaching my grandparent how to suck eggs."

        (Updated, 28 Mar 05 with addtl refs below:)
        Potentially useful refs:

        http://www3.interscience.wiley.com/cgi-bin/abstract/102525285/ABSTRACT ( J.ASIS&T )

        Approximate Text Addressing (ATA) (qv): referenced in: http://www.springerlink.com/app/home/contribution.asp?wasp=800f3c48701942fcab2e5a0926d5068e&referrer=parent&backto=issue,1,25;journal,738,1955;linkingpublicationresults,1:105633,1 ( Lecture Notes in Computer Science, Publisher: Springer-Verlag GmbH )

        Improved robustness of signature-based near-replica detection via lexicon randomization, https://portal.acm.org/poplogin.cfm?dl=GUIDE&coll=GUIDE&comp_id=1014127&want_href=delivery%2Ecfm%3Fid%3D1014127%26type%3Dpdf&CFID=40869960&CFTOKEN=47922358&td=1112025019666 ( ACM account required ) (and BTW, scholar.google.com finds numerous other papers in the past couple years, but which, like this one, require $$$ accounts).