mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
committed by
Konstantin Pastbin
parent
c9cbb64f12
commit
76ffc99abd
46
libs/search/approximate_string_match.cpp
Normal file
46
libs/search/approximate_string_match.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "search/approximate_string_match.hpp"
|
||||
|
||||
// TODO: Сделать модель ошибок.
|
||||
// Учитывать соседние кнопки на клавиатуре.
|
||||
// 1. Сосед вместо нужной
|
||||
// 2. Сосед до или после нужной.
|
||||
|
||||
namespace search
|
||||
{
|
||||
using strings::UniChar;
|
||||
|
||||
uint32_t DefaultMatchCost::Cost10(UniChar) const
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
|
||||
uint32_t DefaultMatchCost::Cost01(UniChar) const
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
|
||||
uint32_t DefaultMatchCost::Cost11(UniChar, UniChar) const
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
|
||||
uint32_t DefaultMatchCost::Cost12(UniChar, UniChar const *) const
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
uint32_t DefaultMatchCost::Cost21(UniChar const *, UniChar) const
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
uint32_t DefaultMatchCost::Cost22(UniChar const *, UniChar const *) const
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
uint32_t DefaultMatchCost::SwapCost(UniChar, UniChar) const
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
} // namespace search
|
||||
Reference in New Issue
Block a user