Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

fuzzyphonetic Namespace Reference

fuzzy match library implementation More...


Classes

class  metaphone_keeper

Functions

metaphone_key convert_to_metaphone (const char *word,size_t len,byte_allocator &all)
 converts a single word to the phonetic key memory is allocated on an external allocator
void convert_to_reflection (const char *word,size_t len,byte_allocator &all,reflection_key &reflection)
 converts phrase to reflection
char to_upper (char ch)
 converts the char to upper case
char to_lower (char ch)
 converts the char to lower case
template<class T>
size_t metaphone_distance (const T *ax, size_t x, const T *ay, size_t y, byte_allocator &tmp, size_t max_penalty)
 calculates the matrix distance
size_t find_metaphone_distance (const metaphone_key &x, const metaphone_key &y, byte_allocator &tmp, size_t max_penalty)
 finds the distance between the two metaphone keys
size_t find_reflection_distance (const reflection_key &x, const reflection_key &y, byte_allocator &tmp, size_t max_penalty)
 finds the distance between the two reflection keys
size_t find_word_distance (const char *x, size_t xlen, const char *y, size_t ylen, byte_allocator &tmp, size_t max_penalty)
 finds the distance between the two words
bool is_legal_char (char ch)
bool is_vowel (char ch)
bool check_sub_string (const char *word, const char *pend, const char *ethalon, size_t len)
bool is_slavo_germanic (const char *word, size_t len)
size_t find_key_distance (const metaphone_key &x, const metaphone_key &y, byte_allocator &tmp)

Variables

const ub1_t empty_code = 0xff
const ub1_t blank_code = 0xfe
const ub1_t H_NOTE = 0
const ub1_t TH_NOTE = 1
const ub1_t F_NOTE = 2
const ub1_t P_NOTE = 3
const ub1_t T_NOTE = 4
const ub1_t K_NOTE = 5
const ub1_t S_NOTE = 6
const ub1_t X_NOTE = 7
const ub1_t B_NOTE = 8
const ub1_t N_NOTE = 9
const ub1_t L_NOTE = 10
const ub1_t M_NOTE = 11
const ub1_t W_NOTE = 12
const ub1_t Y_NOTE = 13
const ub1_t R_NOTE = 14
const ub1_t J_NOTE = 15
const ub1_t A_NOTE = 16
const ub1_t legal_mask = 0x10
const ub1_t metaphoneic_mask = 0x0F
const ub1_t lower_mask = 0x20
const ub1_t vowel_mask = 0x40
static const ub1_t metaphoneic_rules [256]


Detailed Description

fuzzy match library implementation

Function Documentation

bool fuzzyphonetic::check_sub_string ( const char *  word,
const char *  pend,
const char *  ethalon,
size_t  len 
) [inline]

Definition at line 173 of file fuzzyphonetic.hpp.

References to_upper().

Referenced by convert_to_metaphone().

void fuzzyphonetic::convert_to_reflection ( const char *  word,
size_t  len,
byte_allocator all,
reflection_key reflection 
)

converts phrase to reflection

Parameters:
word  input word
len  word length
all  external allocator
reflection  [out] reflection

Definition at line 1517 of file fuzzyphonetic.cpp.

References reflection_key::_array, metaphone_key::_array, metaphone_key::_length, byte_allocator::allocate(), convert_to_metaphone(), reflection_key::REFMAX, reflection_key::REFSIZE, and to_upper().

Referenced by fuzzy_matcher_impl::_match(), and fuzzy_matcher_impl::add().

size_t fuzzyphonetic::find_key_distance ( const metaphone_key x,
const metaphone_key y,
byte_allocator tmp 
) [inline]

size_t fuzzyphonetic::find_metaphone_distance ( const metaphone_key x,
const metaphone_key y,
byte_allocator tmp,
size_t  max_penalty 
) [inline]

finds the distance between the two metaphone keys

Parameters:
x  first key
y  second key
tmp  external temporary allocator
max_penalty  max penalty, just a performance tip

Definition at line 213 of file fuzzyphonetic.hpp.

References metaphone_key::_array, metaphone_key::_length, and metaphone_distance().

