navit  0.5.3-trunk
linguistics.h File Reference

Go to the source code of this file.

Macros

#define LINGUISTICS_WORD_SEPARATORS_ASCII   " -/()'`"
 

Enumerations

enum  linguistics_cmp_mode { linguistics_cmp_expand =1 , linguistics_cmp_partial =2 , linguistics_cmp_words =4 }
 

Functions

char * linguistics_expand_special (const char *str, int mode)
 Replace special characters in string (e.g. umlauts) with plain letters. This is useful e.g. to canonicalize a string for comparison. More...
 
char * linguistics_next_word (char *str)
 
void linguistics_init (void)
 
void linguistics_free (void)
 
char * linguistics_casefold (const char *in)
 
int linguistics_search (const char *str)
 
int linguistics_compare (const char *s1, const char *s2, enum linguistics_cmp_mode mode)
 Compare two strings, trying to replace special characters (e.g. umlauts) in first string with plain letters. More...
 

Macro Definition Documentation

◆ LINGUISTICS_WORD_SEPARATORS_ASCII

#define LINGUISTICS_WORD_SEPARATORS_ASCII   " -/()'`"

Enumeration Type Documentation

◆ linguistics_cmp_mode

Enumerator
linguistics_cmp_expand 
linguistics_cmp_partial 
linguistics_cmp_words 

Function Documentation

◆ linguistics_casefold()

◆ linguistics_compare()

int linguistics_compare ( const char *  s1,
const char *  s2,
enum linguistics_cmp_mode  mode 
)

Compare two strings, trying to replace special characters (e.g. umlauts) in first string with plain letters.

Parameters
s1First string to process, for example, an item name from the map. Will be linguistics_casefold()ed before comparison.
s2Second string to process, usually user supplied search string. Should be linguistics_casefold()ed before calling this function.
modeset to composition of linguistics_cmp_mode flags to have s1 linguistics_expand_special()ed, allow matches shorter than whole s1, or
letmatches start from any word boundary within s1
Returns
0 when strings are equal

References linguistics_casefold(), linguistics_cmp_expand, linguistics_cmp_partial, linguistics_cmp_words, linguistics_expand_special(), linguistics_next_word(), and s1.

Referenced by binmap_search_get_item(), map_parse_country_binfile(), and match().

◆ linguistics_expand_special()

char* linguistics_expand_special ( const char *  str,
int  mode 
)

Replace special characters in string (e.g. umlauts) with plain letters. This is useful e.g. to canonicalize a string for comparison.

Parameters
strstring to process
modeReplacement mode. 0=do nothing, 1=replace with single UTF character, 2=replace with multiple letters if the commonly used replacement has multitple letter (e.g. a-umlaut -> ae)
Returns
copy of string, with characters replaced

References dbg, linguistics_get_special(), lvl_debug, match(), and next.

Referenced by gui_internal_cmd_pois_item_selected(), gui_internal_find_next_possible_key(), gui_internal_get_match_quality(), item_bin_write_match(), and linguistics_compare().

◆ linguistics_free()

void linguistics_free ( void  )

References casefold_hash, and special_hash.

Referenced by main_real().

◆ linguistics_init()

void linguistics_init ( void  )

◆ linguistics_next_word()

char* linguistics_next_word ( char *  str)

◆ linguistics_search()

int linguistics_search ( const char *  str)

Referenced by item_bin_write_match().