Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue