Skip to content

Commit

Permalink
Merge pull request #125 from szepeviktor/fix-typos
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
bakwc committed Oct 10, 2023
2 parents 5646802 + b305b48 commit 1ece237
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion evaluate/generate_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions jamspell/spell_corrector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ TWords TSpellCorrector::GetCandidatesRaw(const TWords& sentence, size_t position
}

void TSpellCorrector::FilterCandidatesByFrequency(std::unordered_set<TWord, TWordHashPtr>& uniqueCandidates, TWord origWord) const {
if (uniqueCandidates.size() <= MaxCandiatesToCheck) {
if (uniqueCandidates.size() <= MaxCandidatesToCheck) {
return;
}

Expand All @@ -163,7 +163,7 @@ void TSpellCorrector::FilterCandidatesByFrequency(std::unordered_set<TWord, TWor
return a.first > 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);
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions jamspell/spell_corrector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<NJamSpell::TWord, NJamSpell::TWordHashPtr>& uniqueCandidates, NJamSpell::TWord origWord) const;
Expand All @@ -37,7 +37,7 @@ class TSpellCorrector {
std::unique_ptr<TBloomFilter> Deletes2;
double KnownWordsPenalty = 20.0;
double UnknownWordsPenalty = 5.0;
size_t MaxCandiatesToCheck = 14;
size_t MaxCandidatesToCheck = 14;
};


Expand Down
12 changes: 6 additions & 6 deletions tests/test_perfect_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ TEST(PerfetHashTest, basicFlow) {
ph.Init(keys);

ASSERT_TRUE(ph.BucketsNumber() < uint32_t(2.0 * keys.size()));
std::set<size_t> backetsUsed;
std::set<size_t> 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;
{
Expand All @@ -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());
}

0 comments on commit 1ece237

Please sign in to comment.