Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shifucun committed May 17, 2024
1 parent 4966afa commit fdc0bab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nl_server/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ def _rank_vars(candidates: EmbeddingsResult,
dvars.SentenceScore(sentence=c.sentence, score=c.score))
sv2sentences[dcid].add(c.sentence)

# TODO: truncate the score based on model parameters from yaml
# Same model would produce different scores after certain decimals, so we want
# to round to 5 decimal places to make the score and rank stable.
for sv, score in sorted(sv2score.items(),
key=lambda item: (-round(item[1], 6), item[0])):
key=lambda item: (-round(item[1], 5), item[0])):
result.svs.append(sv)
result.scores.append(score)

Expand Down

0 comments on commit fdc0bab

Please sign in to comment.