mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-07-01 06:29:59 +02:00
Fix a few typos
This commit is contained in:
parent
308165b7eb
commit
6f61e8ec44
4 changed files with 8 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
import math
|
||||
import unicodedata
|
||||
from math import ceil
|
||||
from typing import Union
|
||||
|
||||
from rapidfuzz.distance import Levenshtein
|
||||
|
||||
|
@ -14,7 +15,7 @@ def align(t1, t2):
|
|||
return seq_align(s1, s2)
|
||||
|
||||
|
||||
def score_hint(er: float, n: int) -> int | None:
|
||||
def score_hint(er: float, n: int) -> Union[int, None]:
|
||||
"""Calculate RapidFuzz score hint for a given error rate and count.
|
||||
|
||||
Gives the score hint for the distance functions (= expected distance) or None if
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import unicodedata
|
||||
from typing import Tuple
|
||||
from typing import List, Tuple
|
||||
|
||||
from multimethod import multimethod
|
||||
from uniseg.graphemecluster import grapheme_clusters
|
||||
|
@ -10,7 +10,7 @@ from .extracted_text import ExtractedText
|
|||
|
||||
@multimethod
|
||||
def character_error_rate_n(
|
||||
reference: list[str], compared: list[str]
|
||||
reference: List[str], compared: List[str]
|
||||
) -> Tuple[float, int]:
|
||||
"""
|
||||
Compute character error rate.
|
||||
|
|
|
@ -2,13 +2,14 @@ import unicodedata
|
|||
|
||||
from multimethod import multimethod
|
||||
from rapidfuzz.distance import Levenshtein
|
||||
from typing import List
|
||||
from uniseg.graphemecluster import grapheme_clusters
|
||||
|
||||
from .extracted_text import ExtractedText
|
||||
|
||||
|
||||
@multimethod
|
||||
def distance(seq1: list[str], seq2: list[str]):
|
||||
def distance(seq1: List[str], seq2: List[str]):
|
||||
"""Compute the Levenshtein edit distance between two lists of grapheme clusters.
|
||||
|
||||
This assumes that the grapheme clusters are already normalized.
|
||||
|
|
|
@ -4,7 +4,7 @@ import re
|
|||
import unicodedata
|
||||
from contextlib import suppress
|
||||
from itertools import repeat
|
||||
from typing import Optional
|
||||
from typing import Optional, List
|
||||
|
||||
import attr
|
||||
import numpy as np
|
||||
|
@ -135,7 +135,7 @@ class ExtractedText:
|
|||
segments = attr.ib(type=Optional[list], converter=attr.converters.optional(list))
|
||||
joiner = attr.ib(type=Optional[str])
|
||||
_text = attr.ib(type=Optional[str])
|
||||
_grapheme_clusters = attr.ib(type=Optional[list[str]])
|
||||
_grapheme_clusters = attr.ib(type=Optional[List[str]])
|
||||
|
||||
@segments.validator
|
||||
def check(self, _, value):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue