Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-153

STS Similarity Label

Problem

Map a similarity score to an integer STS label from 0 to 5 using fixed thresholds: below 0.2, then below 0.4, 0.6, 0.8, and 0.95, else 5.

A score exactly on a threshold falls into the higher bucket.

Hint

Chain the strict less-than checks so boundary values fall through.

Test cases

case 1
in: [0.1]
expected: 0
case 2
in: [0.3]
expected: 1
case 3
in: [0.6]
expected: 3
case 4
in: [0.95]
expected: 5
case 5
in: [1]
expected: 5
case 6
in: [0.2]
expected: 1
Starter codePython
def sts_similarity_label(similarity):
    # Your code here
    pass

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