From 51711e06e79f93af3577e3cf328832224236fce8 Mon Sep 17 00:00:00 2001 From: KKGBiz Date: Wed, 24 Apr 2024 11:27:00 +0300 Subject: [PATCH] - notmalize integer output, since cur may contain both int and np.int32 dtypes. If int32 is returned FastAPI can't serialize this type. --- textdistance/algorithms/edit_based.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textdistance/algorithms/edit_based.py b/textdistance/algorithms/edit_based.py index bc75c0a..0a6e02f 100644 --- a/textdistance/algorithms/edit_based.py +++ b/textdistance/algorithms/edit_based.py @@ -126,7 +126,7 @@ def _cycled(self, s1: Sequence[T], s2: Sequence[T]) -> int: dist = self.test_func(s1[r - 1], s2[c - 1]) edit = prev[c - 1] + (not dist) cur[c] = min(edit, deletion, insertion) - return cur[-1] + return int(cur[-1]) def __call__(self, s1: Sequence[T], s2: Sequence[T]) -> int: s1, s2 = self._get_sequences(s1, s2)