Referenced by wrapper_find_metaphone_distance().

size_t fuzzyphonetic::find_reflection_distance ( const reflection_key x,
const reflection_key y,
byte_allocator tmp,
size_t  max_penalty 
) [inline]

finds the distance between the two reflection keys

Parameters:
x  first key
y  second key
tmp  external temporary allocator
max_penalty  max penalty, just a performance tip

Definition at line 220 of file fuzzyphonetic.hpp.

References reflection_key::_array, metaphone_distance(), and reflection_key::REFSIZE.

Referenced by wrapper_find_reflection_distance().

size_t fuzzyphonetic::find_word_distance ( const char *  x,
size_t  xlen,
const char *  y,
size_t  ylen,
byte_allocator tmp,
size_t  max_penalty 
) [inline]

finds the distance between the two words

Parameters:
x  first word
xlen  first word length
y  second word
ylen  second word length
tmp  external temporary allocator
max_penalty  max penalty, just a performance tip

Definition at line 226 of file fuzzyphonetic.hpp.

References metaphone_distance().

Referenced by fuzzy_matcher_impl::_match().

bool fuzzyphonetic::is_legal_char ( char  ch  )  [inline]

Definition at line 167 of file fuzzyphonetic.hpp.

References legal_mask, and metaphoneic_rules.

bool fuzzyphonetic::is_slavo_germanic ( const char *  word,
size_t  len 
) [inline]

Definition at line 189 of file fuzzyphonetic.hpp.

References to_upper().

Referenced by convert_to_metaphone().

bool fuzzyphonetic::is_vowel ( char  ch  )  [inline]

Definition at line 169 of file fuzzyphonetic.hpp.

References metaphoneic_rules, and vowel_mask.

Referenced by convert_to_metaphone().

template<class T>
size_t fuzzyphonetic::metaphone_distance ( const T *  ax,
size_t  x,
const T *  ay,
size_t  y,
byte_allocator tmp,
size_t  max_penalty 
) [inline]

calculates the matrix distance

Parameters:
ax  first input array
x  first input array length
ay  second input array
y  second input array length
tmp  external temporary allocator
max_penalty  max penalty, just a performance tip

Definition at line 234 of file fuzzyphonetic.hpp.

References byte_allocator::allocate().

Referenced by find_key_distance(), find_metaphone_distance(), find_reflection_distance(), and find_word_distance().

char fuzzyphonetic::to_lower ( char  ch  )  [inline]

converts the char to lower case

Parameters:
ch  input char

Definition at line 170 of file fuzzyphonetic.hpp.

References legal_mask, lower_mask, and metaphoneic_rules.

Referenced by fuzzy_matcher_impl::_match(), fuzzy_matcher_impl::make_string_lower(), and fuzzy_matcher_impl::reconstruct_string().

char fuzzyphonetic::to_upper ( char  ch  )  [inline]

converts the char to upper case

Parameters:
ch  input char

Definition at line 168 of file fuzzyphonetic.hpp.

References legal_mask, lower_mask, and metaphoneic_rules.

Referenced by check_sub_string(), convert_to_metaphone(), convert_to_reflection(), and is_slavo_germanic().


Variable Documentation

Definition at line 60 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 52 of file fuzzyphonetic.hpp.

Definition at line 46 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 44 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 59 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 49 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 54 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 63 of file fuzzyphonetic.hpp.

Referenced by is_legal_char(), to_lower(), and to_upper().

Definition at line 65 of file fuzzyphonetic.hpp.

Referenced by to_lower(), and to_upper().

Definition at line 55 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 64 of file fuzzyphonetic.hpp.

Definition at line 68 of file fuzzyphonetic.hpp.

Referenced by is_legal_char(), is_vowel(), to_lower(), and to_upper().

Definition at line 53 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 47 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 58 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 50 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 48 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 45 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 66 of file fuzzyphonetic.hpp.

Referenced by is_vowel().

Definition at line 56 of file fuzzyphonetic.hpp.

Definition at line 51 of file fuzzyphonetic.hpp.

Referenced by convert_to_metaphone().

Definition at line 57 of file fuzzyphonetic.hpp.



© Copyright Terimber 2003-.