@iocium/domhash - v0.2.0
    Preparing search index...

    Function compareShapeJaccardGuarded

    • Jaccard similarity with a length-ratio guard: min(jaccard, min(len)/max(len)).

      Plain Jaccard on run-length-encoded shape vectors can be diluted: padding both vectors with a long shared run keeps Jaccard high even when one side has injected content. The length-ratio term keeps the score bounded by how differently sized the two structures are.

      Parameters

      • a: string[]

        First shape vector

      • b: string[]

        Second shape vector

      Returns number

      similarity score between 0 and 1