LibreOffice Module i18npool (master) 1
|
Weighted Levenshtein Distance (WLD) More...
#include <levdis.hxx>
Public Member Functions | |
WLevDistance (const sal_Unicode *cPattern, int nOtherX, int nShorterY, int nLongerZ, bool bRelaxed) | |
CTor with user input. More... | |
WLevDistance (const WLevDistance &rWLD) | |
~WLevDistance () | |
int | WLD (const sal_Unicode *cString, sal_Int32 nStringLen) |
Calculate the Weighted Levenshtein Distance from string to pattern. More... | |
void | CalcLPQR (int nOtherX, int nShorterY, int nLongerZ, bool bRelaxed) |
Calculate the internal weighs corresponding to the user input values. More... | |
int | GetLimit () const |
int | levdisbalance (sal_Int32 jj, sal_Int32 ii, sal_Unicode c, const sal_Unicode *cString, sal_Int32 nStringLen) const |
Private Member Functions | |
void | InitData (const sal_Unicode *cPattern) |
Static Private Member Functions | |
static int | Mid3 (int x, int y, int z) |
middle value of 3 values More... | |
Private Attributes | |
sal_Int32 | nPatternLen |
length of pattern More... | |
WLevDisPatternMem | aPatMem |
manage allocation of pattern array More... | |
sal_Unicode * | cpPattern |
pointer to pattern array More... | |
bool * | bpPatIsWild |
pointer to bool array whether pattern is wildcard More... | |
sal_Int32 | nArrayLen |
length of distance array More... | |
WLevDisDistanceMem | aDisMem |
manage allocation of distance array More... | |
int * | npDistance |
pointer to distance array More... | |
int | nLimit |
WLD limit replacements/insertions/deletions. More... | |
int | nRepP0 |
replacement weigh More... | |
int | nInsQ0 |
insertion weigh More... | |
int | nDelR0 |
deletion weigh More... | |
int | nStars |
count of '*' wildcards in pattern More... | |
bool | bSplitCount |
if TRUE, Rep/Ins/Del are counted separately More... | |
Weighted Levenshtein Distance (WLD)
For a more detailed explanation see documentation in i18npool/source/search/levdis.hxx
Definition at line 133 of file levdis.hxx.
WLevDistance::WLevDistance | ( | const sal_Unicode * | cPattern, |
int | nOtherX, | ||
int | nShorterY, | ||
int | nLongerZ, | ||
bool | bRelaxed | ||
) |
CTor with user input.
Internally calls CalcLPQR().
After this, obtain the resulting limit using GetLimit().
bRelaxed | the mathematically incorrect method is default (TRUE) |
Definition at line 331 of file levdis.cxx.
References CalcLPQR(), and InitData().
WLevDistance::WLevDistance | ( | const WLevDistance & | rWLD | ) |
Definition at line 344 of file levdis.cxx.
References aDisMem, aPatMem, bpPatIsWild, cpPattern, WLevDisPatternMem::GetbPtr(), WLevDisPatternMem::GetcPtr(), WLevDisDistanceMem::GetPtr(), i, nPatternLen, and npDistance.
WLevDistance::~WLevDistance | ( | ) |
Definition at line 369 of file levdis.cxx.
Calculate the internal weighs corresponding to the user input values.
Definition at line 262 of file levdis.cxx.
References bSplitCount, Mid3(), nDelR0, nInsQ0, nLimit, and nRepP0.
Referenced by WLevDistance().
|
inline |
Definition at line 175 of file levdis.hxx.
References nLimit.
|
private |
Definition at line 297 of file levdis.cxx.
References aDisMem, aPatMem, bpPatIsWild, cpPattern, WLevDisPatternMem::GetbPtr(), WLevDisPatternMem::GetcPtr(), WLevDisDistanceMem::GetPtr(), nPatternLen, npDistance, and nStars.
Referenced by WLevDistance().
|
inline |
Definition at line 181 of file levdis.hxx.
References cpPattern, and nPatternLen.
Referenced by WLD().
middle value of 3 values
Definition at line 285 of file levdis.cxx.
References min(), x, y, and z.
Referenced by CalcLPQR().
int WLevDistance::WLD | ( | const sal_Unicode * | cString, |
sal_Int32 | nStringLen | ||
) |
Calculate the Weighted Levenshtein Distance from string to pattern.
Definition at line 75 of file levdis.cxx.
References aDisMem, bpPatIsWild, bSplitCount, cpPattern, i, levdisbalance(), LEVDISBIG, LEVDISDOUBLEBUF, nArrayLen, nDelR0, WLevDisDistanceMem::NewMem(), nInsQ0, nLimit, nPatternLen, npDistance, nRepP0, and nStars.
|
private |
manage allocation of distance array
Definition at line 140 of file levdis.hxx.
Referenced by InitData(), WLD(), and WLevDistance().
|
private |
manage allocation of pattern array
Definition at line 136 of file levdis.hxx.
Referenced by InitData(), and WLevDistance().
|
private |
pointer to bool array whether pattern is wildcard
Definition at line 138 of file levdis.hxx.
Referenced by InitData(), WLD(), and WLevDistance().
|
private |
if TRUE, Rep/Ins/Del are counted separately
Definition at line 147 of file levdis.hxx.
Referenced by CalcLPQR(), and WLD().
|
private |
pointer to pattern array
Definition at line 137 of file levdis.hxx.
Referenced by InitData(), levdisbalance(), WLD(), and WLevDistance().
|
private |
|
private |
|
private |
|
private |
WLD limit replacements/insertions/deletions.
Definition at line 142 of file levdis.hxx.
Referenced by CalcLPQR(), GetLimit(), and WLD().
|
private |
length of pattern
Definition at line 135 of file levdis.hxx.
Referenced by InitData(), levdisbalance(), WLD(), and WLevDistance().
|
private |
pointer to distance array
Definition at line 141 of file levdis.hxx.
Referenced by InitData(), WLD(), and WLevDistance().
|
private |
|
private |
count of '*' wildcards in pattern
Definition at line 146 of file levdis.hxx.
Referenced by InitData(), and WLD().