|
|
1.1 ! root 1: /* %W% */ ! 2: #include <stdio.h> ! 3: #define R random() ! 4: #define T 0.125 ! 5: #define CHOOSE(x) (x[R%(sizeof x / sizeof *x)]) ! 6: #define EQ(a,b) (strcmp(a,b)==0) ! 7: #define LAST(x) (x[strlen(x)-1]) ! 8: #define VOWEL(x) (x=='a'||x=='e'||x=='i'||x=='o'||x=='u') ! 9: #define N 8 ! 10: typedef struct xyz { char *type; ! 11: union { struct xyz *x[N]; ! 12: char *s[N]; } list; } *X,XX; ! 13: typedef struct { char *number,*ending,*tense,*an,*unspec,*passive; } *E,EE; ! 14: ! 15: X getxx(),verbal(),comp(),advp(),adjph(),adverb(),adjective(),prep(),vprep(); ! 16: X np(),aux(),vp(),art(),modal(),perf(),prog(),nounal(),sent(),comma(); ! 17: X adjval(); ! 18: char *tense(),*number(),*prefix(),*root(); ! 19: ! 20: double makeup=.95; ! 21: static char *adjlist[] = {"concrete","abstract","procedural","real","ideal", ! 22: "functional","prototype", ! 23: "effective","capable","incremental", ! 24: "perceived","associated","interdepartmental", ! 25: "diverse","characteristic","worst-case", ! 26: "qualitative","fully automatic","candidate", ! 27: "consensual","consequential","conjectural", ! 28: "constructive","initial","cooperative", ! 29: "essential","methodological","requisite", ! 30: "historical","situational","political", ! 31: "prepared","material","defined","well defined", ! 32: "organizational","projected","overall", ! 33: "accepted","rejected","corresponding", ! 34: "committed","environmental","typical","working","timely", ! 35: "growing","unprecedented","new","renewed","fresh", ! 36: "rapid","changing","careful","comprehensive","broad", ! 37: "massive","huge","enormous", ! 38: "evaluated","discresionary", ! 39: "durable","beneficial", ! 40: "maximal","tremendous","minimal", ! 41: "on-site","standardized","standard", ! 42: "powerful","natural","necessary", ! 43: "reasonable","successful", ! 44: "doubtful","dubious","certain", ! 45: "unified","different","similar","utilitarian", ! 46: "realizable","organizable","motivated", ! 47: "topical","valuable","feasible", ! 48: "intelligent","deliverable","nontrivial", ! 49: "worthwhile","complicated", ! 50: "organized","organizing","progressing", ! 51: "schedulable","resourceful","commanding", ! 52: "important","allocatable","temporal", ! 53: "ponderable","understandable","comprehendable", ! 54: "past","present","future", ! 55: "obvious","considerable","finished","completed", ! 56: "unique","abovementioned", ! 57: "major","minor","tendentious","activating", ! 58: "actual","added","adequate","affordable", ! 59: "analyzable","additional","intuitive", ! 60: "artificial","good","better", ! 61: "worse","bad","basic","fundamental","brief", ! 62: "general","very unique","extreme","most unique", ! 63: "central","proximate","approximate","collected", ! 64: "conductable","comtemplatable", ! 65: "continuing","demonstrable","desirable", ! 66: "correctable","foreseeable", ! 67: "discontinued","early","beginning", ! 68: "effectuated","elucidated","emotional", ! 69: "enclosed","enthused","entire","exact", ! 70: "experimental","fearful","final", ! 71: "following","informative", ! 72: "full","complete","indicated","authorized", ! 73: "modularized","submodularized", ! 74: "particular","preferred","satisfactory", ! 75: "measurable","referenced","literal", ! 76: "modified", ! 77: "correct","prioritized","prolonged", ! 78: "regrettable","apparent", ! 79: "continued","subsequent","sufficient", ! 80: "suggestive","true","ultimate","separate", ! 81: "purposeful","regarded","resulting", ! 82: "doubtful","evident","interesting","worthy", ! 83: "uniform", ! 84: "vital","viable", ! 85: "worthwhile","alternative", ! 86: "sophisticated","employed", ! 87: "clear","lucid","simple","perspicuous", ! 88: "incomplete","concerned"}; ! 89: ! 90: random() { ! 91: long lrand(); ! 92: static short tab[31]; ! 93: static short i; ! 94: i=(lrand()>>15) & 32767; ! 95: return tab[i%31]=32767-tab[i%31]^i; ! 96: } ! 97: ! 98: X nomq(env) E env; { ! 99: X v=getxx(); ! 100: v->type="-nomq"; ! 101: if(EQ(env->number,"sing")) { ! 102: if(EQ(tense(),"past"))v->list.s[0]="there was"; ! 103: else v->list.s[0]="there is"; ! 104: } ! 105: else { ! 106: if(EQ(tense(),"past"))v->list.s[0]="there were"; ! 107: else v->list.s[0]="there are"; ! 108: } ! 109: if(prob(0.2))v->list.s[1]=" not"; ! 110: return v; ! 111: } ! 112: X rel(env) E env; { ! 113: static char *c[] = {"that","which"}; ! 114: X v=getxx(); ! 115: v->type="-rel"; ! 116: v->list.s[0]=CHOOSE(c); ! 117: return v; ! 118: } ! 119: ! 120: X sent(env) E env; { ! 121: X sentv=getxx(); ! 122: sentv->type="sent"; ! 123: if(prob(0.09)) { ! 124: env->unspec=""; ! 125: sentv->list.x[1]=np(env); ! 126: sentv->list.x[3]=aux(env); ! 127: sentv->list.x[4]=vp(env); ! 128: sentv->list.x[0]=nomq(env); ! 129: sentv->list.x[2]=rel(env); ! 130: return sentv; ! 131: } ! 132: sentv->list.x[0]=np(env); ! 133: sentv->list.x[1]=aux(env); ! 134: sentv->list.x[2]=vp(env); ! 135: return sentv; ! 136: } ! 137: ! 138: X nomy(env) E env; { ! 139: X v=getxx(); ! 140: v->type="-nomq"; ! 141: v->list.s[0]="the fact that"; ! 142: return v; ! 143: } ! 144: ! 145: X np(env) E env; { ! 146: X npv=getxx(); ! 147: EE nenv; ! 148: static EE empty; ! 149: npv->type="np"; ! 150: if(prob(0.025)) { ! 151: nenv=empty; ! 152: npv->list.x[0]=nomy(&nenv); ! 153: npv->list.x[1]=sent(&nenv); ! 154: if(env->number==0)env->number="sing"; ! 155: return npv; ! 156: } ! 157: npv->list.x[1]=nounal(env); ! 158: npv->list.x[0]=art(env); ! 159: return npv; ! 160: } ! 161: ! 162: X aux(env) E env; { ! 163: X auxv=getxx(); ! 164: int i=0; ! 165: auxv->type="aux"; ! 166: if(env->tense==0)env->tense=env->ending=tense(); ! 167: if(prob(0.25))auxv->list.x[i++]=modal(env); ! 168: if(prob(0.25))auxv->list.x[i++]=perf(env); ! 169: if(prob(0.25))auxv->list.x[i++]=prog(env); ! 170: return auxv; ! 171: } ! 172: ! 173: X passive(env) E env; { ! 174: X v=getxx(); ! 175: v->type="-passive"; ! 176: if(env->tense==0)env->tense=env->ending=tense(); ! 177: if(env->number==0)env->number=number(); ! 178: if(EQ(env->ending,"modal"))v->list.s[0]="be"; ! 179: else if(EQ(env->ending,"-en"))v->list.s[0]="been"; ! 180: else if(EQ(env->ending,"-ing"))v->list.s[0]="being"; ! 181: else { ! 182: if(EQ(env->tense,"past")) ! 183: v->list.s[0]=EQ(env->number,"sing")?"was":"were"; ! 184: else v->list.s[0]=EQ(env->number,"sing")?"is":"are"; ! 185: } ! 186: env->passive=env->ending="pass"; ! 187: return v; ! 188: } ! 189: ! 190: X passprep(env) E env; { ! 191: X v=getxx(); ! 192: v->type="-passprep"; ! 193: v->list.s[0]="by"; ! 194: return v; ! 195: } ! 196: ! 197: X vp(env) E env; { ! 198: X vpv=getxx(); ! 199: int i=0; ! 200: vpv->type="vp"; ! 201: if(prob(0.5))vpv->list.x[i++]=passive(env); ! 202: vpv->list.x[i++]=verbal(env); ! 203: vpv->list.x[i++]=comp(env); ! 204: if(prob(0.10))vpv->list.x[i++]=advp(env); ! 205: return vpv; ! 206: } ! 207: ! 208: X art(env) E env; { ! 209: static char *aspecsg[] = {"the","the","the","the","the","this","this","that"}; ! 210: static char *aspecpl[] = {"the","the","the","the","the","these","those"}; ! 211: static char *aunssg[] = {"a","a","a","a","a","a","a","much","each","any"}; ! 212: static char *aunspl[] = {"some","a few","a couple","several","many","all", ! 213: "no", ! 214: "an undue number of", ! 215: "a number of"}; ! 216: X artv=getxx(); ! 217: artv->type="-art"; ! 218: if(env->number==0)env->number=number(); ! 219: if(env->unspec==0&&prob(0.33)) { ! 220: if(EQ(env->number,"sing"))artv->list.s[0]=CHOOSE(aspecsg); ! 221: else artv->list.s[0]=CHOOSE(aspecpl); ! 222: } ! 223: else if(prob(0.50)||env->an&&EQ(env->number,"sing")) { ! 224: if(EQ(env->number,"sing"))artv->list.s[0]=env->an?"a":CHOOSE(aunssg); ! 225: else artv->list.s[0]=CHOOSE(aunspl); ! 226: if(env->an&&EQ(artv->list.s[0],"all"))artv->list.s[0]=""; ! 227: } ! 228: else artv->list.s[0]=""; ! 229: env->unspec=0; ! 230: if(env->an&&EQ(env->an,"an")&&EQ(artv->list.s[0],"a")) ! 231: artv->list.s[0]="an"; ! 232: env->an=0; ! 233: return artv; ! 234: } ! 235: ! 236: X modal(env) E env; { ! 237: static char *pres[] = {"can","may","must","shall","will"}; ! 238: static char *past[] = {"could","might","should","would"}; ! 239: X modalv=getxx(); ! 240: modalv->type="-modal"; ! 241: if(env->tense==0)env->tense=env->ending=tense(); ! 242: if(EQ(env->ending,"pres"))modalv->list.s[0]=CHOOSE(pres); ! 243: else modalv->list.s[0]=CHOOSE(past); ! 244: env->ending="modal"; ! 245: return modalv; ! 246: } ! 247: ! 248: X perf(env) E env; { ! 249: X perfv=getxx(); ! 250: perfv->type="-perf"; ! 251: if(env->tense==0)env->tense=env->ending=tense(); ! 252: if(env->number==0)env->number=number(); ! 253: if(EQ(env->ending,"past")) { ! 254: perfv->list.s[0]="had"; ! 255: } ! 256: else if(EQ(env->ending,"pres")) { ! 257: if(EQ(env->number,"sing"))perfv->list.s[0]="had"; ! 258: else perfv->list.s[0]="have"; ! 259: } ! 260: else perfv->list.s[0]="have"; ! 261: env->ending="-en"; ! 262: return perfv; ! 263: } ! 264: ! 265: X prog(env) E env; { ! 266: X progv=getxx(); ! 267: progv->type="-prog"; ! 268: if(env->tense==0)env->tense=env->ending=tense(); ! 269: if(env->number==0)env->number=number(); ! 270: if(EQ(env->ending,"pres")) { ! 271: if(EQ(env->number,"sing"))progv->list.s[0]="is"; ! 272: else progv->list.s[0]="are"; ! 273: } ! 274: else if(EQ(env->ending,"past")) { ! 275: if(EQ(env->number,"sing"))progv->list.s[0]="was"; ! 276: else progv->list.s[0]="were"; ! 277: } ! 278: else if(EQ(env->ending,"-en")) { ! 279: progv->list.s[0]="been"; ! 280: } ! 281: else if(EQ(env->ending,"modal")) { ! 282: progv->list.s[0]="be"; ! 283: } ! 284: env->ending="-ing"; ! 285: return progv; ! 286: } ! 287: ! 288: X verb(env) E env; { ! 289: /* they pres, he pres, they past, they perf, they prog, they pass */ ! 290: static char *ends[][6] = {{"ate","ates","ated","ated","ating","ated"}, ! 291: {"en","ens","ened","ened","ening","ened"}, ! 292: {"esce","esces","esced","esced","escing","esced"}, ! 293: {"fy","fies","fied","fied","fying","fied"}, ! 294: {"ize","izes","ized","ized","izing","ized"}}; ! 295: X verbv=getxx(); ! 296: int i; ! 297: verbv->type="-verb"; ! 298: if(env->tense==0)env->tense=env->ending=tense(); ! 299: if(env->number==0)env->number=number(); ! 300: if(0&&prob(0.1)&&EQ(env->tense,env->ending)) { ! 301: if(EQ(env->number,"sing")) { ! 302: if(EQ(env->tense,"pres"))verbv->list.s[0]="is"; ! 303: else verbv->list.s[0]="was"; ! 304: } ! 305: else { ! 306: if(EQ(env->tense,"pres"))verbv->list.s[0]="are"; ! 307: else verbv->list.s[0]="were"; ! 308: } ! 309: } ! 310: else { ! 311: verbv->list.s[0]=prefix(env); ! 312: verbv->list.s[1]=root(env); ! 313: if(EQ(env->ending,"pres")&&EQ(env->number,"sing"))i=1; ! 314: else if(EQ(env->ending,"pres")||EQ(env->ending,"modal"))i=0; ! 315: else if(EQ(env->ending,"past"))i=2; ! 316: else if(EQ(env->ending,"-en"))i=3; ! 317: else if(EQ(env->ending,"-ing"))i=4; ! 318: else if(EQ(env->ending,"pass"))i=5; ! 319: else i=0; ! 320: verbv->list.s[2]=ends[R%(sizeof ends/sizeof *ends)][i]; ! 321: } ! 322: env->ending=0; ! 323: return verbv; ! 324: } ! 325: ! 326: X noun(env) E env; { ! 327: static char *suff[] = {"ion","sion","tion","age","ness","ment","ure", ! 328: "ity","iety","ty","ence","ency","ance", ! 329: "ancy","tude","hood","ture","ate","art","ard", ! 330: "ism","ine","stress","trix","ess", ! 331: "dom","ship","eer","ster","ant","ent","ary", ! 332: "ery","ory","ette","let","ling","ule","kin", ! 333: "ar","or","ist", ! 334: "fulness", ! 335: "kin","cule","icle","y","ability","iosos"}; ! 336: static char *wordy[] = {"final completion","final ending","final outcome", ! 337: "adaptation","appearance","argument","circumstance", ! 338: "confession","confidence","delimitation","dilution", ! 339: "dissertation","distribution","duplication", ! 340: "entertainment","equipment","evolution", ! 341: "existence","expression","generation","impression", ! 342: "integration","interaction","investment","judgment", ! 343: "population","provision","solution","statement", ! 344: "tradition","transmission", ! 345: "final result","added increment","assistance", ! 346: "beneficial assistance","mutual cooperation", ! 347: "projection","future projection", ! 348: "capability","conjecture","consensus of opinion", ! 349: "general consensus","absence","deficiency", ! 350: "inadequacy","insufficience","insufficiency", ! 351: "growing importance","renewed emphasis", ! 352: "renewed interest","changing behavior", ! 353: "critical thinking","careful thinking", ! 354: "comprehensive survey","high standard", ! 355: "basic foundation","system testing", ! 356: "serious discussion","serious concern", ! 357: "organizational framework","prototype model", ! 358: "uniform nomenclature","greater cooperation", ! 359: "uniform consistency","early expectation", ! 360: "standardization","great similarity", ! 361: "shortage","presence","sufficiency", ! 362: "consequent result","construct","disutility", ! 363: "early beginning","emotional feeling","endeavor", ! 364: "authorization","order of magnitude","preference", ! 365: "impact","joint cooperation","joint partnership", ! 366: "main essential","methodology","modification", ! 367: "necessary requisite","past history","situation", ! 368: "effectuation","clarification","new doubt", ! 369: "policy","encouragement","preparation", ! 370: "criterion","material","interest","acceptance", ! 371: "rejection","publication","circulation", ! 372: "protection","insurance", ! 373: "assignment","identification", ! 374: "submission","request", ! 375: "guidance","correspondence","inclusion", ! 376: "attachment","assumption", ! 377: "recommendation","prescription","approval", ! 378: "discretion","responsibility","relevance", ! 379: "issuance","termination","total effect", ! 380: "deleterious effect","consolidation", ! 381: "aggregation","definiteness","commencement", ! 382: "actual experience","experience", ! 383: "combination","accord","filing", ! 384: "idea","abstraction","method","procedure", ! 385: "complaint","maintenance","finance","travel", ! 386: "purchase","repair","routine", ! 387: "development","cancellation", ! 388: "partitioning","development effort", ! 389: "project","automation","multilevel architecture", ! 390: "multilevel heirarchy","data stream", ! 391: "objective", ! 392: "individual assignment","mode of operation", ! 393: "clear community","attendant interest", ! 394: "task division","well defined interfacing", ! 395: "team report","meeting time","effective use", ! 396: "friction", ! 397: "major objective","ownership", ! 398: "overall project time constraint", ! 399: "functional division","requirements analysis", ! 400: "code development","charter", ! 401: "requirements definition","vertical division", ! 402: "broad range","strong feeling", ! 403: "considerable latitude","overall project constraint", ! 404: "sufficient resource","assigned task","expectation", ! 405: "critical aspect","clear understanding", ! 406: "computing load","clean interfacing","natural basis", ! 407: "team activity","team responsibility", ! 408: "main function","predominant portion", ! 409: "work plan","major breakpoint","work module", ! 410: "achievable accuracy","supplementary work", ! 411: "field version","internal establishment", ! 412: "internal communication","development progress", ! 413: "internal meeting","experience level", ! 414: "high level autonomy","adherence", ! 415: "feasibility demonstration","persistent problem", ! 416: "internal objective","idea sharing", ! 417: "improved performance","unfamiliar methodology", ! 418: "new methodology","development experience", ! 419: "module specification","good progress", ! 420: "optimal number","natural division", ! 421: "good relationship","cross attendance", ! 422: "attendance","necessary communication", ! 423: "evolving organization","basic principle", ! 424: "complete revision","general information", ! 425: "primary objective","load-carrying capacity", ! 426: "necessary revision","major change", ! 427: "clarified interpretation","subsequent attempt", ! 428: "basic objective","full utilization", ! 429: "practical consideration", ! 430: "proportionate quantity","substantial change", ! 431: "database design","unified framework", ! 432: "customer service","strong interest", ! 433: "unified description","necessary background information", ! 434: "provisioning","physical coverage","general observation", ! 435: "new technology","validity determination", ! 436: "relation","regulation","verification", ! 437: "impediment","portal","practice","premise", ! 438: "basis","movement","question", ! 439: "issue","input","output","observation", ! 440: "input","output","input","output", ! 441: "mechanization","function","evaluation", ! 442: "result","further consideration","category", ! 443: "performance indicator","early warning", ! 444: "analysis purpose","measurement","replacement", ! 445: "utilitarian purpose", ! 446: "quota","proposed enhancement","enhancement", ! 447: "interfacing","team organization","module", ! 448: "guideline","continuing study", ! 449: "required assistance","major advance", ! 450: "proposal","hierarchy", ! 451: "current view","refinement","activity", ! 452: "external description","tight schedule pressure", ! 453: "internal conflict","internal issue", ! 454: "reasonable compromise","next phase", ! 455: "goal","time constraint","constraint", ! 456: "outcome","important outcome", ! 457: "considerable experience","intelligent choice", ! 458: "deliverable documentation","discussion", ! 459: "timely delivery","design issue","large quantity", ! 460: "general environment","protocol", ! 461: "transitioning","modeling", ! 462: "considerable difficulty","abstract interfacing", ! 463: "data structure","consideration","difficulty", ! 464: "statistical accuracy", ! 465: "agenda","technique","reordering", ! 466: "reauthorization","current proposal", ! 467: "significant change","criteria","validation", ! 468: "validity", ! 469: "terminology","current understanding", ! 470: "incorporation","staffing impact", ! 471: "schedule impact","cost tradeoff", ! 472: "system architecture", ! 473: "adequate capacity","centralization", ! 474: "current task","system deployment", ! 475: "attendant uncertainty","process", ! 476: "potential usefulness","proposed method", ! 477: "basic assumption","anomaly", ! 478: "available data","potential improvement", ! 479: "registration","exemption","exception", ! 480: "follow-up","service", ! 481: "installation","construction","necessity", ! 482: "occasion","instrumentation","disposal", ! 483: "attractiveness", ! 484: "convenience","sponsoring", ! 485: "signification","meaningfulness", ! 486: "significantness","individuality", ! 487: "specification","determination","affirmation", ! 488: "recruitment","supervision","management", ! 489: "oversight","overview","environment", ! 490: "effectation","circumvention","location", ! 491: "execution","effectiveness","consciousness", ! 492: "notation","confirmation","restriction", ! 493: "organization","realization","actification", ! 494: "activation","reification","beginning","conclusion", ! 495: "ending","finishing","teamwork","motivation", ! 496: "attitude","good attitude", ! 497: "progress","milestone","deadline","schedule", ! 498: "allocation","resource","command","concern", ! 499: "time","time frame","reality", ! 500: "behaviour","ability","advent","increment", ! 501: "opportunity","accomplishment","aggregate", ! 502: "analysis","totality","matter", ! 503: "date","duration","centrality", ! 504: "proximity","collection","elimintaion", ! 505: "investigation","opinion","debate", ! 506: "decision","benefit","difference","discontinuity", ! 507: "fabrication","plan","chart","forecast", ! 508: "simplicity","simplification","maximization", ! 509: "minimization","direction", ! 510: "agreement", ! 511: "amount","quantity","quality","essence", ! 512: "description","violation","purpose", ! 513: "primary purpose","automatic control","redefinition", ! 514: "uniform emphasis","study activity","work activity", ! 515: "concept stage","concept activity", ! 516: "possible potential","summarization","system function", ! 517: "rationale","significant enhancement","diverse need", ! 518: "diverse organization","comprehensive plan","interim", ! 519: "functional overview","system configuration", ! 520: "configuration","failure","quantitative result", ! 521: "major obstacle","conception", ! 522: "effectiveness","final evaluation", ! 523: "interrelationship","functional requirement", ! 524: "system philosophy","verbal interchange", ! 525: "perceived inadequacy","primary emphasis", ! 526: "intermingling","cooperation","partnership", ! 527: "adjustment","application","implementation", ! 528: "contact","mention","power", ! 529: "nature","invention","importance", ! 530: "ground","reason","permission","size", ! 531: "report","documentation","priority", ! 532: "pursuance","recurrance","resumption", ! 533: "presupposition","continuance", ! 534: "substantiation","success","action","truth", ! 535: "past experience","greater acceptability", ! 536: "organizational structure","clear distinction", ! 537: "clear definition", ! 538: "significant use","unmet need","centralized organization", ! 539: "vague concept","negative impact","detrimental effect", ! 540: "modularization","submodularization", ! 541: "effect","consistancy", ! 542: "inconsistancy","completion","utilization", ! 543: "reference","doubt","evidence", ! 544: "viewpoint", ! 545: "actual fact", ! 546: "true fact","underlying purpose","viable alternative"}; ! 547: X nounv=getxx(); ! 548: int i=0; ! 549: nounv->type="-noun"; ! 550: if(env->number==0)env->number=number(); ! 551: if(prob(makeup)) { ! 552: if(prob(0.05)) { ! 553: nounv->list.s[i++]=CHOOSE(adjlist); ! 554: nounv->list.s[i++]="ness"; ! 555: } ! 556: else nounv->list.s[i++]=CHOOSE(wordy); ! 557: } ! 558: else { ! 559: nounv->list.s[i++]=prefix(env); ! 560: nounv->list.s[i++]=root(env); ! 561: nounv->list.s[i++]=CHOOSE(suff); ! 562: } ! 563: if(EQ(env->number,"plural")) { ! 564: if(LAST(nounv->list.s[i-1])=='s')nounv->list.s[i]="es"; ! 565: else if(LAST(nounv->list.s[i-1])=='y')nounv->list.s[i]="ies"; ! 566: else nounv->list.s[i]="s"; ! 567: } ! 568: return nounv; ! 569: } ! 570: ! 571: X nounal(env) E env; { ! 572: X nounalv=getxx(); ! 573: int i=0; ! 574: X p; ! 575: nounalv->type="nounal"; ! 576: if(prob(0.15)) { ! 577: nounalv->list.x[i++]=adjval(env); ! 578: } ! 579: nounalv->list.x[i++]=noun(env); ! 580: if(prob(0.15)) { ! 581: nounalv->list.x[i++]=adjph(env); ! 582: } ! 583: env->an="a"; ! 584: for(p=nounalv; p->type[0]!='-'; p=p->list.x[0]); ! 585: for(i=0; p->list.s[i]; i++) { ! 586: if(p->list.s[i][0]==0)continue; ! 587: if(VOWEL(p->list.s[i][0])) { ! 588: env->an="an"; ! 589: } ! 590: break; ! 591: } ! 592: return nounalv; ! 593: } ! 594: ! 595: X adjval(env) E env; { ! 596: X adjvalv=getxx(); ! 597: int i=0; ! 598: adjvalv->type="adjval"; ! 599: if(prob(0.25)) { ! 600: adjvalv->list.x[i++]=adverb(env); ! 601: } ! 602: do { ! 603: adjvalv->list.x[i++]=adjective(env); ! 604: } while(i<N-1&&prob(0.25)); ! 605: return adjvalv; ! 606: } ! 607: ! 608: char *prefix(env) E env; { ! 609: static char *pref[] = { ! 610: "amb","ambi","super","hyper","an","tra","trans","post","palim", ! 611: "omni","pan","circ","circum","peri","a","ab","abs","de","apo", ! 612: "re","ana","mal","ante","pre","fore","pro","infra","para", ! 613: "inter","ultra","extra","trans","cata","de","oct","octa", ! 614: "octo","equi","pseudo","prim","prot","proto","pent","penta", ! 615: "quin","quint","quinque","pro","tetr","tetra","quad","quadr", ! 616: "quadri","quartet","off","bene","hemi","demi","semi","crypto", ! 617: "cent","centi","hecto","en","em","in","im","intro","be", ! 618: "macro","poly","mult","multi","neo","nona","novem","ennea", ! 619: "in","un","im","il","ir","non","a","nil","paleo","mon","mono", ! 620: "uni","e","ex","ec","ef","super","supr","sur","hyper","vic", ! 621: "vice","hept","hepta","sept","septe","septem","septi","hex", ! 622: "hexa","sex","dis","deca","deka","deci","kilo","mill","milli", ! 623: "tri","per","dia","ad","com","di","amphi","bi","bin","bis", ! 624: "sub","hypo","epi","eu","holo"}; ! 625: if(prob(0.65))return ""; ! 626: return CHOOSE(pref); ! 627: } ! 628: ! 629: char *root(env) E env; { ! 630: static char *root[] = { ! 631: "pan","omni","arch","zo","rog","rogat","cred","flect","flex", ! 632: "test","hem","hemato","nasc","nat","bibl","fer","voc","port","lat", ! 633: "fortuna","ped","chrom","vinc","vict","crea","cise","mort","mors", ! 634: "necr","claim","clam","hetero","pel","puls","vac","iso","phobe", ! 635: "phobia","prim","prime","flu","flux","sequ","liber","liver","theo", ! 636: "magna","medi","man","manu","pen","pend","pens","eu","capit", ! 637: "iatr","aud","aus","cor","cord","cour","grav","ten","tain", ! 638: "tent","sacr","sacer","heiro","sanct","cide","mega","ultima", ! 639: "ridi","risi","leg","jus","jur","nom","duc","duct","duce", ! 640: "bio","viv","vivi","vita","lus","lum","luc","photo", ! 641: "min","philo","phile","phila","amic","anthrop","poly","multi", ! 642: "fac","fact","fic","fect","meter","psych","mod","mot","mov", ! 643: "nov","neo","neg","uni","alter","ali","idio","pop","dem", ! 644: "demo","lic","licit","poten","posse","potes","mem","simul", ! 645: "arch","homo","mar","mer","vis","vid","scope","auto","mitt", ! 646: "miss","ac","acr","brev","clud","clus","dorm","micro","aster", ! 647: "astro","rect","recti","forc","fort","path","cap","cep","cept", ! 648: "put","tempo","tempor","dent","dont","ver","veri", ! 649: "feder","fide","feal","fid","cosm","migra","hydro","aqu", ! 650: "endo","gyn","logo","opus","oper","graph","scrib","scrip", ! 651: "mis","miso","anni","annu","enni","ced","cede","ceed","cess"}; ! 652: return CHOOSE(root); ! 653: } ! 654: ! 655: prob(f) double f; {return R<f*32767.0;} ! 656: ! 657: char *tense() {return prob(0.5)? "pres": "past";} ! 658: ! 659: char *number() {return prob(0.25)?"plural":"sing";} ! 660: ! 661: X getxx() { ! 662: X rv; ! 663: static XX empty; ! 664: rv=(X)malloc(sizeof*rv); ! 665: if(rv==0)printf("outa space\n"),exit(1); ! 666: *rv=empty; ! 667: return rv; ! 668: } ! 669: ! 670: X verbal(env) E env; { ! 671: X verbalv=getxx(); ! 672: int i=0; ! 673: verbalv->type="verbal"; ! 674: if(prob(0.25))verbalv->list.x[i++]=adverb(env); ! 675: verbalv->list.x[i++]=verb(env); ! 676: return verbalv; ! 677: } ! 678: ! 679: X adverb(env) E env; { ! 680: static char *wordy[] = {"very ","extremely ","generally ","reasonably ", ! 681: "fundamentally ","essentially ","particularly ","very ", ! 682: "very ","very ", ! 683: "very ","very ", ! 684: "very ","very ", ! 685: "very ","very ", ! 686: "very ","very ", ! 687: "very ","very ", ! 688: "very ","very ", ! 689: "entirely ", ! 690: "rather ","fairly ","relatively ","comparatively ", ! 691: "moderately ", ! 692: "totally ","very ","quite "}; ! 693: static char *suff[] = {"wardly","ably","wisely","ably","ily","ly","ly","ly"}; ! 694: static char *c[] = {"absolutely","functionally", ! 695: "accordingly","broadly","actionably","actually", ! 696: "additionally", ! 697: "ambiguously","amply", ! 698: "analogously", ! 699: "aperiodically", ! 700: "apparently","appreciably", ! 701: "appropriately","approximately", ! 702: "arbitrarily", ! 703: "associatively", ! 704: "automatically", ! 705: "awfully", ! 706: "axiomatically", ! 707: "badly","barely","basically", ! 708: "beneficially", ! 709: "blatantly", ! 710: "capably","carefully","carelessly", ! 711: "casually","causally","cautiously", ! 712: "centrally","certainly", ! 713: "cheaply","cleanly", ! 714: "closely","coarsely","cognizantly", ! 715: "coincidentally","collectively","collaterally", ! 716: "comparably", ! 717: "competently","completely","comprehensibly", ! 718: "concededly","conceivably", ! 719: "concisely","conclusively","concretely", ! 720: "concurrently","conjecturally", ! 721: "currently", ! 722: "conscientously","consequently","consequentially", ! 723: "consistently","constantly", ! 724: "contemporaneuosly","constructively", ! 725: "continually","continuously","contractually", ! 726: "contrarily","contributatively","conveniently", ! 727: "conventionally", ! 728: "correctively", ! 729: "correctly", ! 730: "crudely", ! 731: "curiously", ! 732: "decidedly", ! 733: "deeply", ! 734: "deficiently","demandingly", ! 735: "dependably","desireably", ! 736: "determinately","diagnostically", ! 737: "differentially","differently", ! 738: "directly","discernibly", ! 739: "distinctly","doubtfully","dramatically", ! 740: "dynamically", ! 741: "economically", ! 742: "effecaciously","efficiently", ! 743: "elegantly", ! 744: "emphatically","encouragingly", ! 745: "endlessly","endurably", ! 746: "entirely","epistomologically", ! 747: "functionally","immediately", ! 748: "equably","equally","equitably","erroneously", ! 749: "esoterically","eternally","evenly","eventfully", ! 750: "eventually","evidently", ! 751: "exceedingly","exactly","excellently", ! 752: "exceptionally","excessively","exclusively", ! 753: "experimentally", ! 754: "explicitly","extremely", ! 755: "factually","faithfully", ! 756: "faultlessly","feasibly", ! 757: "finitely","firmly","forcefully", ! 758: "formally","formerly","frankly","freely", ! 759: "frugally","fully","generally", ! 760: "globally","gradually", ! 761: "harmlessly", ! 762: "helpfully", ! 763: "highly","homogeneously", ! 764: "hopefully", ! 765: "ideally","identically","ideologically", ! 766: "idiomatically","idiosyncratically","idly", ! 767: "imaginably","immaterially","immensely", ! 768: "impartially","imperceptably","imperfectly","importantly", ! 769: "improperly","imprudently","inaccurately","inappropriately", ! 770: "accurately", ! 771: "inclusively","incompletely","incorrectly", ! 772: "increasingly","independently", ! 773: "indirectly","ineffectively","ineffectually","inefficiently", ! 774: "infallibly","instantaneously","instantly", ! 775: "insufficiently","internally","likely","only", ! 776: "invaluably","inversely","irrelevantly","irrespectively", ! 777: "largely","lastly","legitimately","literally", ! 778: "locally","loosely","manageably","markedly", ! 779: "memorably","mildly","mindfully","moderately", ! 780: "momentarily","naturally","needfully","needlessly", ! 781: "nominally","normally","objectively","occasionally", ! 782: "temporarily", ! 783: "officially","oppositely","ordinarily","ostensibly", ! 784: "partially","permissibly", ! 785: "personally","pertinently", ! 786: "physically","plainly","plainly", ! 787: "pleasingly","politically", ! 788: "potentially","predictively", ! 789: "predominantly","prematurely","preparedly","presently", ! 790: "previously","primarily", ! 791: "primely","principally","problematically", ! 792: "productively","promptly","proportionately", ! 793: "provably","purely","quickly","radically","randomly","recently", ! 794: "repeatedly","secondarily","separately", ! 795: "usually","specifically", ! 796: "redundantly","regardlessly","reliably", ! 797: "remarkably","remotely","respectively", ! 798: "probably", ! 799: "robustly","seemingly", ! 800: "sensibly","singularly","steadily", ! 801: "strikingly","substantially","successfully", ! 802: "supposedly","systematically","understandably", ! 803: "necessarily","unfortunately", ! 804: "unnecessarily","unmistakably","usefully","weakly"}; ! 805: X adverbv=getxx(); ! 806: int i=0; ! 807: adverbv->type="-adverb"; ! 808: if(prob(0.150)) { ! 809: adverbv->list.s[i++]=prob(.5)?"simply":"easily"; ! 810: return adverbv; ! 811: } ! 812: if(prob(0.4))adverbv->list.s[i++]=CHOOSE(wordy); ! 813: if(prob(makeup))adverbv->list.s[i++]=CHOOSE(c); ! 814: else { ! 815: adverbv->list.s[i++]=prefix(env); ! 816: adverbv->list.s[i++]=root(env); ! 817: adverbv->list.s[i++]=CHOOSE(suff); ! 818: } ! 819: return adverbv; ! 820: } ! 821: ! 822: X adjective(env) E env; { ! 823: static char *suff[] = {"ive","ful","ous","some","oid","ine","esque","en","an", ! 824: "ile","able","ible","istic","ic", ! 825: "an","ian","ish","ite","al","less"}; ! 826: X adjv=getxx(); ! 827: int i=0; ! 828: adjv->type="-adjective"; ! 829: if(prob(0.2)) { ! 830: adjv->list.s[i++]="not "; ! 831: adjv->list.s[i++]="un"; ! 832: } ! 833: if(prob(makeup)) { ! 834: adjv->list.s[i++]=CHOOSE(adjlist); ! 835: return adjv; ! 836: } ! 837: adjv->list.s[i++]=prefix(env); ! 838: adjv->list.s[i++]=root(env); ! 839: adjv->list.s[i++]=CHOOSE(suff); ! 840: return adjv; ! 841: } ! 842: ! 843: X adjph(env) E env; { ! 844: X adjv=getxx(); ! 845: EE nenv; ! 846: static EE empty; ! 847: int i=0; ! 848: adjv->type="adjph"; ! 849: if(prob(0.25)) { ! 850: nenv= *env; ! 851: nenv.tense=0; ! 852: adjv->list.x[i++]=rel(&nenv); ! 853: adjv->list.x[i++]=aux(&nenv); ! 854: adjv->list.x[i++]=vp(&nenv); ! 855: return adjv; ! 856: } ! 857: nenv=empty; ! 858: adjv->list.x[i++]=prep(&nenv); ! 859: adjv->list.x[i++]=np(&nenv); ! 860: return adjv; ! 861: } ! 862: ! 863: X prep(env) E env; { ! 864: static char *prep[] = {"across","by","in","of","near","under","over", ! 865: "in back of","below","behind","of","of","of","of", ! 866: "centered around","centered about", ! 867: "in close proximity to","following after", ! 868: "in between","in conflict with","in conjunction with", ! 869: "in the area of","in the neighborhood of","in the proximity of", ! 870: "in the field of","for the purpose of", ! 871: "giving rise to","based upon","being caused by", ! 872: "of","of","of","of", ! 873: "being effectuated by","being aggrevated by", ! 874: "being used with", ! 875: "being collected together with","being combined together with", ! 876: "connected up to","exhibiting a tendency towards", ! 877: "being facilitated by", ! 878: "being employed with", ! 879: "having a deleterious effect upon","impacting", ! 880: "being joined together with","being merged together with", ! 881: "in the vicinity of"}; ! 882: X pv=getxx(); ! 883: pv->type="-prep"; ! 884: pv->list.s[0]=CHOOSE(prep); ! 885: return pv; ! 886: } ! 887: ! 888: X comp(env) E env; { ! 889: X v=getxx(); ! 890: EE nenv; ! 891: static EE empty; ! 892: int i=0; ! 893: nenv=empty; ! 894: v->type="comp"; ! 895: if(0&&prob(0.001))v->list.x[i++]=adjective(&nenv); ! 896: else if(prob(0.1))v->list.x[i++]=advp(&nenv); ! 897: else { ! 898: if(env->passive)v->list.x[i++]=passprep(env); ! 899: v->list.x[i++]=np(&nenv); ! 900: env->passive=0; ! 901: } ! 902: if(0&&prob(0.05))v->list.x[i++]=adverb(&nenv); ! 903: return v; ! 904: } ! 905: ! 906: X advp(env) E env; { ! 907: X v=getxx(); ! 908: v->type="advp"; ! 909: v->list.x[0]=vprep(env); ! 910: v->list.x[1]=np(env); ! 911: return v; ! 912: } ! 913: ! 914: X vprep(env) E env; { ! 915: static char *prep[] = {"to","at","by","from","with","for"}; ! 916: X v=getxx(); ! 917: v->type="-vprep"; ! 918: v->list.s[0]=CHOOSE(prep); ! 919: return v; ! 920: } ! 921: ! 922: E getenvq() { ! 923: static EE empty; ! 924: E v; ! 925: v=(E) malloc(sizeof*v); ! 926: if(v==0)printf("outa room\n"),exit(1); ! 927: *v=empty; ! 928: return v; ! 929: } ! 930: ! 931: X comma(env) E env; { ! 932: X v=getxx(); ! 933: static EE empty; ! 934: v->type="-comma"; ! 935: v->list.s[0]=","; ! 936: *env=empty; ! 937: return v; ! 938: } ! 939: ! 940: X conjadv(env) E env; { ! 941: static char *c[] = {"therefore","however","moreover","obviously"}; ! 942: X v=getxx(); ! 943: v->type="-conjadv"; ! 944: v->list.s[0]=CHOOSE(c); ! 945: return v; ! 946: } ! 947: ! 948: X lconjadv(env) E env; { ! 949: static char *c[] = {"therefore","however","nevertheless", ! 950: "consequently","also","in addition","moreover", ! 951: "accordingly","essentially","presumably","actually", ! 952: "basically","importantly","clearly","obviously", ! 953: "needless to say","as already stated", ! 954: "generally","approximately","presently", ! 955: "hopefully","usually","in the great majority of cases", ! 956: "seen in the above light","most significantly", ! 957: "when the need arises", ! 958: "in a large number of cases","after this is accomplished", ! 959: "in all cases", ! 960: "having been made aware concerning these matters", ! 961: "as an example of this","as a consequence of this", ! 962: "as a matter of fact","as is often the case", ! 963: "as of this date","assuming that this is the case", ! 964: "at the present moment in time","at this time", ! 965: "as a consequent result of this","as a desireable benefit of this", ! 966: "if at all possible","similarly","in the same connection", ! 967: "in large measure","in many cases","in rare cases", ! 968: "in some cases","in the interim","in the last analysis", ! 969: "in light of these facts","in the majority of instances", ! 970: "in the not too distant future","in the same way as described above", ! 971: "in this case","for all intents and purposes", ! 972: "to arrive at an approximation","for this reason", ! 973: "for many reasons, then", ! 974: "as is often the case","last but not least", ! 975: "later on","on a few occasions","on this occasion", ! 976: "in summary","taking this into consideration", ! 977: "with this in mind", ! 978: "substantially","ultimately"}; ! 979: X v=getxx(); ! 980: v->type="-lconjadv"; ! 981: v->list.s[0]=CHOOSE(c); ! 982: return v; ! 983: } ! 984: ! 985: X conjsub(env) E env; { ! 986: static char *c[] = {"although","even though","despite the fact that", ! 987: "for the simple reason that", ! 988: "because","due to the fact that","since", ! 989: "whether or not", ! 990: "inasmuch as", ! 991: "as"}; ! 992: X v=getxx(); ! 993: v->type="-conjsub"; ! 994: v->list.s[0]=CHOOSE(c); ! 995: return v; ! 996: } ! 997: ! 998: X lconjsub(env) E env; { ! 999: static char *c[] = {"although","even though","despite the fact that", ! 1000: "because","due to the fact that","since", ! 1001: "if","anytime that","in the case that", ! 1002: "as a consequence of the fact that", ! 1003: "as regards the fact that", ! 1004: "as a desireable benefit of the fact that", ! 1005: "with reference to the fact that", ! 1006: "as long as", ! 1007: "as an important essential of the fact that", ! 1008: "in conjunction with the fact that", ! 1009: "in the light of the fact that", ! 1010: "if","if","if","if", ! 1011: "leaving out of consideration the fact that", ! 1012: "just as", ! 1013: "inasmuch as","until such time as", ! 1014: "as soon as","being as","in the same way as", ! 1015: "with the exception of the fact that", ! 1016: "notwithstanding the fact that", ! 1017: "on the grounds that", ! 1018: "on the basis of the fact that", ! 1019: "persuant to the fact that", ! 1020: "although it seems apparent that", ! 1021: "with regard to the fact that", ! 1022: "as can be seen from the fact that", ! 1023: "as"}; ! 1024: X v=getxx(); ! 1025: v->type="-lconjsub"; ! 1026: v->list.s[0]=CHOOSE(c); ! 1027: return v; ! 1028: } ! 1029: ! 1030: X conj(env) E env; { ! 1031: static char *c[] = {"and","but","yet","and","and"}; ! 1032: X v=getxx(); ! 1033: v->type="-conj"; ! 1034: v->list.s[0]=CHOOSE(c); ! 1035: return v; ! 1036: } ! 1037: ! 1038: X nomz(env) E env; { ! 1039: static char *c[] = {"it is easy to see that","it is a basic fact that", ! 1040: "it is obvious that","it is not unimportant that", ! 1041: "it is easy to overlook the fact that", ! 1042: "it is within the realm of possibility that", ! 1043: "it is apparent that", ! 1044: "this is indicitive of the fact that", ! 1045: "this is in substantial agreement with the fact that", ! 1046: "this demonstrates the fact that", ! 1047: "this leaves out of consideration the fact that", ! 1048: "it is of the utmost importance that", ! 1049: "the truth is that", ! 1050: "the fact is that", ! 1051: "it turns out that","it will turn out to be true that", ! 1052: "it should be noted that", ! 1053: "it stands to reason that", ! 1054: "it would not be unreasonable to assume that", ! 1055: "it is interesting to note that"}; ! 1056: X v=getxx(); ! 1057: v->type="-nomz"; ! 1058: v->list.s[0]=CHOOSE(c); ! 1059: return v; ! 1060: } ! 1061: ! 1062: X turgid(env) E env; { ! 1063: X v=getxx(); ! 1064: int i=0; ! 1065: v->type="turgid"; ! 1066: if(prob(T*1.5)) { ! 1067: v->list.x[i++]=lconjadv(env); ! 1068: v->list.x[i++]=comma(env); ! 1069: v->list.x[i++]=sent(env); ! 1070: } ! 1071: else if(prob(2*T)) { ! 1072: v->list.x[i++]=turgid(env); ! 1073: v->list.x[i++]=comma(env); ! 1074: v->list.x[i++]=conj(env); ! 1075: v->list.x[i++]=sent(env); ! 1076: } ! 1077: else if(prob(1.5*T)) { ! 1078: v->list.x[i++]=lconjsub(env); ! 1079: v->list.x[i++]=sent(env); ! 1080: v->list.x[i++]=comma(env); ! 1081: v->list.x[i++]=sent(env); ! 1082: } ! 1083: else if(prob(T*.5)) { ! 1084: v->list.x[i++]=sent(env); ! 1085: v->list.x[i++]=comma(env); ! 1086: v->list.x[i++]=conjadv(env); ! 1087: } ! 1088: else if (prob(T)) { ! 1089: v->list.x[i++]=turgid(env); ! 1090: v->list.x[i++]=comma(env); ! 1091: v->list.x[i++]=conjsub(env); ! 1092: v->list.x[i++]=sent(env); ! 1093: } ! 1094: else if(prob(.5*T)) { ! 1095: v->list.x[i++]=nomz(env); ! 1096: v->list.x[i++]=sent(env); ! 1097: } ! 1098: else v->list.x[i++]=sent(env); ! 1099: return v; ! 1100: } ! 1101: ! 1102: /**********************************************************/ ! 1103: char buff[1000]; ! 1104: int io; ! 1105: int flag; ! 1106: main(ac,av) char *av[]; { ! 1107: static char *furniture[] = {"WASTEBASKET","ASHTRAY","TABLE", ! 1108: "DESK DRAWER","COAT LOCKER","BOOKSHELF"}; ! 1109: static char *ccto[] = { ! 1110: "J. J. Argosy", ! 1111: "M. D. Banal", ! 1112: "H. V. Bandersnatch", ! 1113: "F. W. Blivet", ! 1114: "Z. Brazen", ! 1115: "M. Bushido", ! 1116: "J. D. Carbuncle", ! 1117: "N. Crab", ! 1118: "R. H. deTruckle", ! 1119: "C. B. Dudgeon", ! 1120: "R. T. Dun", ! 1121: "W. G. Fallow", ! 1122: "R. S. Flummox", ! 1123: "R. N. Fribble", ! 1124: "C. R. Glitch", ! 1125: "S. A. Hobble", ! 1126: "R. S. Limn", ! 1127: "S. T. Livid", ! 1128: "Mrs. B. R. Mauve", ! 1129: "C. H. Russet", ! 1130: "M. H. Simper", ! 1131: "B. R. Sorrel", ! 1132: "G. Swale", ! 1133: "R. R. Swarthy", ! 1134: "P. Terra-Cotta", ! 1135: "U. G. Winnow"}; ! 1136: E env; ! 1137: X tree; ! 1138: int i=0; ! 1139: int j=0; ! 1140: int k=0; ! 1141: int lim=25; ! 1142: long t; ! 1143: time(&t); ! 1144: if(ac<2)abo(); ! 1145: if(ac>2) { ! 1146: for(makeup=0; *av[2]; av[2]++) { ! 1147: if(*av[2]<'0'||*av[2]>'9')abo(); ! 1148: makeup=makeup*10+*av[2]-'0'; ! 1149: } ! 1150: makeup/=100; ! 1151: if(makeup<0||makeup>1)abo(); ! 1152: makeup=1-makeup; ! 1153: } ! 1154: if(ac>1)for(lim=0; *av[1]; av[1]++) { ! 1155: if(*av[1]<'0'||*av[1]>'9')abo(); ! 1156: lim=lim*10+*av[1]-'0'; ! 1157: } ! 1158: srand((int)t); ! 1159: printf(".TL\n"); ! 1160: env=getenvq(); ! 1161: tree=np(env); ! 1162: io=0; ! 1163: pr(tree); ! 1164: buff[io]=0; ! 1165: caps(); ! 1166: printf("%s\n",buff); ! 1167: printf(".AU \"C. C. Festoon\"\n"); ! 1168: printf(".AS\n"); ! 1169: free(env); ! 1170: do { ! 1171: env=getenvq(); ! 1172: tree=turgid(env); ! 1173: io=0; ! 1174: pr(tree); ! 1175: buff[io]=0; ! 1176: printf("%s.\n",buff); ! 1177: free(env); ! 1178: } while(prob(0.75)); ! 1179: printf(".AE\n"); ! 1180: printf(".MT \"MEMORANDUM FOR %s\"\n", ! 1181: CHOOSE(furniture)); ! 1182: while(1) { ! 1183: if(i>=lim) { ! 1184: printf(".SG\n"); ! 1185: printf(".NS 0\n"); ! 1186: for(j=0; j==0;) { ! 1187: for(i=0; i<sizeof ccto/sizeof *ccto; i++) { ! 1188: if(prob(.10))j=1,printf("%s\n",ccto[i]); ! 1189: } ! 1190: } ! 1191: printf(".NE\n"); ! 1192: exit(0); ! 1193: } ! 1194: if(i++%23==0) { ! 1195: env=getenvq(); ! 1196: tree=np(env); ! 1197: io=0; ! 1198: printf(".H 1 \""); ! 1199: pr(tree); ! 1200: buff[io]=0; ! 1201: caps(); ! 1202: printf("%s\"\n",buff); ! 1203: free(env); ! 1204: } ! 1205: env=getenvq(); ! 1206: tree=turgid(env); ! 1207: io=0; ! 1208: pr(tree); ! 1209: buff[io]=0; ! 1210: if(++k%13==0&&prob(0.35)) { ! 1211: printf("%s:\n",buff); ! 1212: printf(".BL\n"); ! 1213: do { ! 1214: printf(".LI\n"); ! 1215: free(env); ! 1216: env=getenvq(); ! 1217: io=0; ! 1218: tree=sent(env); ! 1219: pr(tree); ! 1220: buff[io]=0; ! 1221: printf("%s.\n",buff); ! 1222: } while(prob(.83)); ! 1223: printf(".LE\n"); ! 1224: printf(".P\n"); ! 1225: } ! 1226: else printf("%s.\n",buff); ! 1227: if(++j>2&&prob(0.4))printf(".P\n"),j=0; ! 1228: free(env); ! 1229: } ! 1230: } ! 1231: ! 1232: pr(tree) X tree; { ! 1233: int i; ! 1234: if(flag=='p') { ! 1235: out("<"); ! 1236: out(tree->type); ! 1237: out(">"); ! 1238: } ! 1239: if(tree->type[0]=='-') { ! 1240: out(" "); ! 1241: for(i=0; tree->list.s[i]; i++) { ! 1242: out(tree->list.s[i]); ! 1243: } ! 1244: } ! 1245: else for(i=0; tree->list.x[i]; i++) { ! 1246: pr(tree->list.x[i]); ! 1247: } ! 1248: free(tree); ! 1249: return; ! 1250: } ! 1251: ! 1252: out(s)char *s; ! 1253: { ! 1254: if(io==0&&*s==' ')return; ! 1255: if(io==0) { ! 1256: for(;s[io]; io++)buff[io]=s[io]; ! 1257: buff[0]+='A'-'a'; ! 1258: return; ! 1259: } ! 1260: if(buff[io-1]==' '&&*s==' ')return; ! 1261: if(buff[io-1]==' '&&*s==',')io--; ! 1262: if(buff[io-1]=='y'&&*s=='i'&&s[1]=='e')io--; ! 1263: else if(*s==buff[io-1]&&*s!='s'&&*s!='n')io--; ! 1264: else if(*s=='e'&&buff[io-1]=='a')io--; ! 1265: for(; *s; )buff[io++]= *s++; ! 1266: return; ! 1267: } ! 1268: ! 1269: caps() ! 1270: {int i; for(i=1; i<io; i++) ! 1271: if(buff[i-1]==' '&&buff[i]<='z'&&buff[i]>='a')buff[i]+='A'-'a'; ! 1272: } ! 1273: abo(){printf("usage: festoon NUMBER-OF-SENTENCES [percent-invented-nouns]\n"); ! 1274: exit(1); ! 1275: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.