Created
June 3, 2016 15:35
-
-
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()...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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