From b305b48d2bd79d1479ea497e0bf783f7ff33d95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Tue, 10 Oct 2023 20:05:36 +0000 Subject: [PATCH] Fix typos --- evaluate/generate_dataset.py | 2 +- jamspell/spell_corrector.cpp | 8 ++++---- jamspell/spell_corrector.hpp | 4 ++-- tests/test_perfect_hash.cpp | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/evaluate/generate_dataset.py b/evaluate/generate_dataset.py index 819bd6e..dd4cc56 100644 --- a/evaluate/generate_dataset.py +++ b/evaluate/generate_dataset.py @@ -174,7 +174,7 @@ def processSentences(sentences, outFile): def main(): - parser = argparse.ArgumentParser(description='datset generator') + parser = argparse.ArgumentParser(description='dataset generator') parser.add_argument('out_file', type=str, help='will be created out_file_train and out_file_test') parser.add_argument('-lz', '--leipzig', type=str, help='path to file or dir with Leipzig Corpora files') parser.add_argument('-fb2', '--fb2', type=str, help='path to file or dir with files in FB2 format') diff --git a/jamspell/spell_corrector.cpp b/jamspell/spell_corrector.cpp index cfa1de4..f06dd1d 100644 --- a/jamspell/spell_corrector.cpp +++ b/jamspell/spell_corrector.cpp @@ -148,7 +148,7 @@ TWords TSpellCorrector::GetCandidatesRaw(const TWords& sentence, size_t position } void TSpellCorrector::FilterCandidatesByFrequency(std::unordered_set& uniqueCandidates, TWord origWord) const { - if (uniqueCandidates.size() <= MaxCandiatesToCheck) { + if (uniqueCandidates.size() <= MaxCandidatesToCheck) { return; } @@ -163,7 +163,7 @@ void TSpellCorrector::FilterCandidatesByFrequency(std::unordered_set b.first; }); - for (size_t i = 0; i < MaxCandiatesToCheck; ++ i) { + for (size_t i = 0; i < MaxCandidatesToCheck; ++ i) { uniqueCandidates.insert(candidateCounts[i].second); } uniqueCandidates.insert(origWord); @@ -273,8 +273,8 @@ void TSpellCorrector::SetPenalty(double knownWordsPenalty, double unknownWordsPe UnknownWordsPenalty = unknownWordsPenalty; } -void TSpellCorrector::SetMaxCandiatesToCheck(size_t maxCandidatesToCheck) { - MaxCandiatesToCheck = maxCandidatesToCheck; +void TSpellCorrector::SetMaxCandidatesToCheck(size_t maxCandidatesToCheck) { + MaxCandidatesToCheck = maxCandidatesToCheck; } const TLangModel& TSpellCorrector::GetLangModel() const { diff --git a/jamspell/spell_corrector.hpp b/jamspell/spell_corrector.hpp index 299ab52..74c04cc 100644 --- a/jamspell/spell_corrector.hpp +++ b/jamspell/spell_corrector.hpp @@ -20,7 +20,7 @@ class TSpellCorrector { std::wstring FixFragment(const std::wstring& text) const; std::wstring FixFragmentNormalized(const std::wstring& text) const; void SetPenalty(double knownWordsPenalty, double unknownWordsPenalty); - void SetMaxCandiatesToCheck(size_t maxCandidatesToCheck); + void SetMaxCandidatesToCheck(size_t maxCandidatesToCheck); const NJamSpell::TLangModel& GetLangModel() const; private: void FilterCandidatesByFrequency(std::unordered_set& uniqueCandidates, NJamSpell::TWord origWord) const; @@ -37,7 +37,7 @@ class TSpellCorrector { std::unique_ptr Deletes2; double KnownWordsPenalty = 20.0; double UnknownWordsPenalty = 5.0; - size_t MaxCandiatesToCheck = 14; + size_t MaxCandidatesToCheck = 14; }; diff --git a/tests/test_perfect_hash.cpp b/tests/test_perfect_hash.cpp index d0033f7..f037ad3 100644 --- a/tests/test_perfect_hash.cpp +++ b/tests/test_perfect_hash.cpp @@ -16,13 +16,13 @@ TEST(PerfetHashTest, basicFlow) { ph.Init(keys); ASSERT_TRUE(ph.BucketsNumber() < uint32_t(2.0 * keys.size())); - std::set backetsUsed; + std::set bucketsUsed; for (auto&& s: keys) { - backetsUsed.insert(ph.Hash(s)); + bucketsUsed.insert(ph.Hash(s)); } - ASSERT_EQ(keys.size(), backetsUsed.size()); + ASSERT_EQ(keys.size(), bucketsUsed.size()); std::string serialized; { @@ -38,9 +38,9 @@ TEST(PerfetHashTest, basicFlow) { ph2.Load(in); } - backetsUsed.clear(); + bucketsUsed.clear(); for (auto&& s: keys) { - backetsUsed.insert(ph2.Hash(s)); + bucketsUsed.insert(ph2.Hash(s)); } - ASSERT_EQ(keys.size(), backetsUsed.size()); + ASSERT_EQ(keys.size(), bucketsUsed.size()); }