Coverage for app/venv/lib/python3.14/site-packages/weblate/utils/similarity.py: 80%

5 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 07:15 +0000

1# Copyright © Michal Čihař <michal@weblate.org> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4 

5from __future__ import annotations 

6 

7from rapidfuzz import fuzz 

8 

9 

10class Comparer: 

11 """ 

12 String comparer abstraction. 

13 

14 The reason is to be able to change implementation. 

15 """ 

16 

17 def similarity(self, first: str, second: str) -> int: 

18 """Return string similarity in range 0 - 100%.""" 

19 return int(fuzz.QRatio(first, second))