`
`PATENT
`Docket No.: 4428-4001
`
`main(int argc, char *argv[])
`
`{ i
`
`nt i= 0;
`
`/*if (argc != 5)
`
`{p
`
`rintf("Usage Instructions: dialog config_file learn_file\n");
`printf("*** Exiting, goodbye.\n");
`exit(1);
`}*/
`if (arge |= 2)
`
`printf("Usage Instructions: d <ini-file>\n");
`printf("*** Exiting, goodbye.\n");
`exit(1);
`}
`readini(argv[1));
`formfile = fdoc;
`loadStopWords(sdoc);
`numPF = loadFormsList(xdoc);
`numForms = loadForms(fdoc);
`loadData(cfg,Icfg);
`Interactive(Icfg);
`
`[MR ee ek EAR AE ERE ERE REE EES EE REAE EE ES ELLE EES EEE EERE EEE ERE EEL ES
`loaddata : This function will read the configuration files and load the
`information into the relevant global arrays.
`EA SRRRROA A AEEOO 2Ek A oo ook oo ae a oe eo oR a aK /
`loadData(char *filenm, char *file2)
`
`{c
`
`har buf[256], word[20];
`int i, j, k, |;
`int numext;
`FILE*fp, *£2;
`
`[FRERERER EAH RAE 2RE ok open configuration file a AaR oeoeaeaeo2 EEEO oO/
`fp = fileOpen(filenm, "r");
`
`|diadnniediadadiaiaiedlaaiedeiial open learn(extended thesaurus) file HEFNER HEER
`f2 = fileOpen(file2, "r'');
`
`728851 vi
`
`77
`
`(cid:23)(cid:27)(cid:19) PETITIONERS - EXHIBIT 1002 - Part 3 of 3
`480
`PETITIONERS- EXHIBIT 1002 - Part 3 of 3
`IPR2022-00217
`
`IPR2022-00217
`
`
`
`;
`
`'
`
`102993559 .111902e
`
`PATENT
`Docket No.: 4428-4001
`
`prompts = columnTerms = rowTerms = NULL;
`scoring = thesaurus = indexList = menuList = NULL;
`
`/* read data in the arrays */
`numMenu = loadMenuTree(fp, "[MENUTREE]");
`numIndex = readArray(fp, "[PROMPTS]", &prompts, 1, NULL,0, 0);
`numColumn = readArray(fp, "[INDEX]", &columnTerms, 1, &indexList, numIndex, 0);
`numOrgRow = readArray(fp, "[THESAURUS]", &rowTerms, 1, &thesaurus, numColumn,0);
`numRow = readArray(f2, "[EXT-THESAURUS]", &rowTerms,1, &thesaurus, numColumn,
`numOrgRow);
`numScore = readArray(f2, "[SCORING]", NULL,0, &scoring, numColumn + 1, 0);
`
`felose(fp);
`fclose(f2);
`
`} [
`
`A ARIAC HEH HHA RK EAH RAK EEK K ERE EERE KE REE ERA AK A HERE
`readArray : Readsthe file and fills the rows and columnsof the given arrays
`AEE A AE AE A A AR Be A A Ae Ae AE A AE oe A AG AE Ae A A 6 AE AG Ae A a ea ARAA 2 ee AS a aS oe Ea aE Oo A Oo a
`int readArray(FILE * fp, char *head, char ***ch_array, int ccount, int ***int_array, int icount,int
`sp)
`
`{ c
`
`har buf[256];
`inti, j, start = 0, we = 0;
`int k, ¢;
`char **tmparray; /*To store the pointers to the words/numbers from the string*/
`c= sp;
`
`if (icount != 0)
`tmparray = (char **)malloc((icount + 1) * sizeof(char *));
`
`fseek(fp, 0, 0); /* Go to Top */
`
`while (fgets(buf, 255, fp) != NULL)/* read linestill end of file */
`
`{ a
`
`llTrim(buf);
`j =Strlen(buf);
`if (buffj - 1] = '\n') buffy - 1] =0;
`if (start)
`
`{ i
`
`f (strlen(buf) = 0) /* if blank line, stop reading */
`break;
`if (icount = 0) /* i.e, no integer array */
`
`728851 vi
`
`78
`
`(cid:23)(cid:27)(cid:20)
`481
`
`
`
`LO2PS9S59 .2t11902
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`addWord(ch_array, buf, ++c);
` /* read first word string */
`{
`/* rest are columnsofint array */
`we = readValues(buf, tmparray);
`ct:
`(*int_array) = (int **)realloc(*int_array, c * sizeof(int *));
`(*int_array)[c - 1] = (int *)malloc(icount * sizeof(int));
`if (ccount != 0)
`addWord(ch_array, tmparray[0], c);
`
`else
`
`(*int_array)[c - 1][0] = atoi(tmparray[0]);
`for (k = 1; k <icount; k++)
`if (k< we)
`(*int_array)[c - 1][k - ccount] = atoi(tmparray[k));
`
`else
`
`(*int_array)[c - 1][k - ccount] = 0;
`
`}
`
`}
`
`else
`if (!stremp(head, buf))
`start = 1;
`
`}
`return c;
`
`} |
`
`AAR AAAEaA2OE OE
`loadMenuTree : loads the menutree from file to menuList array
`SRA ORaA A COee 2 eA He ee EeeeEe Ae AA Ee EE A 2 E
`int loadMenuTree (FILE *fp, char *head)
`
`/
`
`{ c
`
`har buf[256];
`int i, j, start = 0, count = 0;
`fseek(fp, 0, 0);
`while (fgets(buf, 255, fp) != NULL)
`
`j=strlen(buf);
`if (buf]j - 1] = "\n')
`buffj - 1] =0;
`
`if (start)
`
`{i
`
`f (strlen(buf) = 0)
`break;
`menuList = (int **)realloc(menuList, (count + 1) * sizeof(int *));
`
`728851 vt
`
`79
`
`(cid:23)(cid:27)(cid:21)
`482
`
`
`
`sO
`
`10299359 .a41902
`
`PATENT
`Docket No.: 4428-4001
`
`menuList[count] = (int *)malloc(3 * sizeof(int));
`sscanf(buf, "%d,%d,%d\n"", &menuList[count][0],
`&menuList[count][1],&menuList[count][2]);
`count++;
`}
`
`if (!stremp(head, buf))
`start = 1;
`
`else
`
`}
`return count ;
`}
`
`readini(char * filenm)
`{
`
`FILE * fp;
`char buf]80], key[80], value[80], comment[80];
`int cnt;
`if ((fp=fopen(filenm,"r"))==NULL)
`{
`
`perror(filenm);
`exit(1);
`
`} w
`
`hile (fgets(buf,79, fp)!=NULL)
`
`sscanf(buf,"%s %s %s",key,value, comment);
`if (!stremp(key, "sdoc"))
`sdoc=strdup(value);
`if (!stremp(key, "fdoc"))
`fdoc=strdup(value);
`if (!stremp(key, "xdoc"))
`xdoc=strdup(value);
`if ('stremp(key, "cfg"))
`cfg=strdup(value);
`if (!stremp(key, "Icfg"))
`Icfg=strdup(value);
`if (!stremp(key, "minprompt"))
`minPromptCount=atoi(value);
`if (!stremp(key, "timeout"))
`timeout=atoi(value);
`
`}
`
`728851 vi
`
`80
`
`(cid:23)(cid:27)(cid:22)
`483
`
`
`
`,
`
`.
`
`Ae VOsso .1tALsVore
`
`PATENT
`Docket No.: 4428-4001
`
`interactive.c: This program contains funtions related to user interaction
`[FRAEREAREAAE AERA EREREREEE ER ERE ES EEREEES ERE EERE REE EEE OEEEEA HH ESE HEH
`Interactive : function to accept a sentence from the user and then
`generate the response.
`
`thesaurusFlag = is 1 if there is atleast 1 thesaurus/learned word in query
`updateFlag = is set to | if the program needs to learn (i.e. main menu was
`selected during the prompt navigation)
`interPrompts = Intersection of prompts
`unionPrompts = Union ofprompts
`interUnionPrompts = Intersection of Union
`numInter = number of prompts in InterPrompts
`numInterUnion = num of prompts in Intersection of Union
`numUnion = num of prompts in Union
`numUnknown = num of unknown words
`oe fe ee ee oe ee he 2 oe oe ee eo aoe feae oeee oe ee ee ee ee OR Aee EE EE AE Ef
`
`#include <stdio.h>
`#include <signal.h>
`#include <string.h>
`#include <unistd.h>
`#include "globalvar.h"
`#include "arraylib.h"
`#include “forms.h"
`
`#define max(a,b) (a>b)? a:b
`#define min(a,b) (a <b)? a: b
`#define swap(a,b) (a “= b, b “=a, a *= b)
`
`extern int numScore, **scoring;
`int updateFlag = 0, leamFlag, numQueryList = 0;
`FILE *If, *pf.
`char ** uWList=NULL, *queryTerms[50];
`int uWNum;
`extern int minPromptCount, timeout;
`char query[256], **queryList = NULL;
`char *affrmWords[] = { "yes", "nght", "correct"};
`char *negWords[] = { "no", "neither"};
`extern char * fdoc;
`int otheFlag = 0;
`int unknownWords[20], numQuery = 0, numUnknown;
`char **uWords;
`// Added this array to facilitate learning wven if lateral shift
`int numUW;
`// Added this to facilitate learning wvenif lateral shift
`void sayOther();
`
`728851 vi
`
`81
`
`(cid:23)(cid:27)(cid:23)
`484
`
`
`
`LO2GSGS59 .ALIIWBe2
`
`PATENT
`Docket No.: 4428-4001
`
`void Interactive(char *flnm)
`
`int InterPrompts[20], unionPrompts[20], t] Prompts[20);
`int interUnionPrompts[20], numIinterUnion, t2Prompts[20], numT2;
`inti, j, k, 1;
`int start, numUnion, numInter, numT1;
`int n, selectedPrompt, thesaurusFlag = 0;
`char *interlog, *processlog,c;
`
`numUnknown = numUW =0;
`for(i=0; 1 < 20; 1++)
`unknownWords[1] = 0:
`uWords=NULL;
`
`if ((interlog = (char *)getenv("TIMEOUT")) != NULL)
`timeout = atoi(interlog);
`
`if ((interlog = (char *)getenv("MINPROMPT")) != NULL)
`minPromptCount= atoi(interlog);
`
`if ((interlog = (char *)getenv("INTERLOG")) = NULL)
`interlog = "test.htm]";
`
`if ((processlog = (char *)getenv("PROCESSLOG")) = NULL)
`processlog = "process.html";
`
`signal(SIGALRM, &sayOther);
`If = fileOpen(interlog,"w");
`
`pf = fileOpen(processlog,"w");
`fprintf(lf, "“<HTML>\n<TITLE>%s</TITLE>\n<BODY><FONT SIZE=5>\n", interlog);
`fprintf(pf, "“<HTML>\n<TITLE>%s</TITLE>\n<BODY><FONT SIZE=5>\n", processlog);
`
`system("clear");
`printf("Thank you for calling the New Herald.\n");
`printf("How may we help you?\n\n");
`fprintf(If,"\nThank you for calling the New Herald.<BR>");
`fprintf(lf,"How may we help you. <P>");
`fgets(query, 255, stdin);
`/* accept the user input */
`
`while (1)
`{
`
`728851 vi
`
`82
`
`(cid:23)(cid:27)(cid:24)
`485
`
`
`
`’
`
`’
`
`LO2PS9S59 .ALAgGoe
`
`PATENT
`Docket No.: 4428-4001
`
`addWord(&queryList, query, ++numQueryList);
`numQuery = thesaurusFlag = 0;
`if (strlen(query) = 0)
`break;
`fprintf(lf, "<I> %s</I> <P>", query);
`
`numQuery = createArray(query, queryTerms);
`
`[9EE a aEE AeA oRRE ER EE EE EE EH EE EH/
`fprintf(pf, "Terms in Query: ");
`for (j = 0; j < numQuery; j++)
`fprintf(pf, " %s", queryTerms{j]);
`fprintf(pf, "<BR>");
`[FE EEAEEEEEE EE EE EE EEE EE
`
`/* initialize InterPrompts and unionPrompts array */
`for (i = 0; 1< 20; i++)
`
`i t
`
`2Prompts[i] = tlPrompts{i] = 0;
`InterPrompts[i] = unionPrompts{i] = interUnionPrompts[i] = 0;
`
`start = 1:
`numInterUnion = numT2 = numT1 = numInter = numUnion = 0;
`
`/* Scan thru all the words to generate union/intersection of prompts*/
`for (i = 0; i < numQuery;i++)
`
`/* if not in index words check thesaurus */
`if (tinArray(columnTerms, queryTerms[i], numColumn))
`
`{ l
`
`earnFlag = numT1 = numT2 = 0;
`scanThesaurus(queryTerms{i], tl Prompts, t2Prompts, &numT 1,
`
`&numT2);
`
`/* if unknown/learned word save it to array */
`if (learnFlag)
`
`unknownWords[numUnknown] = 1, numUnknown++;
`addWord(&uWords, queryTerms[i], ++numUW);
`if (numT 1 = 0 && numT2 — 0)
`continue;
`
`else
`
`}
`
`thesaurusFlag = 1;
`
`72885! vi
`
`83
`
`(cid:23)(cid:27)(cid:25)
`486
`
`
`
`;
`
`LOSSSs5S .ALASoe2
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`}
`
`else
`
`thesaurusFlag = 1;
`
`numT | = fetchPrompts(queryTerms[i], tl Prompts);
`numT2 = fetchPrompts(queryTerms{[i], t2Prompts);
`[RRRREEREREERE EAE SES FER EEE REEER EEE AEA EE ERE EE EEE/
`fprintf(pf, "%s (index) :", queryTerms[1]);
`for (j = 0; j <numT1; j++)
`fprintf(pf, " %d", tl Prompts{j]);
`fprintf(pf, "<BR>");
`fflush(pf);
`[7 a A ee oe A eH HH AAER AREA AeA/
`}
`
`if (start) /* if first word */
`
`{ n
`
`umInter = PromptUnion(InterPrompts, t2Prompts, numInter, numT2);
`numUnion = PromptUnion(unionPrompts, tl! Prompts, numUnion,
`
`numT 1);
`
`numInterUnion = PromptUnion(interUnionPrompts, tl Prompts,
`numiInterUnion, numT 1);
`start = 0;
`}
`
`{ n
`
`else
`
`umInter = PromptIntersection(InterPrompts, t2Prompts, numinter,
`
`numT2);
`
`numT 1);
`
`numUnion = PromptUnion(unionPrompts,tl Prompts, numUnion,
`
`numInterUnion = Promptintersection(interUnionPrompts, tl Prompts,
`numInterUnion, numT1);
`
`}
`
`[EEER RE aA EE TR HE HE EE EE EER EEA REE EAE EER EEA/
`fprintf(pf, "Final Intersection Result: ");
`for (j = 0; j < numInter; j++)
`fprintf(pf," %d", InterPrompts[j]);
`fprintf(pf, "<BR>");
`fprintf(pf, "Final Intersection of Union Result: ");
`for (j = 0; | < numInterUnion; j++)
`
`728851 v1
`
`84
`
`(cid:23)(cid:27)(cid:26)
`487
`
`
`
`LOes9Sss9 ,.ALAIoe
`
`PATENT
`Docket No.: 4428-4001
`
`fprintf(pf, " %d", interUnionPrompts[j]);
`fprintf(pf, "<BR>");
`fprintf(pf, "Final Union Result: ");
`for (j = 0;j <numUnion; j++)
`fprintf(pf, " Yd", unionPrompts[j]);
`fprintf(pf, "<BR>");
`fflush(pf);
`[ERA a ARE RE HE FE a /
`
`if (numInter < minPromptCount && thesaurusFlag)
`
`if (numInterUnion < minPromptCount)
`numInter = PromptUnion(InterPrompts, unionPrompts, numInter,
`
`numUnion);
`
`else
`
`numinter, numInterUnion);
`}
`
`numInter = PromptUnion(InterPrompts, interUnionPrompts,
`
`fprintf(pf, "Final Selection : ");
`fflush(pf);
`for (j = 0; } < numInter; j++)
`fprintf(pf, " %d", InterPrompts[j]);
`fprintf(pf, "<BR>");
`fflush(pf);
`numinter = orderPrompts(InterPrompts, numInter);
`numInter = removeChild(InterPrompts, numInter);
`// eliminate prompts > 3
`for (j = 3; j < numInter; j++)
`InterPrompts[j] = 0;
`numInter = min(numiInter, 3);
`fprintf(pf, “Selection After Elimination of descendants: ");
`fflush(pf);
`for (j = 0; j < numInter; j++)
`fprintf(pf, " Yd", InterPrompts[j]);
`fprintf(pf, "<BR>");
`fflush(pf);
`selectedPrompt = GetPrompt(InterPrompts, numInter);
`if (selectedPrompt == 100)
`continue;
`
`// if (updateFlag)
`learnThesaurus(selectedPrompt, unknownWords, numUnknown,flnm);
`
`728851 vi
`
`85
`
`(cid:23)(cid:27)(cid:27)
`488
`
`
`
`:
`
`‘
`
`LO2BEsS9 .4a4LA19g0e2
`
`PATENT
`Docket No.: 4428-4001
`
`updateFlag = 0;
`for(j = 0; (j < numMenu) && (menuList[j}[1] != selectedPrompt); j++);
`if (menuList[j][2] >= 99)
`
`{ f
`
`or (i= 0; i <numPF;i++)
`
`if (!stremp(Fprompts{i][1],prompts[selectedPrompt- 1}))
`
`for(k = 0; k <numForms;k++)
`if (!stremp(Fprompts[i}[0],formlist[k]->name))
`
`fillForm(formlist[k], queryList, numQueryList);
`processForm(formlist[k]);
`break;
`
`break;
`}
`
`}
`if (i = numPF)
`
`system("clear");
`printf("\nYour query has been understood.\n");
`printf("Please wait to be transferred to the relevant department.\n\n");
`fprintf(lf,"<P>Your query has been understood.<LI>");
`fprintf(f,"Please wait to be transferred to the relevant department.<HR>");
`break;
`}
`
`{ p
`
`rintf("\n%s\n\n",prompts[menuList[j][2] - 1]);
`fprintf(lf, "\n<P>%s<HR=>",prompts[menuList[j][{2] - 1]);
`
`else
`
`// modified for the loop
`printf("Do you have another query?\n\n");
`fgets(query,80,stdin);
`if (IchkNegtn(query))
`
`{f
`
`or(i = 0; 1 <numQueryList; i++)
`free(queryList[1i]);
`for(i = 0; i< numForms;i++)
`free(formilist[i});
`free(formlist);
`
`72885) vi
`
`86
`
`(cid:23)(cid:27)(cid:28)
`489
`
`
`
`‘
`
`10CE9359 .A1i190e
`
`PATENT
`Docket No.: 4428-4001
`
`free(queryList);
`queryList = NULL;
`numForms = loadForms(fdoc);
`numQueryList = 0;
`//printf("Please tell us your query.\n\n");
`//fgets(query,255,stdin);
`continue;
`}
`system("clear");
`pnintf("\nThank you for calling.\nGoodbye.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
`break;
`
`} f
`
`printf(lf, "</HTML>\n</BODY>\n");
`fprintf(pf, "</HTML>\n</BODY>\n");
`fclose(If);
`fclose(pf);
`
`} i
`
`nt scanThesaurus(char *word, int *t1 Prompts, int *t2Prompts, int* nl, int * n2)
`{
`int i,j, k= 0, 1;
`int m, tp[20], sflg = 1;
`
`for (i= 0; 1 < 20; i++)
`t1Prompts[i] = t2Prompts[i] = tp[i] = 0;
`
`for (] = 0; 1 < numRow; I++)
`if (!stremp(word, rowTerms[1]))
`break;
`/* if the word is not present in thesaurus */
`if (1 = numRow)
`
`{ f
`
`printf(pf, "Ys (unknown) <BR>", word);
`leamFlag = 1;
`.
`return 0;
`}
`
`{i
`
`f (1 >= numOrgRow)
`
`else
`
`{ f
`
`printf(pf, "Ys (leamed):<BR>", word);
`
`728851 vi
`
`87
`
`(cid:23)(cid:28)(cid:19)
`490
`
`
`
`LOeSISSS9 .441902
`
`PATENT
`Docket No.: 4428-4001
`
`leamFlag = 1;
`
`} f
`
`else
`
`printi(pf, "%s (thesaurus):<BR>", word);
`
`for (j = 0; thesaurus[!][j] && j < numRow;j++)
`
`m = fetchPrompts(columnTerms|thesaurus[!][j] - 1], tp);
`[EEA RA EAR IRA EEE IA EE RR AE AK AE FEI KEES KAI /
`fprintf(pf, "<LI>%s(index) :", columnTerms([thesaurus[1][j] - 1]);
`for (k = 0; k <m; k++)
`fpnntf(pf, " %d", tp[k]);
`fprintf(pf, "<BR>");
`PABBA AOE IEEE OOH SISOS IIR II OR AKIRA HA /
`
`*nl = PromptUnion(t! Prompts, tp, *n1, m);
`if (sflg)
`
`*n2 = PromptUnion(t2Prompts,tp, *n2, m);
`sflg = 0;
`}
`
`{ *
`
`}
`
`else
`
`n2 = Promptintersection(t2Prompts, tp, *n2, m);
`
`}
`fprintf(pf, "Union Result: ");
`for (k = 0; k <*n1; k++)
`fprintf(pf, " %d", t1 Prompts[k]);
`fprintf(pf, "<BR>");
`fprintf(pf, "Intersection Result: ");
`for (k = 0; k< *n2: k++)
`fprintf(pf, " %d", t2Prompts[k]);
`fprintf(pf, "<BR>");
`}
`
`retum k;
`
`|ectaiks dia dlchatadodielaedinledindiadaaiediadidediainiledediedadiniaiidiadiadladadiedicidiadediedidiadnaiaididinaiaiealadadidediadniaininied
`PromptUnion: does a union of arrays pointed by pl and p2 and
`stores in pl. returns the total elementsin result
`ee ee fe fe oe fee oe fe oe oe ae oe oeRE oe eo oe WAR ERA RAAAA EE RH|
`
`728851 vi
`
`88
`
`(cid:23)(cid:28)(cid:20)
`491
`
`
`
`’
`
`g
`
`10299359 ,.411902
`
`PATENT
`Docket No.: 4428-4001
`
`int PromptUnion(int *p1, int *p2, int nl, int n2)
`
`{i
`
`nt i, j;
`for (i = 0; 1<n2; i++)
`
`for (j = 0; j < nl; j++)
`if (p1{j] = p2[i])
`break;
`if (jn)
`
`pl) = p2[i);
`nl++;
`}
`
`}
`retum nl;
`
`} O
`
`BB OIGCI IIC II IACIFI ICG IIIA IO ICICI IO IU ICR II IGE 2 AOR aC I aCe AC a
`Promptintersection : does a intersection of arrays pointed by p! and p2 and
`stores in pl, returns the total elements in result
`EE RREEE EE EE EA AE EE AEE EE EE EE EE A REA RE EK EE ER /
`int Promptintersection(int *p1, int *p2, int n1, int n2)
`
`{ i
`
`nt i, j;
`for (i= 0; i<nl; it+)
`
`{ f
`
`or (j = 0; j <2; j++)
`if (p1[i] = p2U)])
`break;
`if (j —=n2) /* not there */
`
`for (j =i; j < nl; j++)
`pl{j]=pl+ 1);
`
`nl--;
`I--;
`}
`
`}
`return n1;
`
`[RRRRAK RA ER EERE RA RARE EER ERE AER AERA A ERA ERA AREA RARER EERE REAR AK HE ER
`fetchPrompts : Will fetch all the prompts for ‘word!’into
`Arraylist pointed by tl Prompts;
`HEREEEEEEEREEEAEEEREEEESEREREEEEER ERE EE EEE SE EEE ERE EES ERE ES EEA EES/
`
`728851 vi
`
`89
`
`(cid:23)(cid:28)(cid:21)
`492
`
`
`
`:
`
`‘
`
`LDE99S59 .11190e2
`
`PATENT
`Docket No.: 4428-4001
`
`int fetchPrompts(char *word, int *t1Prompts)
`{
`int 1, j, k,J;
`for (i = 0; i< 20; i++)
`tlPrompts[i] = 0;
`if ((i = inArray(columnTemns, word, numColumn)) == 0)
`return 0;
`
`= f
`
`or (j = 0; (t1Prompts[j] = indexList[i][j]) && Gj < numIndex); j++);
`retum j;
`
`} [
`
`PERE ERK AER AR EEE REE ARE EE EAE AREAL EE EEE ES EK EERE RE KEE EEE EE
`GetPrompt: Retumsthe final prompt selected by user
`AREa ee oR ek eo aOO HERE EE EEE RE RAAK EEE KAA RAE EA ARE EAE AE|
`int GetPrompt(int *Parray, int pent)
`{
`int i, J, k, 1;
`int mmflag = 0, af = 0;
`char ans[80];
`
`while (1)
`
`{ s
`
`ystem("clear");
`printf("\n");
`fprintf(lf, "<P>");
`// Removed the commentsto reintroduce last prompt
`if (pent = 1 && isLeaf(Parray[0]) && numUnknown > 0)
`af=1;
`if Steereeen teeta manasareoserena ze
`if ((pent > 1) || (pent = 1 && af = 1))
`
`// sortPrompts(Parray, pent);
`orderPrompts(Parray, pent);
`for (i = 0; i < pent; i++)
`
`printf("%s\n\n", prompts[Parray[i] - 1]);
`fprintf(If, "“<LI>%s", prompts[Parray[i] - 1]);
`}
`if (tmm flag)
`
`{ o
`
`theFlag = 0;
`alarm(timeout);
`
`728851 vi
`
`90
`
`(cid:23)(cid:28)(cid:22)
`493
`
`
`
`LOe299S59 .1441902
`
`PATENT
`Docket No.: 4428-4001
`
`/* accept the user input */
`
`fgets(ans, 80, stdin);
`alarm(0);
`fprintf(lf, "<P><I>%s</I><P>", ans);
`fflush(1f);
`if (otheFlag = 1 && chkAfrm(ans))
`j=0;
`
`else
`
`if (chkNegin(ans) && otheFlag != 1)
`j=9;
`
`else
`
`addWord(&queryList, ans, ++numQueryList);
`j = chkAns(ans, Parray, pent);
`
`}o
`
`theFlag = 0;
`
`}i
`
`f (j == -99)
`
`updateFlag = 1;
`return 100;
`
`} i
`
`f (j <0)
`{
`
`pent = removeZeros(Parray,pent);
`continue;
`
`} m
`
`}
`
`mflag = 0;
`
`else
`
`j=pent;
`if (j == 0)
`
`{ p
`
`ent = getNodes(j, Parray);
`mmflag = updateFlag = 1;
`}
`
`{ i
`
`f (isLeaf(Parray[j - 1]))
`{
`
`else
`
`return Parray[j - 1];
`
`}
`
`728851 vi
`
`9)
`
`(cid:23)(cid:28)(cid:23)
`494
`
`
`
`10299359 ,.ALAsOe
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`}
`
`af= 1;
`
`pent = getNodes(Parray|j - 1], Parray);
`
`} [
`
`RRR EER REE REA EAE RARE EE AK BRE HIE ER AEH EERE EE HEAR EERE EE
`isLeaf: Returns 1 if ‘node' is a leaf in the menutree, else 0
`Me foe oe ee oe oe Re Re oe ee eeke ea Re ee ee oe ee eo oeoe aEoekKE a ER EE|
`int isLeaf(int node)
`
`int i;
`for (i = 0; i<numMenu;i++)
`if (menuList[i][1] == node)
`break;
`if (i = numMenu)
`return Q;
`retum menuList[i][2];
`
`} i
`
`nt getNodes(int pnode, int *parray)
`
`int i, j;
`for (i = 0, | = 0; i< numMenu; i++)
`if (menuList[i][0] = pnode)
`
`tp
`
`array[j] = menuList[iJ[1];
`JH;
`}
`
`parraylj] = 0;
`return J;
`
`} |
`
`ea he ke he ee ee ie he ee ee ee he 2 oe oe ee oe ae2 oe ee ee ie ie oe ee ee eae oe ee ee he 2 he ke ee oe ke oe ke oh oe a eo ea a eae
`leamThesaurus: re-writes the thesaurus with relearned pattern and newly
`learned word.
`eo EE AI AE EE EEE AE EAE EE AAEAEE EERE AEA ERE EEE EE AE EEK /
`leamThesaurus(int pmpt, int unknownWords|], int numUnknown, char *flnm)
`
`ti
`
`nt i,j, k,
`FILE*fp;
`int *tmpList, tmpCount;
`
`728851 vi
`
`92
`
`(cid:23)(cid:28)(cid:24)
`495
`
`
`
`‘
`
`‘
`
`Ae299S59 .1A11902
`
`PATENT
`Docket No.: 4428-4001
`
`/* create andinitialize a tmp Array */
`tmpList = (int *)calloc(numColumn,sizeof(int));
`for (i = tmpCount = 0; i < numColumn; i++)
`tmpList[i] = 0;
`
`/* scan thru the query words and gathera list of unique keywords in tmp array*/
`tmpCount = getKeyWords(queryTerms, numQuery, tmpList);
`/* Locate the row for select prompt.if not create new row */
`for (k = 0; k < numScore && scoring[k][0] != pmpt; k++);
`if (k >= numScore)
`{
`
`scoring = (int **)realloc(scoring, (k + 1) * sizeof(int *));
`scoring|k] = (int *) malloc((numColumn + 1) * sizeof(int));
`for (j = 0; } <= numColumn; j++)
`scoring[k][j] = 0;
`numScore++;
`
`} s
`
`coring[k][0] = pmpt;
`for (j = 0; | < tmpCount; j++)
`scoring[k][tmpList[j]]++;
`
`[AAOR ERRARR ARRR AAR A ER A IO OR OR A HOR a AR RH /
`for (i= tmpCount = 0; 1 < numColumn;i++)
`tmpList[i] = 0;
`
`for (j = i = 0; j < numColumn;j++)
`
`{f
`
`or (k = 0; k <numIndex && indexList[j][k] != 0; k++)
`if (index List[j][k] == pmpt)
`break;
`if (k < numIndex && index List{j|[k] !=0)
`
`{t
`
`mpList[i] =j + 1;
`i++:
`F
`
`tmpCount=1;
`fp = fileOpen(flnm, "w");
`fprintf(pf, "<BR><B>Learned words</B><BR>");
`fprintf(fp, "[%s]\n", "EXT-THESAURUS");
`
`728851 v1
`
`93
`
`(cid:23)(cid:28)(cid:25)
`496
`
`
`
`:
`
`;
`
`LOeS9s59 ,.d411902
`
`PATENT
`Docket No.: 4428-4001
`
`for (i= numOrgRow;i < numRow;i++)
`
`{ f
`
`printf(fp, "%s: ", rowTerms[1));
`
`if (updateFlag && inArray(uWords, rowTerms[i], numUW))
`
`fprintf(pf, "%s (relearned)<BR>onginal: ", queryTerms[unknownWords|j]]);
`for (k = 0; k < numColumn; k++)
`
`{ i
`
`f (thesaurus[i|[k] != 0)
`fprintf(pf, " %d", thesaurus[i][k]);
`if (thesaurus[i][k] = 0)
`break;
`
`I f
`
`printf(pf, "<BR>");
`k = PromptUnion(thesaurus[i], tmpList, k, tmpCount);
`fprintf(pf, "new :");
`for (j = 0; j < k; j++)
`fprintf(pf, " Yd", thesaurusfi][j]);
`fprintf(pf, "<BR><BR>");
`
`}
`
`for (j = 0; j <numColumn; j++)
`
`if (thesaurus[i][j] == 0)
`break;
`fprintf(fp, "%d,", thesaurus[i][j]);
`
`}
`fprintf(fp, "\n");
`}
`for (i= 0; updateFlag && 1 < numUW;i++)
`
`{ i
`
`f (inArray(rowTenns, uWords[i], numRow))
`continue;
`
`fprintf(fp, "%s: ", uWords[1]);
`fprintf(pf, "%s(new-learned) :", uWords[i]);
`addWord(&rowTemns, uWords[i], ++numRow);
`thesaurus = (int **)realloc(thesaurus, numRow* sizeof(int *));
`thesaurus[numRow- 1] = (int *)malloc(numColumn * sizeof(int));
`for (j = 0; } < numColumn;j++) thesaurus[numRow -1][j] = 0;
`for (j = 0; } <tmpCount; j++)
`
`728851 vi
`
`94
`
`(cid:23)(cid:28)(cid:26)
`497
`
`
`
`10299359 .14121902
`
`PATENT
`Docket No.: 4428-4001
`
`thesaurus[numRow- 1][j] = tmpList[j];
`fprintf(fp, "%d,", tmpList[j]);
`fprintf(pf, " %d", tmpList{j]);
`}
`fprintf(fp, "\n"),
`fprintf(pf, "<BR><BR>");
`}
`
`fprintf(fp, "\n");
`
`/* write the scoringinthefile */
`fprintf(fp, "[Ys]\n", "SCORING");
`for (i = 0; i< numScore; i++)
`
`{f
`
`printf(fp, "%d,", scoring[i][0});
`for(j = 1; j <= numColumn;j++)
`fprintf(fp, "%d,", scoring[i][j]);
`fprintf(fp, "\n");
`}
`fprintf(fp, "\n");
`fclose(fp);
`
`} [
`
`EAA A EE EE EE EERE ER EA EEE EEE AEE EE EE BE ERE EE EE HE EE
`removeChild: removes descendents of all the elements from thelist
`a oe OR a a RE Ee SRaC HEAR ERRAaA EE IE He ER EE EH|
`int removeChild(int *array, int tot)
`
`{ i
`
`nt i, j, k, ent = 0;
`int *tmparray, m = 99;
`
`tmparray = (int *)calloc(numIndex, sizeof(int));
`
`/* Remove any prompts that are responsesrather than choices */
`for (i = 0; 1 < tot; 1++)
`
`{ f
`
`}
`
`or(j = 0; | < numMenu;j++)
`if (menuList[j][1] = array[i] && menuList[j][2] — 100)
`array[i] = 0;
`
`/* Remove any promptsthat are root node and haveachild whichis not a leaf rather than
`choices */
`
`728851 v1
`
`95
`
`(cid:23)(cid:28)(cid:27)
`498
`
`
`
`10299559 .111902
`
`PATENT
`Docket No.: 4428-4001
`
`for (i = 0; i < tot; i++)
`
`if (array[i] == 0) /* already removed so goto next */
`continue;
`
`/* if (isLeaf(array[i]))
`continue; */
`
`m = array[i];
`while(1)
`
`{ f
`
`or(j = 0; j < numMenu; j++)
`if (menuList[j][1] =m)
`break;
`if (menuList[j][0] = 0)
`break;
`m = menuList[}j][0];
`}
`if (m != array[i])
`
`{f
`
`or (j = 0; j < tot; j++)
`
`if (array{j] = m)
`array[j] = 0;
`
`}
`
`}
`
`for (i = 0; 1 < tot; ++)
`
`if (array[i] == 0) /* already removedso goto next */
`continue;
`for (j = 0; } < numIndex; j++) /* initialize tmparray */
`tmparray[j] = 0;
`ent = getChildren(array[i], tmparray); /* get children & grand-children of1 */
`for (j = 0; j < tot; j++-)
`/* scan thru the array to check for child */
`if (j !=i) /* ignore self from checking */
`for (k = 0; k < cnt; k++)
`if (array[j ] = tmparray[k])
`
`{a
`
`rray({j] = 0; /* ifj is child of i, makeit 0 */
`break;
`
`728851 vi
`
`96
`
`(cid:23)(cid:28)(cid:28)
`499
`
`
`
`'
`
`:
`
`10299359 .1411902
`
`PATENT
`Docket No.: 4428-4001
`
`}
`
`$
`/* Shift All non-zeroes upwards */
`for (i: = 0; 1 < tot; i++)
`
`{i
`
`f (artay[1] == 0)
`
`{ f
`
`or (j =i+ 1; j < tot; j++)
`if (array[j] != 0)
`break;
`
`if (j < tot)
`
`array[i] = array[j];
`array[}] = 0;
`t
`
`}
`
`/* count no of elements */
`for (j = 0; j < tot; j++)
`
`{i
`
`f (array[j] == 0)
`break;
`
`}
`return j;
`
`} [
`
`BEER ERERREE EEE EERE EE EEE AE EE EEE EE EE ER ER ERA EAE EEEE
`getChildren: fetches all the descendents ofpmpt into array
`AREA AS AG A A AAEA EE OR EEA EE A AEA EE SEOEaEC/
`int getChildren(int pmpt, int *array)
`
`{ i
`
`nt i, j, k, |;
`int t, tl, t2;
`int *tmparrayl, *tmparray2;
`
`if (isLeaf(pmpt)) /* if nodeis leaf no children so return 0 */
`return 0;
`
`tmparray] = (int *)calloc(numIndex, sizeof(int)); /* child ofchild in every loop */
`tmparray2 = (int *)calloc(numIndex, sizeof(int)); /* union of all scanned children */
`t=tl=t2=0;
`for (1 = 0; i < numMenu;i++)
`
`728851 vi
`
`97
`
`(cid:24)(cid:19)(cid:19)
`500
`
`
`
`é
`
`ADN2YV9SS59 .1L1190c
`
`PATENT
`Docket No.: 4428-4001
`
`if (menuList[i][0] == pmpt && menuList{i][2] != 100)
`
`{ a
`
`rray[t] = menuList[i][1];
`tl = getChildren(array[t], tmparray]);
`t2 = PromptUnion(tmparray2, tmparray1, t2, t1);
`te;
`}
`
`t = PromptUnion(array, tmparray?, t, 2);
`return t;
`}
`
`int chkAns(char * ans, int * Parray, int pent)
`
`{ c
`
`har locquery[256];
`int i, j, tmplcnt = 0, tmp2cnt = 0;
`char *resWords[50], start = 'Y';
`int numWords, tmpArray1[20], tmpArray2[20];
`int uwFlag = 0, rowOrColWord = 0;
`
`strepy(locquery,ans);
`numWords = breakStr(ans, resWords);
`if ( stremp(resWords[0],"other") == 0 && stremp(resWords[1 ],"options") = 0)
`
`{ r
`
`eturn 0;
`
`numWords = processArray(resWords, numWords,1);
`for (i = 0; 1< 20; i++)
`tmpArray]1 [i] = tmpArray2[i] = 0;
`fprintf(pf,"<li>Initialized Temp Array\n"); fflush(pf);
`
`for (i = 0; i <numWords; i++)
`
`if (!inArray(columnTerms, resWords[i], numColumn))
`
`{i
`
`f (!inArray(rowTerms,resWords[1],numColumn))
`
`{ i
`
`f (tinArray(uWList, resWords[i], uWNum))
`
`{a
`
`ddWord(&uWList, resWords[i], ++uWNum);
`fflush(1f);
`}
`
`728851 v1
`
`98
`
`(cid:24)(cid:19)(cid:20)
`501
`
`
`
`.
`
`LO299359 .11490e2
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`“
`{
`fprintf(pf,"<li>Unknown Word: %s\n"resWords[i]);
`fflush(pf);
`uwFlag = 1; /* unKnown word encountered twice */
`}
`
`$
`
`else
`
`rowOrColWord++:
`continue;
`}
`
`else
`
`rowOrColWord++;
`tmplcnt = fetchPrompts(resWords[i], tmpArray1);
`if (start = 'Y')
`
`tmp2cnt = PromptUnion(tmpArray2, tmpArrayl, tmp2cnt, tmp! cnt);
`start="N';
`}
`
`else
`
`tmp2cnt = PromptIntersection(tmpArray2, tmpArrayl, tmp2cnt, tmp| cnt);
`
`tmp2cnt = Promptintersection(tmpArray2, Parray, tmp2cnt, pent);
`}
`if (tmp2cnt != 1)
`
`if (tmp2cnt = 0 && pent == 1 && numWords = 1) // i.e. only one prompt &
`
`not selected
`
`{
`
`strepy(ans, locquery);
`if (chkAfrm(ans))
`returm 1;
`
`}i
`
`f (tmp2cnt > 1) // i.e. multiple prompt selection then do score
`
`strepy(ans, locquery);
`return checkscore(ans, Parray, pent);
`
`}
`
`if (uwFlag)
`if (AskforOp())
`retum -99;
`
`728851 vi
`
`99
`
`(cid:24)(cid:19)(cid:21)
`502
`
`
`
`LOeVISS9 .A11902
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`else
`
`return -1;
`
`if (rowOrColWord)
`
`{ s
`
`trcpy(query,locquery);
`return -99;
`}
`
`}
`for (i = 0; Parray[i]; 1++)
`if (Parray[i] = tmpArray2(0])
`retumi+ 1;
`
`} i
`
`nt AskforOp()
`
`int i, j ;
`char *resWords[50];
`int numWords;
`
`system("clear");
`printf(""Your request was not understood.\n");
`printf("Would you prefer to speak to an operator ortry again with a new request?\n");
`fprintf(If, "<P>Your request was not understood.<LI>");
`fprintf(If, "Would you prefer to speak to an operator or try again with a new request?\n");
`fflush(1f);
`/* accept the user input */
`fgets(query, 255, stdin);
`addWord(&queryList, query, ++numQueryList);
`fprintf(If, "<P><I> %s</I>", query);
`numWords = breakStr(query, resWords);
`if ( inArray(resWords,"operator",numWords))
`
`{ p
`
`rintf("\n\nPlease wait for the operator...\n");
`fprintf(lf,"<P>Please wait for the operator...");
`fflush(16);
`exit(0);
`}
`if( inArray(resWords,"try",numWords) && inAray(resWords," again",numWords))
`
`system("clear");
`printf("Please tell us your new request\n");
`fprintf(lf, "<P>Please tell us your new request\n");
`fflush(If);
`
`728851 v1
`
`100
`
`(cid:24)(cid:19)(cid:22)
`503
`
`
`
`AOe2oaogssS .A~A1190e
`
`PATENT
`Docket No.: 4428-4001
`
`/* accept the user input */
`fgets(query, 255, stdin);
`addWord(&queryList, query, ++numQueryList);
`
`return 1;
`
`} v
`
`oid sayOther()
`
`{p
`
`rintf("\nWould you like to hear other options?\n\n");
`fprintf(lf, "<LI>Would youlike to hear other options?<P>");
`otheFlag = 1;
`
`} i
`
`nt checkscore(char *ans, int *Parray, int pent)
`{
`
`char * resWords[50], *pmptWords[50];
`int i, j, *score, *score1;
`int numWords, numpWords, maxscore;
`
`score = (int *)malloc(pent * sizeof(int));
`score! = (int *)malloc(pent * sizeof(int));
`for (i = 0; 1 < pent; i++)
`score[i] = score] [i] = 0;
`
`numWords = breakStr(ans, resWords);
`for (i = 0; i < pent; i++)
`
`numpWords = breakStr(prompts[Parray[i]-1], ppptWords);
`for (j = 0; }) <num Words;j++)
`if (inArray(pmptWords,resWords[j], numpWords))
`score[i]++;
`
`} f
`
`or (i = maxscore = 0; 1 < pent; i++)
`maxscore = (maxscore < score[i])?score[i]:maxscore;
`for (i=j =0;1< pent; i++)
`j += (score[i] == maxscore)?1:0;
`
`if(j] = 1)
`
`/* single promptselection */
`
`for (i = 0; i < pent; i++)
`if (score[i] == maxscore)
`return i+ 1;
`
`728851 vi
`
`101
`
`(cid:24)(cid:19)(cid:23)
`504
`
`
`
`LOeIGS5S9 .1LAiIoe
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`for (i = 0; i < pent; it+)
`{
`
`numpWords = breakStr(prompts[Parray[i] - 1], pmptWords);
`score] [i] = getscorel(resWords, numWords, pmptWords, numpWords);
`
`} m
`
`axscore = 0;
`for (i = 0; i < pent; i++)
`maxscore = (score1[i] > maxscore)?score] [i]:maxscore;
`for (i =j = 0; i < pent; i++)
`j += (scorel [i] == maxscore)?1:0;
`if (j = 1) /* single prompt selection */
`{
`
`for (i= 0; i < pent; i++)
`if (scorel [i] = maxscore)
`return i+ 1;
`
`else
`
`for (i = 0; 1 < pent; 1++)
`if (score[i] != maxscore)
`Parray|[i] = 0;
`return -1;
`
`}
`
`int chkAfrm( char * str)
`{
`
`int i,j, numWords;
`char * resWords[50];
`
`numWords = breakStr(str, resWords);
`for (i = 0; i< numWords; i ++)
`if (inArray(affrmWords, resWords{[1], 3))
`return 1;
`
`return 0;
`
`}
`
`int chkNegtn( char* str)
`{
`
`728851 vi
`
`102
`
`(cid:24)(cid:19)(cid:24)
`505
`
`
`
`.
`
`102994359 .A111902
`
`PATENT
`Docket No.: 4428-4001
`
`int i,j, numWords;
`char * resWords[50];
`
`numWords = breakStr(str, resWords);
`for (1 = 0; 1< nurnWords; i ++)
`if (inArray(negWords, resWords[1], 2))
`return 1;
`
`return 0;
`
`} i
`
`nt getscorel(char **Word1, int num1, char **Word2, int num2)
`{
`
`int i, j, ser = 0;
`int Ismatch = 0;
`
`for(i = 0; i< num]; i++)
`
`for(j = Ismatch; j < num2; j++)
`if (!stremp(Word1[i],Word2[j]))
`{
`
`sert++;
`break;
`
`if ( <num2)
`Ismatch = j + 1;
`
`} T
`
`etum Scr;
`
`} i
`
`nt orderPrompts(int *InterPrompts,int numInter)
`{
`.
`.
`.
`int i, j, k, |;
`int *tmpArray[2]; /* 0 - score ; 1 - level; 3 - menu order */
`int *tmpList, tmpCount;
`
`tmpArray[0] = (int *)malloc(numInter * sizeof(int));
`tmpArray[1] = (int *)malloc(numInter * sizeof(int));
`
`tmpList = (int *)malloc(numColumn * sizeof(int));
`for (1 = 0;
`i <numColumn; i++)
`tmpList[i] = 0;
`// get the list of keywords from queryTerms
`
`728851 v1
`
`103
`
`(cid:24)(cid:19)(cid:25)
`506
`
`
`
`‘
`
`;
`
`LOe2SOS59 ,.11190e2
`
`PATENT
`Docket No.: 4428-4001
`
`tmpCount = getKeyWords(queryTerms, numQuery, tmpList);
`
`for (i = 0; i <numInter; i++)
`{
`
`/* get the maxscore for the prompt */
`tmpArray[0][i] = 0;
`for (j = 0; (j <numScore) && (scoring{j][0] != InterPrompts[i]); j++);
`/* if any previous scoring present */
`if ((j <numScore) && (scoring[j][0] = InterPrompts[i]))
`{
`
`// get the max score
`for (k= 0; k <tmpCount; k++)
`tmpArray[0][i] = max(tmpArray[0][i] , scoring[j][tmpList[k]]);
`
`} t
`
`mpArray[1][i] = getLevel(InterPrompts[i});
`
`// sort the array in order of score, leve] and menu-order
`for (i = 0; 1 <(numInter - 1); i++)
`
`for (j =i + 1; j <numInter; j++)
`if (!gThan(tmpArray[0)[iJ, tmpArray[1)[i], InterPrompts[1],
`tmpArray[0][j], tmpArray[1][j), InterPrompts[j]))
`{
`
`swap(tmpArray[0][i], tmpArray[0][j));
`swap(tmpArray[1 [i], tmpArray[1][j]);
`swap(InterPrompts[i], InterPrompts{j]):
`
`} r
`
`eturn numInter;
`
`} i
`
`nt getKeyWords(char **queryTerms,int numQuery,int *tmpList)
`
`int i, j, k, J;
`int count = 0;
`
`for (j = 0; j <numQuery; j++)
`{
`
`/* Check if the word is keyword */
`if ((k = inArray(columnTerms, queryTerms[j], numColumn)) != 0)
`{
`
`728851 vi
`
`(cid:24)(cid:19)(cid:26)
`507
`
`
`
`,
`
`ADNe2S99S359 ,ALAAgOe2
`
`PATENT
`Docket No.: 4428-4001
`
`/* add in templist only if not present */
`for (i=0;1< count && tmpList[i] !=k ; 14+);
`if (i >= count)
`tmpList[count++] =k;
`continue;
`
`} /
`
`* check if the word is Thesaurus/Learned Word */
`if ((k = inArray(rowTerms, queryTerms[j], numRow)) != 0)
`{
`
`/* pick-up all keywordsfor that word */
`for (i= 0; thesaurus[k - 1][1] != 0; i++)
`
`for (1=0;1< count && tmpList[!] != thesaurus[k - 1][i] ; 44);
`if (Ll >= count)
`tmpList[count++] = thesaurus[k - LJ[1];
`
`I
`
`}
`
`t T
`
`etum count;
`
`} i
`
`nt getLevel(int pmpt)
`{
`
`int i, k, |;
`
`for (i = 0; i< numMenu && menuList[i][1] != pmpt; 1+4+);
`k= menuList[i][0];
`for (1 = 0; k > 0;1++)
`{
`
`for (i=0;i<numMenu && menuList(i][1] !=k; i++);
`k = menuList[i][0];
`
`105
`
`(cid:24)(cid:19)(cid:27)
`508
`
`} r
`
`eturn |;
`
`} i
`
`nt gThan(inta,int b, int c, intp, int q, int r)
`{
`
`if (a> p) return 1;
`if (a <p) return 0;
`if (b > q) return 0;
`
`// Desc order here
`// Desc order here
`// Asc order here
`
`728851 vi
`
`
`
`‘
`
`4
`
`LOeBseass? .ALAVoe
`
`PATENT
`Docket No.: 4428-4001
`
`if (b <q) return 1; // As