Functions | |
int | qArgMake (char *str, char **qlist) |
Split string by space and double quotation(“) then stores each token into token array. | |
int | qArgMatch (char *str, char **qlist) |
Performs token-matching(case insensitive) tests. | |
int | qArgEmprint (int mode, char *str, char **qlist) |
Bold-prints the parts matched((case insensitive) with tokens in a target string. | |
int | qArgPrint (char **qlist) |
Print out all parsed tokens for debugging. | |
void | qArgFree (char **qlist) |
Deallocates qlist generated by qArgMake(). |
A group of functions related to search words classifies query character strings on the basis of spaces and double quotation marks(“) and then stores them in the lists. And it provides a group of functions connected with the matching tests and display of target character strings.
°Ë»ö¾î °ü·Ã ÇÔ¼ö±ºÀº ÁúÀÇ ¹®ÀÚ¿À» ½ºÆäÀ̽º¿Í Å«µû¿ÈÇ¥(“) ±âÁØÀ¸·Î ³ª´©¾î ¸®½ºÆ®¿¡ ´ã¾ÆÁÖ¸ç, ´ë»ó ¹®ÀÚ¿°úÀÇ ¸ÅĪ Å×½ºÆ®¿Í Ãâ·Â¿¡ °ü·ÃµÈ ÇÔ¼ö±ºÀ» Á¦°øÇÑ´Ù.
---- Example -------------------------------------------- Query Input: I am a "pretty girl" --------------------------------------------------------- | | V V ---- qArgMake() ----------------------------------------- qlist[0] = I qlist[1] = am qlist[2] = a qlist[3] = pretty girl qlist[4] = NULL Return: 4 (4 Tokens) --------------------------------------------------------- | | V V ---- qArgPrint() ---------------------------------------- 'I' (1 bytes) 'am' (2 bytes) 'a' (1 bytes) 'pretty girl' (11 bytes) --------------------------------------------------------- | | V V ---- qArgMatch() ---------------------------------------- Target String: Hi, I'm a pretty boy. Are you pretty girl? = = = = =========== 0 0 2 2 3 Return: 3 (3 matches: qlist[0], qlist[2], qlist[3]) --------------------------------------------------------- | | V V ---- qArgEmprint() -------------------------------------- Target String..: Hi, I'm a pretty boy. Are you pretty girl? Result.........: Hi, I'm a pretty boy. Are you pretty girl? = = = = =========== 1 2 3 4 5 Return: 5 (5 matches) ---------------------------------------------------------
int qArgMake | ( | char * | str, | |
char ** | qlist | |||
) |
Split string by space and double quotation(“) then stores each token into token array.
str | key words source string | |
qlist | splitted tokens will be stored here |
char *query="I am a "pretty girl"."; char *qlist[MAX_TOKENS]; int queries; queries = qArgMake(query, qlist);
int qArgMatch | ( | char * | str, | |
char ** | qlist | |||
) |
Performs token-matching(case insensitive) tests.
Counts only once the same tokens even if they are matched repeatedly. Refer to the return value of qArgemprint() for the total matching counts in a character string including repeated matchings. Being divided into a hundred parts by the total number of the tokens acquired at qArgMake(), these values can be used for calculating the search accuracy.
¹®ÀÚ¿¿¡ ´ëÇØ ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐÇÏÁö ¾Ê°í ÅäÅ« ¸ÅĪ Å×½ºÆ®¸¦ ÇÑ´Ù.
°°Àº ÅäÅ«¿¡ ´ëÇؼ´Â Áߺ¹µÇ¾î ¸ÅĪµÇ¾îµµ 1ȸ·Î °è»êÇÑ´Ù. Áߺ¹ ¸ÅĪÀ» Æ÷ÇÔÇÏ¿© ¹®ÀÚ¿³» ÃÑ ¸ÅĪ Ä«¿îÆ®¸¦ À§Çؼ´Â qArgEmprint()ÀÇ º¹±Í°ªÀ» Âü°íÇ϶ó. ÀÌ °ªµéÀº qArgMake()¿¡¼ ¾òÀº ÅäÅ«ÀÇ ÃÑ °³¼ö·Î ¹éºÐÀ²ÇÏ¿© °Ë»ö Á¤È®µµ¸¦ °è»êÇϴµ¥ ¾²ÀÏ ¼ö ÀÖ´Ù.
str | target string to test | |
qlist | query tokens which is generated by qArgMake() |
int qArgEmprint | ( | int | mode, | |
char * | str, | |||
char ** | qlist | |||
) |
Bold-prints the parts matched((case insensitive) with tokens in a target string.
¹®ÀÚ¿¿¡¼ ÅäÅ«°ú ¸ÅĪµÇ´Â ºÎºÐÀ» º¼µå(bold)ó¸®ÇÏ¿© Ãâ·ÂÇÑ´Ù. ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐÇÏÁö ¾Ê´Â´Ù.
mode | same as qPrintf()’s mode value. normally 1 can be used | |
str | target string to print | |
qlist | query tokens which is generated by qArgMake() |
qArgEmprint(1, "Hi, I'm a pretty boy. Are you pretty girl?", qlist);
int qArgPrint | ( | char ** | qlist | ) |
Print out all parsed tokens for debugging.
qlist | query tokens which is generated by qArgMake() |
qArgPrint(qlist);
void qArgFree | ( | char ** | qlist | ) |
Deallocates qlist generated by qArgMake().
qlist | query tokens which is generated by qArgMake() |
qArgFree(qlist);
[Home] [About] [Examples] [Changes] [Download] [SVN Repository] [Install] [Reference] |