Skip to content

Instantly share code, notes, and snippets.

@pruet
Created June 3, 2016 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pruet/36c9ae4911222e0a21acd1b9ecd0ca8b to your computer and use it in GitHub Desktop.
Save pruet/36c9ae4911222e0a21acd1b9ecd0ca8b to your computer and use it in GitHub Desktop.
Code to check whether a word/phrase is either Thai or English. In sort, check the first character with isalnum()...
/* convert to tis620, make it compatible with libthai */
my_convert((char *)toStr, length, &my_charset_tis620_thai_ci,
str, length, param->cs,error);
/* Check if this is an english word, if so, add to index directly*/
/* TODO: any better idea than this? */
if(isalnum(toStr[0])) {
ret += add_word(param, str, length);
} else {
/* This is Thai word/pharse */
/* find words boundary *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment