diff options
author | jacob <jacob@yandex-team.ru> | 2022-02-10 16:49:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:53 +0300 |
commit | 1bf57447b8a115cd60bb6f8509b9b148e1b6debd (patch) | |
tree | b9f3ce9adae968ad4924f36058b631b58ef03e57 /library/cpp | |
parent | 3bf10d3f40b502d181ef52f5c4602c98cb135360 (diff) | |
download | ydb-1bf57447b8a115cd60bb6f8509b9b148e1b6debd.tar.gz |
Restoring authorship annotation for <jacob@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/on_disk/chunks/chunked_helpers.h | 2 | ||||
-rw-r--r-- | library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h | 32 |
2 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/on_disk/chunks/chunked_helpers.h b/library/cpp/on_disk/chunks/chunked_helpers.h index 5fa96afdca..927d79faa9 100644 --- a/library/cpp/on_disk/chunks/chunked_helpers.h +++ b/library/cpp/on_disk/chunks/chunked_helpers.h @@ -554,7 +554,7 @@ public: } size_t GetSize() const { - return (size_t)(SizeofOffsets - 1); + return (size_t)(SizeofOffsets - 1); } size_t GetLength(ui64 index) const { diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h index 8a240bfed8..1303fc7557 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h @@ -1,13 +1,13 @@ #pragma once - + #include <util/draft/matrix.h> -#include <util/generic/algorithm.h> -#include <util/generic/vector.h> +#include <util/generic/algorithm.h> +#include <util/generic/vector.h> #include <util/system/yassert.h> #include <type_traits> #include <utility> - + namespace NLevenshtein { enum EEditMoveType { EMT_SPECIAL, @@ -16,11 +16,11 @@ namespace NLevenshtein { EMT_DELETE, EMT_INSERT }; - + inline bool IsImportantEditMove(EEditMoveType p) { return (p != EMT_SPECIAL && p != EMT_PRESERVE); } - + inline void MakeMove(EEditMoveType t, int& p1, int& p2) { switch (t) { case EMT_PRESERVE: @@ -37,10 +37,10 @@ namespace NLevenshtein { default: break; } - } - + } + using TEditChain = TVector<EEditMoveType>; - + template <typename TArgType> struct TWeightOneUnaryGetter { int operator()(const TArgType&) const { @@ -76,10 +76,10 @@ namespace NLevenshtein { ma[0][0] = std::make_pair(0, EMT_SPECIAL); // starting point for (int i = 1; i <= l1; i++) { ma[i][0] = std::make_pair(ma[i - 1][0].first + deleteWeigher(str1[i - 1]), EMT_DELETE); - } + } for (int i = 1; i <= l2; i++) { ma[0][i] = std::make_pair(ma[0][i - 1].first + insertWeigher(str2[i - 1]), EMT_INSERT); - } + } // Here goes basic Levestein's algorithm for (int i = 1; i <= l1; i++) { for (int j = 1; j <= l2; j++) { @@ -137,8 +137,8 @@ namespace NLevenshtein { if (weight != nullptr) { *weight = ma[l1][l2].first; } - } - + } + template <class TStringType> size_t Distance(const TStringType& str1, const TStringType& str2) { TEditChain editChain; @@ -160,7 +160,7 @@ namespace NLevenshtein { , MisspelledOffset(0) , MisspelledLength(0) { - } + } TReplacement(int correctOffset, int correctLength, int misspelledOffset, int misspelledLength) : CorrectOffset(correctOffset) , CorrectLength(correctLength) @@ -188,5 +188,5 @@ namespace NLevenshtein { } MakeMove(*it, c1, c2); } - } -} + } +} |