Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-417

Shingle Jaccard Duplicate Check

Problem

Two documents are near-duplicates when the Jaccard similarity of their shingle sets reaches the threshold.

Given two shingle sets and the threshold, return True when the Jaccard similarity is at least the threshold; treat two empty sets as similarity 1.0.

Hint

Compare the Jaccard similarity against the threshold.

Test cases

case 1
in: [["ab","bc"],["bc","cd"],0.3]
expected: true
case 2
in: [["p"],["q"],0.5]
expected: false
case 3
in: [["x","y"],["y","z"],0.6]
expected: false
Starter codePython
def shingle_jaccard_duplicate_check(shingles_a, shingles_b, threshold):
    # Your code here
    pass

3 test cases · run your code against them in the editor