1/* 2% NomicMUD: A MUD server written in Prolog 3% Maintainer: Douglas Miles 4% Dec 13, 2035 5% 6 7 Talk_DB is a bit less organized most lexicons! 8 9 But every once in a while there's a treasure in it 10 (so worth using) 11 12 13 If I remember correctly, I got it from 14 15 https://github.com/crossbowerbt/prolog-talk 16 17 and then wrote/used one of my S-expression translators 18 19*/ 20 21:- module(talkdb, []). 22 23:- style_check(-(discontiguous)). 24 25decl_talk_db_data(F/A):- dynamic(F/A), multifile(F/A), export(F/A). 26 27:- decl_talk_db_data(talk_db/1). 28:- decl_talk_db_data(talk_db/2). 29:- decl_talk_db_data(talk_db/3). 30:- decl_talk_db_data(talk_db/4). 31:- decl_talk_db_data(talk_db/5). 32:- decl_talk_db_data(talk_db/6). 33:- decl_talk_db_data(talk_db/7). 34 35 /* 36 37 setof(F, talk_db([F|_]), O). 38 39 [prep, adj, adverb, noun2, pret, verb, interj, superl, conj, sing_only, fem, pronoun, pref, 40 p, ads, masc, noun, adb, b_t, noun_verb, m, apron, ncollect, pres_indic, comp, 41 et, aa, na, esp, personal, impersonal, possessive, inerj, indef, singular, auxiliary, 42 pl_pronoun, obssuperl, ppl, imperative, c, interrog, domain, verb_t, verb_i] 43 44 45 setof(F, talk_db([domain, _, D]), O). 46 47 48 bagof(P, (talk_db([F|X]), length(X, A), functor(P, F, A)), O), writeq(O). 49 50*/ 51 52talk_db([F, A|List]):- talk_db_argsIsa(F, N_Minus1, _), length(List, N_Minus1), apply(talk_db, [F, A|List]). 53 54talk_db_argsIsa(comp, 1, adjective(comparative)). 55talk_db_argsIsa(superl, 1, adjective(superlative)). 56talk_db_argsIsa(noun1, 1, singular(plural)). 57talk_db_argsIsa(intransitive, 4, base(pluralverb, imperfect, ingform, past_part)). 58talk_db_argsIsa(transitive, 4, base(pluralverb, imperfect, ingform, past_part)). 59talk_db_argsIsa(adj, 0, (adjective)). 60talk_db_argsIsa(auxiliary, 0, (verb)). % will shall wont 61talk_db_argsIsa(conj, 0, (conjuntion)). 62talk_db_argsIsa(fem, 0, (feminine)). 63talk_db_argsIsa(fem, 0, (noun)). 64talk_db_argsIsa(impersonal, 0, (meseems)). 65talk_db_argsIsa(indef, 0, (indefinate)). 66talk_db_argsIsa(indef, 0, (pronoun)). 67talk_db_argsIsa(interj, 0, (interjection)). 68talk_db_argsIsa(interrog, 0, (whpron)). % only instance 69talk_db_argsIsa(agentive, 0, (noun)). 70talk_db_argsIsa(masc, 0, (masculine)). 71talk_db_argsIsa(masc, 0, (noun)). 72talk_db_argsIsa(ncollect, 0, (massnoun)). 73talk_db_argsIsa(noun2, 0, (noun)). 74talk_db_argsIsa(noun2, 0, (plural)). 75talk_db_argsIsa(noun2, 0, (singular)). 76talk_db_argsIsa(noun_verb, 0, (verb)). 77talk_db_argsIsa(noun_verb, 0, (noun)). 78talk_db_argsIsa(p, 0, (adjective)). 79talk_db_argsIsa(personal, 0, (firstperson)). 80talk_db_argsIsa(pl_pronoun, 0, (plural)). 81talk_db_argsIsa(pl_pronoun, 0, (pronoun)). 82talk_db_argsIsa(possessive, 0, (pronoun)). 83talk_db_argsIsa(preposition, 0, (preposition)). 84talk_db_argsIsa(pres_indic, 0, (verb)). 85talk_db_argsIsa(sing_only, 0, (noun)). 86talk_db_argsIsa(sing_only, 0, (singular)). 87talk_db_argsIsa(verb, 0, (adj_verb)). % verb/nouns maybe 88talk_db_argsIsa(pronoun, 0, (pronoun)). 89talk_db_argsIsa(adverb, 0, (adverb)). 90 91 92talk_db_pos_trans(massnoun, noun). 93talk_db_pos_trans(superlative, adjective). 94talk_db_pos_trans(comparative, adjective). 95talk_db_pos_trans(superl, adj). 96talk_db_pos_trans(comp, adj). 97talk_db_pos_trans(intransitive, verb). 98talk_db_pos_trans(transitive, verb). 99talk_db_pos_trans(imperfect, verb). 100talk_db_pos_trans(imperfect, past). 101talk_db_pos_trans(past_part, verb). 102talk_db_pos_trans(past_part, past). 103talk_db_pos_trans(past_part, particple). 104talk_db_pos_trans(past_part, adjectival). 105talk_db_pos_trans(pluralverb, verb). 106talk_db_pos_trans(pluralverb, plural). 107talk_db_pos_trans(pluralverb, noun). 108talk_db_pos_trans(pluralverb, active). 109talk_db_pos_trans(ingform, verb). 110talk_db_pos_trans(ingform, active). 111talk_db_pos_trans(ingform, pres). 112talk_db_pos_trans(ingform, particple). 113talk_db_pos_trans(ingform, adjectival). 114talk_db_pos_trans(A, A). 115 116:- decl_talk_db_data(talk_db_pos/2). 117talk_db_pos(POS, String):- nonvar(POS), nonvar(String), !, talk_db_t_0(POS, String), !. 118talk_db_pos(POS, String):- talk_db_t_0(POS, String). 119 120talk_db_t_0(POS, String):- talk_db_argsIsa(F, N, POSVV), talk_db_pos(String, POSVV, PPOS, F, N), talk_db_pos_trans(PPOS, POS). 121 122talk_db_pos(String, POSVV, POS, F, 0):- !, talk_db(F, String), (F=POSVV -> POS=F ; (POS=POSVV;POS=F)). 123talk_db_pos(String, POSVV, POS, F, N):- nonvar(String), !, length(List, N), Search=[_|List], C=..[talk_db, F|Search], nth0(AT, Search, String, _), , getPos(AT, F, POSVV, POS). 124talk_db_pos(String, POSVV, POS, F, N):- length(List, N), Search=[_|List], C=..[talk_db, F|Search], , nth0(AT, Search, String, _), getPos(AT, F, POSVV, POS). 125 126getPos(_, FPOS, _, FPOS). 127getPos(0, _, POSVV, POS):- !, functor(POSVV, POS, _);POS=base. 128getPos(AT, _, POSVV, POS):- arg(AT, POSVV, POS), !. 129 130 131talk_db(noun1, Sing, Sing):- talk_db(noun2, Sing). 132 133 134%:- style_check(-discontiguous). 135%:- include(library('nldata/talk_db.pl.dat')). 136:- absolute_file_name('talk_db.nldata', File, [access(read)]), 137 open(File, read, In), 138 set_stream(In, encoding(iso_latin_1)), 139 repeat, 140 read(In, P), 141 asserta(P), 142 P==end_of_file, !. 143 144% ================================= 145% some random talk_db/2-7s from the other file (to help see the meanings) 146% ================================= 147/* 148 149talk_db(adj, aaronic). 150talk_db(adj, aaronical). 151talk_db(adj, abactinal). 152talk_db(adj, abandoned). 153talk_db(adj, abased). 154talk_db(adj, abatable). 155talk_db(adj, abominable). 156talk_db(adj, absent). 157talk_db(adj, usurpatory). 158talk_db(adj, uterine). 159talk_db(adv, yesterday). 160talk_db(adv, yesternight). 161talk_db(adv, yet). 162talk_db(adv, youngly). 163talk_db(adv, ysame). 164talk_db(adv, yvel). 165talk_db(adv, ywis). 166talk_db(agentive, doer). 167talk_db(auxilary, wont). 168talk_db(auxiliary, shall). 169talk_db(auxiliary, will). 170talk_db(b_t, crimson). 171talk_db(b_t, crossbite). 172talk_db(b_t, lumber). 173talk_db(b_t, pulley). 174talk_db(comp, angry, angrier). 175talk_db(comp, wordy, wordier). 176talk_db(comp, wormy, wormier). 177talk_db(comp, worthy, worthier). 178talk_db(comp, wry, wrier). 179talk_db(comp, yellow, yellower). 180talk_db(comp, young, younger). 181talk_db(conj, albe). 182talk_db(conj, albee). 183talk_db(conj, albeit). 184talk_db(conj, all). 185talk_db(conj, also). 186talk_db(conj, altho). 187talk_db(conj, although). 188talk_db(conj, an). 189talk_db(conj, and). 190talk_db(conj, so). 191talk_db(conj, syne). 192talk_db(conj, than). 193talk_db(conj, then). 194talk_db(conj, therefore). 195talk_db(conj, tho). 196talk_db(conj, til). 197talk_db(conj, till). 198talk_db(conj, unless). 199talk_db(conj, until). 200talk_db(domain, abalone, zoology). 201talk_db(domain, abandonee, law). 202talk_db(domain, abator, law). 203talk_db(domain, abelian, "eccl., hist"). 204talk_db(domain, abelite, "eccl., hist"). 205talk_db(domain, abelonian, "eccl., hist"). 206talk_db(domain, abietite, chem). 207talk_db(domain, abirritation, med). 208talk_db(domain, ablegate, "r., c., ch"). 209talk_db(domain, aboma, zoology). 210talk_db(domain, absinthate, chem). 211talk_db(domain, absinthin, chem). 212talk_db(domain, absolute, geom). 213talk_db(fem, alumna). 214talk_db(fem, buffa). 215talk_db(fem, chiffonier). 216talk_db(fem, gitana). 217talk_db(fem, her). 218talk_db(fem, lanner). 219talk_db(fem, marseillaise). 220talk_db(fem, masseuse). 221talk_db(fem, poseuse). 222talk_db(fem, religieuse). 223talk_db(fem, she). 224talk_db(impersonal, meseems). 225talk_db(impersonal, methinks). 226talk_db(impersonal, tacet). 227talk_db(indef, one). 228talk_db(indef, whatso). 229talk_db(interj, adieu). 230talk_db(interj, so). 231talk_db(interj, soft). 232talk_db(interj, soho). 233talk_db(interj, tallyho). 234talk_db(interj, tush). 235talk_db(interj, walaway). 236talk_db(interj, waly). 237talk_db(interj, wayleway). 238talk_db(interj, welaway). 239talk_db(interj, welladay). 240talk_db(interj, weyleway). 241talk_db(interj, whist). 242talk_db(interj, whoa). 243talk_db(interj, yoicks). 244talk_db(interj, zounds). 245talk_db(interrog, what). 246talk_db(intransitive, abort, aborts, aborted, aborting, aborted). 247talk_db(intransitive, abound, abounds, abounded, abounding, abounded). 248talk_db(intransitive, abstain, abstains, abstained, abstaining, abstained). 249talk_db(intransitive, zighyr, zighyrs, zighyred, zighyring, zighyred). 250talk_db(intransitive, zigzag, zigzags, zigzaged, zigzaging, zigzaged). 251talk_db(intransitive, zip, zips, ziped, ziping, ziped). 252talk_db(m, kit). 253talk_db(m, sacerdotalism). 254talk_db(masc, buffo). 255talk_db(masc, he). 256talk_db(masc, his). 257talk_db(masc, lanneret). 258talk_db(masc, marseillais). 259talk_db(masc, masseur). 260talk_db(masc, poseur). 261talk_db(masc, religieux). 262talk_db(masc, solus). 263talk_db(ncollect, folk). 264talk_db(ncollect, folks). 265talk_db(noun1, aam, aams). 266talk_db(noun1, ab, abs). 267talk_db(noun1, abandon, abandons). % note verbs are snuck into here (and need to be filtered) 268talk_db(noun1, ability, abilities). 269talk_db(noun1, abolishment, abolishments). 270talk_db(noun2, abdominales). 271talk_db(noun2, abdominalia). 272talk_db(noun2, aborigines). 273talk_db(noun2, abranchiata). 274talk_db(noun2, fish). 275talk_db(noun2, zygobranchia). 276talk_db(noun2, zygodactyli). 277talk_db(noun_verb, deprave). 278talk_db(noun_verb, harlequin). 279talk_db(noun_verb, hobble). 280talk_db(noun_verb, hold). 281talk_db(noun_verb, kemb). 282talk_db(noun_verb, ken). 283talk_db(noun_verb, loan). 284talk_db(noun_verb, trip). 285talk_db(p, bounden). 286talk_db(p, collied). 287talk_db(p, dustman). 288talk_db(p, laden). 289talk_db(personal, me). 290talk_db(pl_pronoun, they). 291talk_db(pl_pronoun, tho). 292talk_db(preposition, a). % note articles are snuck into here (and need to be filtered 293talk_db(preposition, about). 294talk_db(preposition, above). 295talk_db(preposition, with). 296talk_db(preposition, withal). 297talk_db(preposition, within). 298talk_db(preposition, without). 299talk_db(preposition, withouten). 300talk_db(preposition, yer). 301talk_db(preposition, ymel). 302talk_db(pres_indic, forewot). 303talk_db(pronoun, another). 304talk_db(pronoun, any). 305talk_db(pronoun, echon). 306talk_db(pronoun, echoon). 307talk_db(pronoun, either). 308talk_db(pronoun, yours). 309talk_db(pronoun, yourself). 310talk_db(pronoun, yow). 311talk_db(sing_only, alms). 312talk_db(sing_only, amends). 313talk_db(sing_only, bellows). 314talk_db(sing_only, vermin). 315talk_db(sing_only, vers). 316talk_db(superl, aftermost). 317talk_db(superl, angry, angriest). 318talk_db(superl, bad, worst). 319talk_db(superl, blue, bluest). 320talk_db(superl, brave, bravest). 321talk_db(transitive, abandon, abandons, abandoned, abandoning, abandoned). 322talk_db(transitive, abduce, abduces, abduced, abducing, abduced). 323talk_db(transitive, able, ables, abled, abling, abled). 324talk_db(transitive, abolish, abolishes, abolished, abolishing, abolished). 325talk_db(transitive, abscond, absconds, absconded, absconding, absconded). 326talk_db(transitive, absent, absents, absented, absenting, absented). 327talk_db(transitive, absinthiate, absinthiates, absinthiated, absinthiating, absinthiated). 328talk_db(transitive, absorb, absorbs, absorbed, absorbing, absorbed). 329talk_db(transitive, twit, twits, twitted, twitting, twitted). 330talk_db(transitive, twitter, twitters, twittered, twittering, twittered). 331talk_db(verb, abray). 332 333*/