5 #include "linguistics.h"
7 static const char *special[][3]={
8 /* Capital Diacritics */
16 /* ˝ Double Acute Accent */
32 /* ˛ Ogonek (nosinė) */
45 {"Đ","D","DJ"}, /* Croatian Dj, not to be confused with the similar-looking Icelandic Eth */
52 /* ˇ Caron (haček, paukščiukas) */
115 /* special letters */
116 {"Ð","D","DH"}, /* Icelandic Eth, not to be confused with the similar-looking Croatian Dj */
119 /* Small Diacritics */
127 /* ˝ Double Acute Accent */
143 /* ˛ Ogonek (nosinė) */
148 /* ˙ Dot (and dotless i) */
163 /* ˇ Caron (haček, paukščiukas) */
227 /* special letters */
234 linguistics_expand_special(char *str, int mode)
239 out=ret=g_strdup(str);
243 char *next=g_utf8_find_next_char(in, NULL);
247 for (i = 0 ; i < sizeof(special)/sizeof(special[0]); i++) {
248 const char *search=special[i][0];
249 if (!strncmp(in,search,len)) {
250 const char *replace=special[i][mode];
252 int replace_len=strlen(replace);
253 dbg_assert(replace_len <= len);
254 dbg(1,"found %s %s %d %s %d\n",in,search,len,replace,replace_len);
255 strcpy(out, replace);
280 linguistics_next_word(char *str)
282 int len=strcspn(str, " -/()");
283 if (!str[len] || !str[len+1])
289 linguistics_search(char *str)
291 if (!g_strcasecmp(str,"str"))
293 if (!g_strcasecmp(str,"str."))
295 if (!g_strcasecmp(str,"strasse"))
297 if (!g_strcasecmp(str,"weg"))
303 linguistics_init(void)