`
`PATENT
`Docket No.: 4428-4001
`
`main(int argc, char *argVU)
`
`{ i
`
`nti=0;
`
`f*if(argc != S)
`
`{ p
`
`rintf "Usage Instructions: dialog config_file learn_file\n");
`printf(“** Exiting, goodbye.\n");
`exit(1);
`}*r’
`if (argc != 2)
`
`{ p
`
`rinth‘Usage Instructions: d €ini~file>\n");
`pnntf("*** Exiting, goodbye.\n“);
`exit(l);
`}
`readini(argv[1]);
`formfile = fdoc;
`loadStopWords(sdoc);
`numPF = loadFonnsList(xdoc);
`numForIns = loadFonns(fdoc);
`loadData(cfg, lcfg);
`hiteractiveflcfg);
`
`} {
`
`*Ifllflifllflk*llflhfillflk*************************$*¥****$********************fl‘itt
`
`loaddata : This fimction will read the configuration files and load the
`information into the relevant global arrays.
`=l=**¥*##5##*flfll‘3F3F****BI*1:3k*ikilflkilfl*3!13**ikik******¥*********$*$**$*************‘f
`
`loadData(char *filenm, char *fileZ)
`
`{ c
`
`har buf[256]. word[20];
`int i, j, k, 1;
`int numext;
`FILE *fp, *f2;
`
`{#***#$*****t****¥** Open configuratiOn file $****************¥*¥f
`fp = fileOpen(filenm, "r");
`
`f********¥***** open lem(extended thesaurus) file ******$**$******!
`t2 = fileOpon(fil62, "r");
`
`72885| VI
`
`7?
`
`480
`480
`
`
`
`iflEg‘EESg‘ melanoma
`
`PATENT
`Docket No.: 4428-4001
`
`prompts = columnTerms = rowTerms = NULL;
`scoring = thesaurus = indexList = menuList = NULL;
`
`r'* read data in the arrays ‘1'
`numMenu = loadMenuTree-(fp, "[MENUTREE]");
`numIndex = readArray(fp, "[PROMPTS]", &prompts, 1, NULL, 0, 0);
`numColumn = readArray(fp, "[INDEX]", &columnTerms, l, &indexList, numlndex, 0);
`numOrgRow = readArray(fp, "[THESAURUS]", &rowTerms, 1, &thesaurus, numColumn, 0);
`numRow = readArray(f2, "[EXT-THESAURUS]", &rowTerms, l, &thesaurus, numColumn,
`numOrgRow);
`numScore = readArray(f2, "[SCORINGT', NULL, 0, &scon'ng, numColumn + l, 0);
`
`fclo se( fp);
`fclose(f2);
`
`} f
`
`¥****¥*********************#*******¥***¥¥************¥********¥****¥¥***$$
`
`readAnay : Reads the file and fills the rows and columns of the given arrays
`*********tt*****$*****#***$***#************#******$*******#**¥*¥***#$*****;
`
`int readAnay(FILE *fin, char *head, char ***ch_array, int ccount, int ***int_array, int icount, int
`SP)
`
`{ c
`
`har buf[256];
`int i,j, start = 0, we = 0;
`int k, 0;
`char ”Imparray; F‘To store the pointers to the wordsfnumbers from the string"?r
`c = sp;
`
`if(icount != 0)
`tmparray = (char **)malloc((icounl + 1) * sizeofIchar *));
`
`fseek(fp, 0, 0); 1’“ Go to Top *I
`
`while (fgets(buf, 255, fp) != NULL) I“ read lines till end offile *f
`
`{ a
`
`llTrim(bui);
`j = Strlen(bufl;
`if(buf[j - l] = '\n') bqui — 1] = 0;
`if (start)
`
`{ i
`
`f (strlen(buf) = 0) a” if blank line, stop reading *I
`break;
`if(icount = 0) 1"“ i.e. no integer array *l
`
`728851 v1
`
`78
`
`481
`481
`
`
`
`infill-£99359 .miigna
`
`PATENT
`Docket Nth: 4428—4001
`
`else
`
`addWord(ch_array, but“, -H-c);
`a" read first word string *1'
`{ I“ rest are columns of int array *!
`we = readValues(buf, trnparray);
`c-H-;
`
`(*int_anay) = (int **)realloe(*intflarray, e * sizeofiint *));
`(*int_array)[c ~ 1] = (int *)malloc(ic0unt * sizeof(int));
`if (ccount != 0)
`addWord(ch_array, tmparray[0], c);
`
`else
`
`(*int_array)[c - 1][0] = atoi(tmparray[0]);
`for (k = l; k < icount; k++)
`if (k C we)
`(*int_array)[c - l][k - ccount] = atoi(tmparray[k]);
`
`else
`
`(*int_array)[c - l][k - ecount] = 0;
`
`}
`
`}
`
`else
`
`if (lstrcmp(head, bufl)
`start = 1;
`
`}
`return c;
`
`} f
`
`¥$*¥*¥¥*¥*******¥*********$**************¥**¥***¥¥**¥*¥******¥*¥***
`
`loadMenuTree : loads the menutree from file to menuList array
`*¥$*¥**¥*¥*****************$$****¥*************¥$*¥**¥**¥*****¥****I
`
`int loadMenuTree (FILE ‘11), char *head)
`
`{ c
`
`har bufl256};
`int i, j, start = 0, count = 0;
`fseek(fp, 0, 0);
`while (fgets(buf, 255, fp != NULL)
`{
`j = strlen(buf);
`if(buf[i - 1] = '\n‘)
`buffi - I] = 0;
`
`if (start)
`
`{ i
`
`f (strlen(buf) = 0)
`break;
`menuList = (int **)realloc(menuList, (count + 1) * sizeof(int *));
`
`72885] VI
`
`79
`
`482
`482
`
`
`
`iflEQ'g'EEQ a iiigflm—i
`
`PATENT
`Docket No.: 4428-4001
`
`menuList[count] = (int *)malloc(3 * sizeof(int));
`sscanf(buf, "%d,%d,%d ", &menuList[count][0],
`&menuList[count][1],&menuList[c0unt][2]);
`count++;
`
`} i
`
`f (Estrcmpfluead, buf))
`start = 1;
`
`else
`
`}
`return count ;
`
`}
`
`readini(char * filenm)
`{
`
`FILE * fp;
`char bquSO], key[80], value[80], cornment[80];
`int cm;
`if ((fp=fopen(filenm,"r"))=NULL)
`{
`
`perror(filenm);
`exit(1);
`
`} w
`
`hile (fgets(buf,79,fp)!=NULL)
`
`{ s
`
`scanfibuf,"%s %s %s",key,value, comment);
`if (Islrcmp(key, "scloc"))
`sdoc=strdup(valuc);
`if (lstrcmp(key, "fdoc“))
`fd0c=strdup(value);
`if (lstrcmp(key, "xdoc"))
`xdoc=strdup(value);
`if (lstrcmp(key, "cfg"))
`cffstrdupWalue);
`if (1strcmp(key, "Icfg"))
`lcfg=strdl1p(value);
`if (1strcmp(key, "rninprompt“))
`minPromptCount=atoi(value);
`if (Istrcmp(key, "timeout"))
`timeout=atoi(valuc);
`
`}
`
`72885] v]
`
`80
`
`483
`483
`
`
`
`lBEgQEEq ”11:1an
`
`PATENT
`Docket No.: 4428-4001
`
`interactivec: This program contains funtions related to user interaction
`flit:*4:*$4:itat*ata:=l:a:*1:allaltar*Il:tt***t***til!tit********$¥****$t**$t#*$¥*$****$****
`
`Interactive : function to accept a sentence from the user and then
`generate the response.
`
`thesaurusF lag = is 1 if there is atleast 1 thesaurus!learned word in query
`updateFlag = is set to l ifthe program needs to learn (i.e. main menu was
`selected during the prompt navigatiOn)
`interPrompts = Intersection of prompts
`unionPrompts = Union of prompts
`interUnionPrompts = Intersection of Union
`numInter = number of prompts in InterPrornpts
`numInterUnion = norm of prompts in Intersection of UniOn
`numUnion = num of prompts in Union
`numUnknown = num of unknown words
`*********$$*****tt*$********¥*¥***¥***********IF*$*******#****t********r‘
`
`#include <stdio.h>
`
`#include <signal.h>
`#include <string.h>
`#include €unistd.h>
`
`#include "globalvarh"
`#include "arraylibh"
`#include "formsh"
`
`#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, leamF lag, nquueryList = 0;
`FILE *lf, *pf;
`char ** uWList=NULL, *queryTerms[50];
`int uWNurn;
`
`extern int minPromptCount, timeout;
`char query[2 56], **queryList = NULL;
`char *affrmWordsfl = { ”yes", "right", "correct"};
`char *negWordsfl = { "no", "neither"};
`extern char * fdoe;
`int otheFlag = 0;
`int unknownWords[20], nquuery = 0, numUnknown;
`char **uWords; I! Added this array to facilitate learning wven if lateral shift
`int numUW;
`2’! Added this to facilitate learning wven if lateral shift
`void sayOtherO;
`
`728851 VI
`
`81
`
`484
`484
`
`
`
`lflflggfifig “31.11933
`
`PATENT
`Docket No.: 4428-4001
`
`void Interactive(char *flnm)
`{
`
`int InterPrompts[20], unionPrompts[20], t1Prornpts[20];
`int interUnionPrompts[20], numlnterUm'on, t2Prompts[20], numTZ;
`int i, j, k, 1;
`int start, numUnion, numlnter, numTl;
`int n, selectedPrompt, thesaurusFlag = 0;
`char *interlog, *processlog, c;
`
`numUnknown = numUW = 0;
`for(i=0; i < 20; i++)
`unknownWords[i] = 0;
`uWords=NULL;
`
`if ((interlog = (char *)getenv("TII\/IEOUT")) != NULL)
`timeout = atoi(interlog);
`
`if ((interlog = (char *)getenv("MINPROMPT")) != NULL)
`minPromptCount = atoi(inlerlog);
`
`if ((inteflog = (char *)getenv("[NTERLOG")) = NULL)
`interlog = "testhtml";
`
`if ((processlog = (char *)getenv("PROCESSLOG“)) = NULL)
`processlo g — processhtml";
`
`signal(SIGALRM, &say0ther);
`lf= fileOpen(interlog,"w" ;
`
`pf = fileOpen(processlog,"w" ;
`fprintfflf, "<HTML>\n<TITLE>%s<fl‘ITLE>\n<BODY>-<FONT SIZE=Sb\n", interlog);
`fpn‘ntf(pf, "<HTML>\n<l"ITLE>%S<!TITLE>\n<BODYXFONT SIZE=5>\n", processlog);
`
`system("c1ear");
`printh'Thank you for calling the New Herald.\n");
`printf("How may we help you?\n\n");
`fprintfflf,"\nThank you for calling the New Herald.€BR>");
`fprintfflf,"How may we help you. <P>");
`fgets{query, 25 5, stdin); P accept the user input *!
`
`while (1)
`{
`
`72335: H
`
`82
`
`485
`485
`
`
`
`JUEQQESQ miilqfllfl
`
`PATENT
`Docket No.: 4428-4001
`
`addWord(&queryList, query, HnquueryList);
`nquuery = thesaurusFlag = 0;
`if (strlen(query) == 0)
`break;
`fprintf(lf, "CI? %s<fl> <Pb", query);
`
`nquuery = createArray(query, queryTenns);
`
`{13*IktIFIFtit*‘k**t1:*X******ik1:¥*#******ti***********************l
`
`fprintf(pf, “Terms in Query: ");
`for (j = 0;j < nquuery; j++)
`fpn'ntf(pf, " %s“, queryTennsfiD;
`fprintf(pf, “<BR>");
`{*ttlk’lfllflk**$*****$**#*$*$$*$$****ilflkitIt$*$**$$*$**$$*$**$****$Jf
`
`i'* initialize InterPrompts and unionPrompts array *1“
`for (i = 0; i < 20; i-|-|-)
`
`{ t
`
`2Prompts[i] = thrompts[i] = 0;
`InterPrompts[i] = unionPrompts[i] = interUnion?rompt5[i] = 0;
`}
`start = l;
`numInterUnion = numT2 = numTl = numInter = numUnion = 0;
`
`3* Scan thru all the words to generate unioniintersection of prompts *i
`for (i = 0; i < nquuery; iH)
`
`{I
`
`“ if not in index words check thesaurus *a’
`
`if (linArray(columnTerms, queryTenn5[i}, numColumn))
`
`{ l
`
`eamJ-"lag = numTl = numT2 = O;
`scanThesaurus(queryTerms{i], tl Prompts, t2Prompts, &numT l ,
`
`f“ if unknownflearned word save it to array *f
`if (learnF lag)
`
`{ u
`
`nknownWords[numUnknown] = i, numUnknoer-I-F;
`addWord(&uWords, queryTerms[i], HnumUW);
`if (numTl = 0 && numTZ = 0)
`continue;
`
`else
`
`}
`
`thesaurusFlag = 1;
`
`33
`
`486
`486
`
`&numT2);
`
`72885l v:
`
`
`
`1933529935? ”11191332
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`}
`
`else
`
`thesaurusFlag = 1;
`
`{ n
`
`umTl = fetchPrompts(queryTeHn5[i], thrompts);
`numTZ = fetchPrompts£queryTerms[i], t2Prompts);
`}*$*********#*******t****************t*******$**i
`
`fprintflpf, "%5 (index) :", queryTerms[i]);
`for (j = 0;j < numT1;j++)
`fprll'ltf(pf, " %d“, thromptsUD;
`fprintf(pf, "<BR>");
`fi‘lushfifi);
`f¢**********¥**$*********$*****$*$$********t*$*$l
`
`}
`
`if(start) 1* if first word *f
`
`{ n
`
`um Inter = Promthnion(k1terPrompts, tZPrompts, numlnter, numTZ);
`numUnjon = Promthnion(unionPrompts, thrompts, numUnion,
`
`numTl);
`
`numlnterUnion = Promthnion(interUnionPrompts, thrompts,
`numInterUnion, numTl );
`start = 0;
`
`}
`
`{ n
`
`else
`
`umlnter = Promptlntersection([nterPrompts, t2Prompts, numlnter,
`
`numT2);
`
`numTl);
`
`numUnion = Promthnion(unionPrompts, t1 Prompts, numUnjon,
`
`numlnterUnion = PromptlntersectionfinterUnionPrompts, tl Prompts,
`numlnterUnion, numTl);
`
`}
`
`}{
`
`**************¥*$**$¥¥**¥*¥**¥*¥******¥******¥********I
`
`fprintfipf, "Final Intersection Result: ");
`for (j = 0;j < numInter;j++)
`fprintfipf," %d", InterPromptsLiD;
`fprintf(pf, "<BR>");
`fprintflpf, "Final Intersection of Union Result: “);
`for (j = 0;j < numInterUnion; j++)
`
`‘128851 vl
`
`84
`
`487
`487
`
`
`
`inflowsao g. iligUE
`
`PATENT
`Docket No.: 4428-4001
`
`fpfintflpi‘, " %d", interUnionPromptsLiD;
`fprintf(pf, "<BR>");
`fprintf(pf, "Final Union Result: ");
`for (i = 0;j < numUnion; j-H-)
`fprintf(pf, " %d", unionPromptsLiD;
`fprintf(pf, "<BR>");
`fflush(pf);
`l*¥************i:I“:*IIHIHHIHIHt**$*****$****$***$¥¥*********¥f
`
`if (numInter < minPromptCount && thesaurusFlag)
`
`{ i
`
`f (numInterUnion < minPromptCount)
`numlnter = PromthnionanterPrompts, unionPrompts, numlnter,
`
`numUnion);
`
`else
`
`numlnter, numlnterUnion);
`}
`
`numInter = PromthnionflnterPrompts, interUnionPrompts,
`
`fprintf(pf, “Final Selection : ");
`fflush(pf);
`for (j = 0;j < numlnter; j++)
`fprintfipf, " %d“, InterPromptsLiD;
`fprintffiaf, "<BR>");
`fflush[pf);
`numlnter = orderPrompts(InterPrompts, numInier);
`numlnter = removeChildflnterPrompts, numImer);
`If eliminate prompts 2' 3
`for (j = 3;j é numInter; j-H-)
`InterPromptsD] = 0;
`numlnter = min(numlnter, 3);
`fprinthpf, "Selection After Elimination of descendants: ");
`fflush(pf);
`for (j = 0; j < numInter; j-H-)
`fprintf(pf, " %d", InterPromptsUD;
`fprintf(pf, ”<BR3'");
`fflush(pl);
`selectedPrompt = GetPrompt(InterPrompts, numlnter);
`if (selectedPrompt = 100)
`continue;
`
`If if (updateFlag)
`learn'I'hesaurus(selectedPrompt, unknownWords, numUnknown, flnm);
`
`723351 v:
`
`85
`
`488
`488
`
`
`
`lflflggflfig willgfla
`
`PATENT
`Docket No.: 4428—4001
`
`updateFlag = 0;
`forU = 0; (j < numMenu) && (menuListU][1] != selectedPrompt); j-H-);
`if (menuList[j][2] 5= 99)
`
`{ f
`
`or {i = 0; i < numPF; i++)
`
`{ i
`
`f (Estremp(Fprompts[i][1],prompts[selecledPrompl - 1]))
`
`{ f
`
`or(k = 0; k < numFon'ns; 16+)
`if(Istrcmp(Fprompts[i][0],formlist[k]->name))
`
`{ f
`
`illFonn(fonnlist[k], queryList, nquueryList);
`processFonn(fonnlist[k]);
`break;
`
`}
`
`break;
`
`}
`
`}
`if (i = numPF)
`
`{ s
`
`ystem("clear");
`p1-intf("\nYour query has been understood.\11");
`printtI"Please wait to be transferred to the reievant department.\n\n");
`fprintf(lf,"<P>Your query has been understoodfiLIb");
`fprintIUf,"Please wait to be transferred to the relevant departm ent.4<HR>");
`break;
`
`}
`
`}
`
`else
`
`{ p
`
`rinth"\n%s\n\n",prompt5[menuListU][2] - 1]);
`fprintfflf, "\n<P>%s<HR>",prompts[menuList[i][2] - 1]);
`
`} 1
`
`'! modified for the loop
`printf("Do you have another query?\n\n");
`fgets(query,80,stdin);
`if (IchkNegtn(query))
`
`{ f
`
`or(i = 0; i < nquueryList; i++)
`free(queryList[i]);
`for(i = 0; i < numForms; iH)
`fi-ee(formlist[i]);
`free(formlisl);
`
`72885] vl
`
`86
`
`489
`489
`
`
`
`iEflET-EQESQ Hillgfla
`
`PATENT
`Docks! No.: 4428-4001
`
`free(queryList);
`queryList = NULL;
`numForms = loadForms(fdoc);
`nquueryList = 0;
`l!printf‘(“Please tell us your query.\n “);
`Hfgets(query,255,stdin);
`continue;
`}
`system("clear");
`printft"\nThank you for calIing.\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, "<fI-ITM1>\n<fBODY>\n");
`fprintf(pf, "<!HTML>m<xBODY>\n");
`fclose(lfl;
`fclose(pf);
`
`} i
`
`nt scanThesaurus(char *word, int *thrompls, int *IZPrompts, int* n1, int * n2)
`
`{ i
`
`nt i,j, k= 0,1;
`int 111, thZO], sflg = l;
`
`for (i = 0; i < 20; i++)
`thromptsfi] = l2Prompts[i] = mm = 0;
`
`for (l = 0; l < numRow; l++)
`if (Estrcmp(w0rd, r0chrms[l]))
`break;
`
`f“ if the word is not present in thesaurus *l
`if (1 = numRow)
`
`{ f
`
`printf(pf, "%5 (unknown) <BR>", word);
`leamFlag = 1;
`.
`return 0;
`
`} { i
`
`f (I >= numOrgRow)
`
`{ f
`
`printf(pf, "%s (learned):<BR>", word);
`
`87
`
`490
`490
`
`else
`
`723851 v]
`
`
`
`jLDE‘EQES‘Q-l “1119053:
`
`PATENT
`Docket No.: 4428-4001
`
`leamFlag = l;
`
`} f
`
`else
`
`printf(pf, ”%s (thesaurus):<BR>", word);
`
`for (j = 0; thesaurus[l]U] &&j < numRow; jH)
`
`{ m
`
`= fetehPrompts(columnTenns[thesaurus[l]U] - 1], tp);
`{*tt****$**#*#***$*******¥*****¥*¥********¥*****¥*¥¥******!
`
`fpn'ntf(pf, "<LI)%s (index) :", columnTenns[thesaurus[l][j] - 1]);
`for (k = 0; k < m; kH)
`fpfintflpf, " %d", tp[k]);
`fprintttpf, "<BR>");
`f********##3##*3*¥**¥*************#*#***#*#********#$##*$*;
`
`*nl = Promthnion(thrompts, 1213, *nl, m);
`if (sflg)
`
`{ *
`
`n2 = Promthnion(t2Prompts, tp, *n2, m);
`sflg = 0;
`
`} { *
`
`}
`
`else
`
`n2 = Prompth1terseetion(t2Prompts, tp, *n2, m);
`
`}
`fprintf(pf, "Union Result: ");
`for (k = O; k < *nl; k4+)
`fprintffiaf, " %d", thrompts[k]);
`fprintfipf, "<BR>");
`fprintflpf, "Intersection Result: ");
`for (k = 0; k < *n2; k++)
`fprintf(pf, " %d", t2Prompts[k]);
`fpn'ntf(pf, "<BR‘9");
`}
`
`return k;
`
`}p
`
`kI:***Itit*aka:a:*4:II:*3!ittit*¥***t1:*1:3k1:*iflstakinkttakttttfl‘tlkfluflltaktil*#*****
`
`Promthnion : does a union of arrays pointed by pl and p2 and
`stores in pl. returns the total elements in result
`*i********¥**$$*$*****$*¥¥t*$***t***$**$$*$*$$*****#*$*8***$$f
`
`728351 v1
`
`88
`
`491
`491
`
`
`
`LILHEQIQES’Q miligflla
`
`PATENT
`Docket No.: 4428—4001
`
`int Promthnionfint *pl, int *p2, int 111, int n2)
`
`{ i
`
`nt i, j;
`for (i = 0; i < 112; i-H)
`
`{ f
`
`or (i = 0;j < nl;j++)
`”(1310] = MN)
`break;
`
`if(j = n1)
`
`{ P
`
`lfi] =p2li};
`n1++;
`
`}
`
`}
`return n1;
`
`} {
`
`***#**$*****#*****t*************$**********t****¥***********$*¥$**********
`
`Promptlntersection : does a intersection of arrays pointed by pi and p2 and
`stores in p1. returns the total elements in result
`*$***************#********$$*$$*$***3****$**$$$$$$$$$$t$***$*$**$*****$$*$;
`
`int Prompthltersectionfint *pl, int *p2, int 111, int 112)
`
`{ i
`
`nt i,j;
`for(iIO;i<n1; iH)
`
`{ f
`
`or (i = 0;j < n2;j++)
`if(p1[i1= p201)
`break;
`
`iffi = :12) I“ not there *l’
`
`{ f
`
`orG =i;j <n1;j++)
`plfjJ=P1U +1];
`
`nl-—;
`i--;
`}
`
`}
`return n1;
`
`}l
`
`***¥**#****¥******##$#***********#*##*#*$*#*******#**#**t*$#****
`
`fetchPrompts : Will fetch all the prompts for ‘word' into
`Arraylist pointed by t1 Prompts;
`**********¥¥*¥*****************$****************$**$**¥*******¥*f
`
`72885] v:
`
`89
`
`492
`492
`
`
`
`lflEQQESQ m iiigflfi
`
`PATENT
`Docket No.: 4428-4001
`
`int fetchPrornpts(char *word, int *thrompts)
`
`{ i
`
`nt i, j, k, l;
`for (i = 0; i < 20; i-H)
`thrompts[i] = 0;
`if ((i = inArray(coluanenns, word, numColurnn)) = 0)
`return 0;
`
`l";
`
`for (j = 0; (thromptsm = indexList[i]Li]) && (j < numIndex); j++);
`return j;
`
`} [
`
`*t***#***********¥***$**$*$********$***$************************
`
`GetPrompt: Returns the final prompt selected by user
`******************¥******¥********¥******************#***#*****$X
`
`int GetPrompt(int *Parray, int pent)
`
`{ i
`
`nt i,j, k, 1;
`int mmflag = 0, af= 0;
`char ans[80];
`
`while (1)
`
`{ s
`
`ystem("clear");
`printqnmu);
`fprintfflf, "<P>");
`If Removed the comments to reintroduce last prompt
`if (pent = 1 && isLeafIParray[0]) && numUnknown > 0)
`af = ;
`if ----------------------------------------
`
`if((pcnt>1)|l(pcnt= 1 && af= 1))
`{
`
`if sortPrompts(Parray, pent);
`orderPrompts(Parray, pent);
`for (i = 0; i < pent; i++)
`
`{ p
`
`rintf(“%s\n\n", promptsfParrayfi] - 1]);
`fpn'ntfflf, "<LI>%S", promptsfParrayfi] — 1]);
`}
`if (Immflag)
`
`{ o
`
`theFlag = 0;
`alarm(timeout);
`
`72885| VI
`
`90
`
`493
`493
`
`
`
`,
`
`iflEggTfiEg miligflfi
`
`PATENT
`
`WM!
`
`}
`fgets(ans, 80, stdin); F accept the user input *I’
`alarm(0);
`fpn'ntfflf, "<P><I>%s<fl><P>", ans);
`fflushflt);
`if (otheFlag = 1 && ehkAfim(ans))
`j = 0;
`
`else
`
`{
`
`if (chkNegtn(ans) && otheFlag != l)
`j = 0;
`
`else
`
`{
`
`} o
`
`addWord(&queryList, ans, ++nquueryLi5t);
`j = ehkAns(ans, Parray, pent);
`
`theFtag = 0;
`
`} i
`
`f ( j = ~99)
`{
`
`updateFlag = 1;
`return 100;
`
`} i
`
`f (j c 0)
`{
`
`pent = removeZeros(Panay,pcnt);
`continue;
`
`} m
`
`}
`
`mflag = O;
`
`else
`
`j = pent;
`if (j = 0)
`
`{ p
`
`ent = getNodesfi, Farray);
`mmflag = updateFlag = 1;
`}
`
`{ i
`
`f (isLeaf(Parray[j - 11))
`{
`
`else
`
`return Farrayfi - 1];
`
`}
`
`72885! v!
`
`91
`
`494
`494
`
`
`
`iflfiqgfifig .3 112195312
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`}
`
`af = ;
`
`}
`
`pcnt I getNodes(Pan-ayfi - 1], Pal-ray);
`
`} f
`
`#**********¥**¥*¥*****¥*tt¥¥$t¥***$**tit******$*ttttt**¥**&t*#*******
`
`isLeaf: Returns 1 if ‘node‘ is a leaf in the menutree, else 0
`*$*****************t*t*****$*******¥*********¥*****************$*$***;
`
`int isLeaf(int node)
`.{
`-
`Int 1;
`
`for (i = 0; i < numMenu; i++)
`if (menuList[i][1] E node)
`break;
`if(i = numMenu)
`return 0;
`
`return menuList[i][2];
`
`} i
`
`nt getNodesfint pnode, int *parray)
`i
`_
`.
`mt 1,];
`for (i = O,j = 0; i < numMenu; i++)
`if(menuList[i][0] = pnode)
`
`{ p
`
`anayfj] = menuList[i][1];
`j++;
`}
`
`‘
`pan'ayp] = 0;
`return J;
`
`} {
`
`*#$*t**************$*****$*****$*#*******¥********¥¥****************#****#*$*
`
`leamThesaurus : re-writes the thesaurus with releamed pattern and newly
`learned word.
`$$*******t*t**************¥*¥*t***¥*******3t************¥***¥*¥****¥******¥**I
`
`learnThesaurus(int pmpt, int unknownWordsfl, int numUnknown, char *flnm)
`
`92
`
`495
`495
`
`{ i
`
`nt i, j, k, 1;
`FILE *fp;
`int *tmpLi st, tmpCount;
`
`72835! v:
`
`
`
`153335393533] "1119mm
`
`PATENT
`Docket NIL: 4428—4001
`
`I“ create and initialize a tmp Array *f
`tmpList = (int *)cal]0c(numColumn, sizeof(int));
`for (i = tmpCount = 0; i < numColumn; iH)
`tmpList[i] = 0;
`I
`
`f“ scan tth the query words and gather a list of unique keywords in tmp array“;
`tmpCount = getKeyWords(queryTerms, nquuery, tmpList);
`1* Locate the row for select prompt. if not create new row ”'5’
`for (k = 0; k < numScore && scoringfk][0] != pmpt; kH);
`if (k >= numScore)
`{
`
`scoring = (int **)realloc(scoring, (k + 1) * sizeoffint *));
`Scoring[k] = (int *) malloc((numColurnn + l) * sizeof(int));
`for (j = 0;j <= numColumn; j-H)
`Scoring[k][j] = 0;
`numScorc-H';
`
`} s
`
`coring[k][0] = pmpt;
`for (j = 0;j < tmpCount;j++)
`scoring[k][tmpList[j]]++;
`
`/******************it$$$$$$$$$$$$$$$$$**$*$$**$*$*#*#**************t.{
`
`for (i = tmpCount = 0; i < numColumn; i++)
`tmpList[i] = 0;
`
`for (j = i = 0;j é numColumn; j++)
`
`{ f
`
`or (k = 0; k < numlndex && index ListU][k] != 0; k++)
`if (indexList[j][k] = pmpt)
`break;
`if (k < numlndex && indexListhHk] != 0)
`
`{ t
`
`mpList[i] =j + 1;
`i++;
`
`}
`
`}
`tmpCount = i;
`fp = fileOpen(flnm, “w" ;
`fprintflpf, "<BR><B>Learned wordsflBxBRV‘);
`fprintf(fp, "[%s]\n", “EXT-THESAURUS");
`
`72335: v]
`
`93
`
`496
`496
`
`
`
`-
`
`°
`
`iflflggfifig miligfla
`
`PATENT
`Docket No.: 4428—4001
`
`for (i = numOrgRow; i < numRow; i-H-)
`
`rowTennsnD;
`
`{ f
`
`printf(fp, "%s:
`
`if (updateFlag && inArray(uWords, rowTenns[i], numUW))
`
`{ f
`
`printfipf, "%s (releamed)<BR>original: ", queryTenns[unknownWordsLi]]);
`for (k = 0; k < numColumn; k++)
`
`{ i
`
`f (thesauru5[i][k] != 0)
`fprimf(pf, " %d", thesaurus[i][k]);
`if (thesaurus[i][k] = 0)
`break;
`
`} f
`
`pn'ntflpf, "<BR>");
`k = Promthnion(thesaurus[i], tmpList, k, tmpCoum);
`fin‘intflpf, "new :" ;
`forfi =0;j <k;j-H-)
`fprintf(pf, " %d", thesaurus[i][j]);
`1‘pnintf(pf, "<BR><BR>");
`
`}
`
`for (j = 0; j < numColun-m; j++)
`{
`
`if (thesaurus[i][j] = 0)
`break;
`
`fprintflfp, "%d,", thesaurus[i][j]);
`
`}
`fprintf(fp, "\n");
`}
`for (i = 0; updateFlag && i < numUW; i++)
`
`{ i
`
`f (inAnay(rowTenns, uWords[i], numRow))
`continue;
`
`fprintfifp, "%s: ", uWords[i]);
`fprintf(pf, "%s(new-Ieamed) :", uWords[i]);
`addWord(&rowTenns, uWords[i], ++numRow);
`thesaurus = (int **)realloc(thesaurus, numRow * sizeoffint *));
`thesaurus[numRow - l] = (int *)malloc(numColumn * sizeof(int));
`for (j = 0; j < numColumn; j++) thesaurus[numRow -1]Li] = 0;
`for (j = 0;j < tmpCount; j++)
`{
`
`?28351 VI
`
`94
`
`497
`497
`
`
`
`snaggzgg .. 1119332
`
`PATENT
`Docket No.: 4428-4001
`
`thesaurus[numRow - 1]fi] = tmpListLi];
`fpfintflfp, "%d,", tmpListUD;
`fprintflpf, " %d", tmpList[j]);
`}
`fprintfcfp, "\n");
`fprintf(pf, "<BR><BR>");
`}
`
`fprintf(fp, "\n");
`
`I“ write the scoring in the file *1
`fprintttfp, "[%s}\n", "SCORING");
`for (i = 0; i < numScore; i++)
`
`{ f
`
`printf(fp, "%d,", scoring[i][0]);
`for(j = 1;j <= numColumn;j++)
`fpfin‘ftfp, "%d,", scoringiiHjD;
`fpn'ntfifpg "\Il");
`}
`fprintf(fp, "\n");
`fclose(fp);
`
`} f
`
`¥$$t$$$$$$$$$$$$$$$$$*$***$*********t*****#****************************$*
`removeChild: removes deSCendents of all the elements from the list
`****¥***$****¥$*¥**¥*#*#******$$*******************i*****¥**********¥*¥**fi
`
`int removeChild(int *array, int tot)
`
`{ i
`
`nt i, j, k, em = 0;
`int *tmparray, m = 99;
`
`tmpan'ay = (int *)calloc(num1ndex, sizeof(int));
`
`x“ Remove any prompts that are responses rather than choices *I‘
`for (i = 0; i < tot; i-H-)
`
`{ f
`
`}
`
`or(i = 0;j < numMenu; jH)
`if(menuList[j][1] == array[i] && menuListU][2] m 100)
`MW] = 0;
`
`P" Remove any prompts that are root node and have a child which is not a leaf rather than
`choices ‘7
`
`72385: v]
`
`95
`
`498
`498
`
`
`
`inangag .1. 1119mm
`
`PATENT
`Docket No.: 4428—4001
`
`for (i = 0; i < tot; i++)
`
`{ i
`
`f(array[i] = 0) if“ already removed so go to next ‘7
`continue;
`
`3* if(isLeaf[array[i]})
`continue; *a’
`
`m = array[i];
`while(l)
`
`{ f
`
`or(j = 0; j < numMenu; j++)
`if (menuListU][1] = :11)
`break;
`
`if (menuListfi][0] = 0)
`break;
`
`m = menuListU][0];
`}
`if(rr1 != array[i])
`
`{ f
`
`or (j = 0;j < tot;j++)
`
`{ i
`
`f (arraym = m)
`arrayfi] = O;
`
`}
`
`}
`
`}
`
`for (i = 0; i < tot; H—F)
`
`{ i
`
`f (array[i = 0) P" already removed so go to next ‘5’
`continue;
`for (j = 0;} < numlndex;j++) l" initialize tmparray *f
`thaITayLi] = 0;
`cnt = getChildren(array[i], tmparray); i" get children & grand-children of i *l
`for (j = 0;} < tot; j++)
`I’“ scan thru the array to check for child *f
`if (j I: i) f“ ignore self from checking *z’
`for (k = 0; k < cnt; k++)
`if (arraym = tmparray[k])
`
`{ a
`
`rrayfj] = 0; f“ ifj is child ofi, make it 0 *f
`break;
`
`‘3'2885l v]
`
`96
`
`499
`499
`
`
`
`llEflE'g'glESg willgfla
`
`PATENT
`Docket No.: 4428-400]
`
`}
`
`}
`l" Shifl All non-zeroes upwards *I
`for (i = O; i < tot; i++)
`
`{ i
`
`f(arrayfi] = 0)
`
`{ f
`
`or(j =i+1;j~’~tot;j-H-)
`if(arraylj] != 0)
`break;
`
`if (j < tot)
`
`{ a
`
`rrayfil = arrayfi];
`mayfl] = 0;
`}
`
`}
`
`}
`3”“ count no of elements *i
`
`for (j = 0;j < tot;j+—|r)
`
`i{f(arraym = 0)
`
`break;
`
`‘}
`return J;
`
`} f
`
`************#*#**¥**********¥********¥**¥¥****¥*¥*¥**¥$***#****#***$
`
`getChildren: fetches all the descendents of pmpt into array
`***************************t****t*****t******#***$**#***********$**¥f
`
`int getChildren(int pmpt, int *array)
`
`{ i
`
`nt i,j, k, 1;
`int t, t1, t2;
`
`int *tmparrayl, *tmparrayz;
`
`if (isLeaf(pmpt)) :’* if node is leaf no children 50 return 0 *f
`retum 0;
`
`trnparrayl = (int *)calloc(numh1dex, sizeof(int)); l* child of child in every loop *1
`tmparray2 = (int *)calloc(num Index, sizeoffint»; F union of all scanned children *i
`t = t1 = 12 = 0;
`for (i = 0; i < numMenu; i++)
`{
`
`128851 v]
`
`97
`
`500
`500
`
`
`
`.
`
`lflEgfl-EfiEEgnlllgflE
`
`PATENT
`Docket No.: 4428-4001
`
`if (menuList[i][0] = pmpt && menuList[i][2] != 100)
`
`{ a
`
`rray[t] = menuList[i][1];
`t1 = gctChildren(array[t], tmparrayl);
`t2 = Promthnion(trnparray2, tmpan-ayl, t2, t1);
`H—F;
`
`}
`
`}
`t = Promthnion(a.rray, lmparrayZ, t, t2);
`return I;
`
`}
`
`int chkAns (char * ans, int * Parray, int pcnt)
`
`{ c
`
`har locquery[256];
`int i,j, tmplcnt = O, tmp2cnt = 0;
`char *resWords[50], start = 'Y';
`int numWords, ImpArrayl [20], tmpArray2[20];
`int uwFlag = 0, rowOrColWord = 0;
`
`strcpy(locquery,ans);
`numWords = breakStr(ans, resWords);
`if ( strcmp(resWords[0],"other") = 0 && strcmp(resWords[l],"options") = 0)
`
`{ r
`
`eturn 0;
`
`}
`numWords = processArray(resWords, numWords, 1);
`for (i = O; i < 20; i++)
`tmpAn‘ayl [i] = tmpArray2[i] = 0;
`fprintf(p£”<li>1nitialized Temp Arraym"); fflush(pf);
`
`for (i = 0; i < numWords; i++)
`
`i{f(linArray(colurrmTenns, resWordsfi], numColumn))
`i{f(1inArray(rowTenns,resWords[i],numCqumn))
`i{f(IinArray(uWList, resWords[i], uWNum))
`iddWord(&uWList, resWords[i], ++uWNum);
`iflushflt);
`
`723851 VI
`
`98
`
`501
`501
`
`
`
`inaoogao m 11.113383
`
`PATENT
`Docket No.: 44284001
`
`else
`
`.
`{
`fprintf(pf,"<li>Unknown Word: %s\n",resWords[1]);
`fflush(pl);
`uwFlag' = l; 1* unKnown word encountered twice ‘3’
`}
`
`}
`
`else
`
`rowOrColWord++;
`continue;
`
`}
`
`else
`
`rowOrColWordH;
`
`tmp 1 cnt = fetchPrompts(resWords[i], tmpArrayl );
`if (start = 'Y')
`
`{ t
`
`mp2cnt = Promthnion(tn1pArray2, tmpArrayl , tmpZCnt, tmplcnt);
`start='N';
`
`}
`
`else
`
`tmchnt = PrompthitersectionflmpArrayZ, tmpArrayl , tmpZCnt, tmplcnt);
`
`tmpZCnt = Promptlntersection(tmpArray2, Parray, tmpZCnt, pent);
`}
`if (tmchnt != 1)
`{
`
`if (tmpZCnt = 0 && pcnt == 1 && numWords = l) {I i.e. only one prompt &
`
`not selected
`
`{
`
`strcpy(ans, locquery);
`if (chkAfnn(ans))
`return 1;
`
`} i
`
`f (tmplcnt > 1) fl i.e. multiple prompt selection then do score
`{
`
`strcpy(ans, locquery);
`return checkscore(ans, Parray, pent);
`
`if (uwFlag)
`if (AskforOpO)
`return -99;
`
`72335: VI
`
`99
`
`502
`502
`
`
`
`-
`
`‘
`
`ill-JEEGJQES‘Q “lilgflfl
`
`PATENT
`Docket NIL: 4428-4001
`
`else
`
`else
`
`return -1;
`
`if (rowOrColWord)
`
`{ s
`
`trepy(query,loequery);
`return ~99;
`}
`
`}
`for (i = 0; Parray[i]; i++)
`if (Panay[i] = tmpArray2[0])
`return i + l;
`
`} i
`
`nt AskforOpO
`¢{
`1
`I
`Int 1,] ;
`char *resWords[50];
`int numWords ;
`
`system("elear");
`printf("Your request was not understood.\n");
`pri nttI"Would you prefer to speak to an operator or try again with a new request?\n");
`fprinttIIf, "<P>Your request was not understood.<LI>");
`fpr‘intfllf, "Would you prefer to speak to an operator or try again with a new request?\n");
`fi'lushflf);
`I* accept the user input *I
`fgets(query, 255, stdin);
`addWord(&queryList, query, ++nquueryList);
`fprintfflf, "<P><I> %s<lI>", query);
`numWords = breakStr(query, resWords);
`if ( inArray(resWords,"Operator",numWords))
`
`{ p
`
`rintf(“\n\nPlease wait for the operator ...\n");
`fpr‘intf(lf,"*CP>Please wait for the operator ...");
`fflushflf);
`exit(0);
`}
`if( inAnay(resWords,"try",numWords) && inArray(resWords,"again",numWords))
`
`{ s
`
`ystem("elear");
`printf("Please tell us your new requestm");
`fprintfflf, "<P>Please tell us your new requestm");
`fflushfit);
`
`T2885] VI
`
`100
`
`503
`503
`
`
`
`lflJEQQESg .. lii'glflfl
`
`PATENT
`Docket No.: 4428-4001
`
`3"“ accept the user input *I'
`fgets(query, 255, stdin);
`addWord(&queryList, query, HnquueryList);
`}
`return 1;
`
`} v
`
`oid sayOtherO
`
`{ p
`
`rintf(”\nWould you Iike to hear other options?\n\n");
`fprintfaf, "<LI>Would you like to hear other options?<P>");
`otheFlag = 1;
`
`} i
`
`nt checksaore(char *ans, int *Parray, int pent)
`{
`
`char * resWords[50], *pmptWords[SO];
`int i, j, *score, *scorel;
`int numWords, numpWords, maxscore;
`
`score = (int *)malloc(pcnt * sizeof(int»;
`score] = (int *)ma!loc(pcnt * sizeoflintn;
`for (i = 0; i c pent; i++)
`score[i] = score] [i] = 0;
`
`numWords = breakStr(ans, resWords);
`for (i = 0; i < pent; i++)
`{
`
`nurrtpWords = breakStr(prompts[Parray[i]-1], pmptWords);
`for (j = 0;j < numWords; jH)
`if (inArray(pmptWords,resWordsLij, numpWords))
`score[i]++;
`
`} f
`
`or (i = maxscore = 0; i < pent; i++)
`maxscore = (maxscore < seore[i])?score[i]:maxscore;
`
`for (i =j = O; i < pent; i++)
`j += (score[i] — maxscore)?l :0;
`
`if ( j = 1) !* single prompt selection ‘7
`{
`
`for (i = 0; i < pent; i++)
`if (score[i] = maxscom)
`return i + 1;
`
`}
`
`723351 vl
`
`101
`
`504
`504
`
`
`
`‘
`
`iflEQQE‘iEgulllgflm—z’
`
`PATENT
`Docket No.: 4428-4001
`
`else
`
`{
`
`for (i = 0; i < pent; i++)
`{
`
`numpWords = breakStr(prompts[Parray[i] - l], pmptWords);
`score] [i] = getscorel(resWords, numWords, pmplWords, numpWords);
`
`} m
`
`ax score = 0;
`
`for (i = 0; i < pent; i++)
`maxscore = (scorel [i] b maxscore)?score1[i]:maxscore;
`for (i =j = 0; i < pent; i++)
`j += (scorel [i} = maxscore)?1 :0;
`if(j = 1) l'“ single prompt selection *I
`{
`
`for (i = 0; i < pent; i++)
`if (seorel [i] = maxscore)
`return i + 1;
`
`for (i = 0; i < pent; i++)
`if (score[i] != maxscore)
`Parray[i] = 0;
`return -1;
`
`}e
`
`{
`
`}
`
`lse
`
`}
`
`} i
`
`nt chkAfim( char * str)
`{
`
`int i,j, numWords;
`char * resWords[50];
`
`numWords = breakStr(str, resWords);
`for (i = 0; i < numWords; i +4“)
`if (inArray(affimWords, resWordsfi], 3))
`return 1;
`
`return 0;
`
`102
`
`505
`505
`
`} i
`
`nt chkNegtn( char * str)
`{
`
`723851 v]
`
`
`
`ineqqzzsag .. iiigflfl
`
`PATENT
`Docket No.: 4428-4001
`
`int i ,j, numWords;
`char * resWords[50];
`
`numWords = breakStr(str, resWords);
`for (i = 0; i < numWords; i H)
`if (inArray(negWords, resWords[i], 2))
`return 1;
`
`return 0;
`
`} i
`
`nt getscorel(char “Wordl, int numl, char **Word2, int num2)
`{
`
`int i, j, scr = 0;
`int lsmatch = 0;
`
`for(i = 0; i < num1;i++)
`{
`
`for(j = lsmatch;j < num2; jH)
`if (lstrcmp(Word1[i],Word2fi]))
`{
`
`sari-t;
`break;
`
`}
`if (j < num2)
`lsmatch =j + l;
`
`} r
`
`eturn scr;
`
`} i
`
`nt orderPrompts(int *InterPrompts,int numInter)
`{
`
`int i, j, k, 1;
`int *tmpArray[2]; f’“ 0 - score -, 1 - level; 3 - menu order *f
`int *tmpList, tmpCount;
`
`tmpArray[0] = (int *)malloc(num1nter * sizeoflint»;
`tmpArrayU] = (int *)malloc(num1nter * sizeottint»;
`
`tmpList = (int *)malloc(numColumn * sizeofiint»;
`for (i = 0;
`i < numColumn; i++)
`tmpListfi] = 0;
`If get the list of keywords from queryTeIms
`
`72335: v]
`
`103
`
`506
`506
`
`
`
`iflflggfifig "111983
`
`PATENT
`Docket No.: 4428-4001
`
`tmpCount = getKeyWords(queryTenns, nquuery, tmpList);
`
`for (i = 0; i < numlnter; i++)
`{
`
`!* get the maxscore for the prompt *!
`tmpArray[0][i] = 0;
`for (j = 0; (j < numScore) && (scoringfi][0] != InterPromptsfiD; j++);
`f“ if any previous scoring present *I
`if ((i < numScore) && (Scoringfi][0] = InterPrompls[i]))
`{
`
`I! get the max score
`for ( k = 0; k < tmpCount; k++)
`tmpArray[O][i] = max(tmpA1-ray[0][i] , scofingfi][tmpList[k]]);
`
`} t
`
`mpArray[ l ][i] = getLevelflnterPromptsfi]);
`
`} I
`
`! sort the array in order of score, level and menu-order
`for( i = 0; i < (numlnter - 1); iH)
`{
`
`for (j = i + 1;j < numInter; jH)
`if (lgThan(tmpArray[0][i], tmpArrayHHi], lnterPromptsfi],
`tmpArray[0][j], tmpArray[ l][i], InterPromptsUD)
`{
`
`swap(tmpAIray[0][i], tmpArray[0][i]);
`swapflmpArrayUHiL tmpArrayl IJLiD;
`swap(1nterPrompts[i], InterPrompts[j]);
`
`}
`
`} r
`
`eturn numInter;
`
`} i
`
`nt getKeyWords£char **queryTenns, int nquuery, int *tmpList)
`{
`
`int i,j, k, 1;
`int count = 0;
`
`for (j = 0; j d nquuery; j“)
`{
`
`l“ Check ifthe word is keyword *a’
`if ((k = inArray(columnTenns, queryTermsfi], numColurnn)) != O)
`{
`
`723351 VI
`
`104
`
`507
`507
`
`
`
`iflEQJQESg alilgfia
`
`PATENT
`Docket No.: 4428-4001
`
`/* add in temp list only if not present *I
`for (i = 0; i < count && tmpList[i] != k ; i++);
`if (i >= count)
`tmpList{count++] = k;
`continue;
`
`} 3
`
`* check if the word is Thesaurusteamed Word *i
`
`if ((k z inArray(rowTerms, queryTermsU], numRow)) != 0)
`{
`
`l“ pick-up all keywords for that word *1
`for (i = 0', thesaurus[k - 1][i] != 0; i++)
`{
`
`for (l = 0; l < count && tmpList[l] != thesaurus[k - 1][i] ; l-l-P);
`if (1 >= count)
`tmpList[count+—t] = thesaurus[k - 1][i];
`
`}
`
`}
`
`} r
`
`eturn count;
`
`} i
`
`nt getLeveIfint pmpt)
`{
`
`int i, k, l;
`
`for (i = 0; i < numMenu && menuList[i][l] != pmpt; i++);
`k = menuList[i][0];
`for (l = 0; k > 0;I++)
`{
`
`for (i = 0; i < numMenu && menuList[i][1] != k; i++);
`k = menuList[i][0];
`
`105
`
`508
`508
`
`} r
`
`eturn I;
`
`} i
`
`nt gThan(int 3, int b, int c, int p, int q, int r)
`{
`.
`if Desc order here
`if (a > p) return 1;
`if(a C p) return 0; {I Desc order here
`if (b b q) return 0;
`if Ase order here
`
`728351 v1
`
`
`
`1112113991359 ”1119133
`
`PATENT
`Docket No.: 4428-4001
`
`if (b < q) return 1; fl Asc order here
`if (c > r) return 0;
`If Asc order here
`return 1; f! Asc order here
`
`formlib.c: This program contains fimctions for forms processing
`#include <stdio.h)
`
`#include <string.h>*'
`#include “arraylibh”
`
`struct input {
`char *Ty-pe;
`Char *APrornpt;
`char *R