mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-09 11:50:00 +02:00
Revert "Merge pull request #67 from maxbachmann/rapidfuzz"
This reverts commit85f751aacc
, reversing changes made to1febea8c92
.
This commit is contained in:
parent
85f751aacc
commit
76bd50f1db
5 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
from .edit_distance import *
|
||||
from rapidfuzz.distance import Levenshtein
|
||||
from rapidfuzz.string_metric import levenshtein_editops
|
||||
|
||||
|
||||
def align(t1, t2):
|
||||
|
@ -13,7 +13,7 @@ def seq_align(s1, s2):
|
|||
"""Align general sequences."""
|
||||
s1 = list(s1)
|
||||
s2 = list(s2)
|
||||
ops = Levenshtein.editops(s1, s2)
|
||||
ops = levenshtein_editops(s1, s2)
|
||||
i = 0
|
||||
j = 0
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import numpy as np
|
|||
from multimethod import multimethod
|
||||
from uniseg.graphemecluster import grapheme_clusters
|
||||
from tqdm import tqdm
|
||||
from rapidfuzz.distance import Levenshtein
|
||||
from rapidfuzz.string_metric import levenshtein, levenshtein_editops
|
||||
|
||||
from .extracted_text import ExtractedText
|
||||
from .config import Config
|
||||
|
@ -24,7 +24,7 @@ def distance(s1: str, s2: str):
|
|||
"""
|
||||
seq1 = list(grapheme_clusters(unicodedata.normalize("NFC", s1)))
|
||||
seq2 = list(grapheme_clusters(unicodedata.normalize("NFC", s2)))
|
||||
return Levenshtein.distance(seq1, seq2)
|
||||
return levenshtein(seq1, seq2)
|
||||
|
||||
|
||||
@multimethod
|
||||
|
@ -40,4 +40,4 @@ def editops(word1, word2):
|
|||
"""
|
||||
word1 = list(grapheme_clusters(unicodedata.normalize("NFC", word1)))
|
||||
word2 = list(grapheme_clusters(unicodedata.normalize("NFC", word2)))
|
||||
return Levenshtein.editops(word1, word2)
|
||||
return levenshtein_editops(word1, word2)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from rapidfuzz.distance.Levenshtein import distance as levenshtein"
|
||||
"from rapidfuzz.string_metric import levenshtein"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -227,7 +227,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"from rapidfuzz.distance.Levenshtein import editops\n",
|
||||
"from rapidfuzz.string_metric import levenshtein_editops as editops\n",
|
||||
"\n",
|
||||
"editops('Foo', 'Fon')"
|
||||
]
|
||||
|
|
|
@ -6,7 +6,7 @@ from multimethod import multimethod
|
|||
|
||||
import uniseg.wordbreak
|
||||
|
||||
from rapidfuzz.distance import Levenshtein
|
||||
from rapidfuzz.string_metric import levenshtein
|
||||
from . import ExtractedText
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ def word_error_rate_n(reference: Iterable, compared: Iterable) -> Tuple[float, i
|
|||
reference_seq = list(reference)
|
||||
compared_seq = list(compared)
|
||||
|
||||
d = Levenshtein.distance(reference_seq, compared_seq)
|
||||
d = levenshtein(reference_seq, compared_seq)
|
||||
n = len(reference_seq)
|
||||
|
||||
if d == 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue