From b939584c7a915668ce143bf7ece6ad5f8dcb8230 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Mon, 29 Jun 2020 01:45:45 -0700 Subject: [PATCH] quality: fixing typing issues --- src/ocrmypdf/quality.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ocrmypdf/quality.py b/src/ocrmypdf/quality.py index 293173bf..bfb95702 100644 --- a/src/ocrmypdf/quality.py +++ b/src/ocrmypdf/quality.py @@ -15,23 +15,23 @@ # You should have received a copy of the GNU General Public License # along with OCRmyPDF. If not, see . +"""Utilities to measure OCR quality""" + + import re from typing import Iterable -"""Utilities to measure OCR quality""" - class OcrQualityDictionary: """Manages a dictionary for simple OCR quality checks.""" - def __init__(self, *, wordlist: Iterable[str] = []): + def __init__(self, *, wordlist: Iterable[str]): """Construct a dictionary from a list of words. Words for which capitalization is important should be capitalized in the dictionary. Words that contain spaces or other punctuation will never match. """ - self.dictionary = set() - self.dictionary.update(w for w in wordlist) + self.dictionary = set(wordlist) def measure_words_matched(self, ocr_text: str) -> float: """Check how many unique words in the OCR text match a dictionary.