diff options
-rwxr-xr-x | conlex.lua | 67 | ||||
-rw-r--r-- | vötgil.tsv | 620 |
2 files changed, 678 insertions, 9 deletions
@@ -1,4 +1,6 @@ #!/usr/bin/env lua5.3 +local lpeg = require'lpeg' + local function template(str, args) return (str:gsub("%%(%w+)%%", args)) end @@ -74,24 +76,65 @@ function glossors.sanila(text) table.insert(items, format_def(word, entry)) end - return items + return table.concat(items, "\n") +end + +glossors["vötgil"] = function(text) + local words = load_dict "vötgil.tsv" + local function norm(s) + return s:lower():gsub("Ð","ð"):gsub("Ö","ö"):gsub("0","ö"):gsub("9","ð") + end + + local letter = lpeg.R("az","AZ") + lpeg.S"09" + "ö" + "Ö" + 'ð' + 'Ð' + local word = (letter*letter*letter) / function (w) + return format_def(w, words[norm(w)]) + end * lpeg.Cp() + + local i = 1 + local out = "" + while i < #text do + local item, ni = lpeg.match(word, text, i) + if item then + out = out .. item + i = ni + else + out = out .. text:sub(i,i) + i = i + 1 + end + end + return out end local function engloss(langue, text) - local items = glossors[langue](text) + local text = glossors[langue](text) return template([[ <section>%text%</section> - <section id=place></section>]], {text=table.concat(items, "\n")}) + <section id=place></section> + <section><a href="%path%">< return</a></section> + ]], {text=text,path=os.getenv"SCRIPT_NAME"}) end local function enform() - return [[ + local options = {} + for k in pairs(glossors) do + table.insert(options, template('<option value="%x%" >%x%</option>', {x=k})) + end + table.sort(options) + return template([[ <section> <form> <textarea name=q></textarea> - <button>perform <i>conlation</i></button> + <label for=langue>select con-langue:</label> + <select name=langue id=langue> + %options% + </select> + <br><button>perform <i>conglossatio</i></button> </form> -</section>]] +</section> +]], { + options=table.concat(options, "\n"), + + }) end local function response(content) @@ -101,14 +144,20 @@ local function response(content) end local function main() - local text = nil + local langue, text local qs = os.getenv"QUERY_STRING" - if qs then text = parse_qs(qs).q end + if qs then + local pqs = parse_qs(qs) + langue = pqs.langue + text = pqs.q + end if not text then response(enform()) + elseif not glossors[langue] then + response("unknown langue "..langue) else - response(engloss('sanila', text)) + response(engloss(langue, text)) end end diff --git a/vötgil.tsv b/vötgil.tsv new file mode 100644 index 0000000..ab4b5c5 --- /dev/null +++ b/vötgil.tsv @@ -0,0 +1,620 @@ +bag noun bag; purse +bak preposition back to; toward the source or original location +baw preposition about; concerning +bax noun bath; basin; tub; sink +bed noun bed +beg verb to begin (something); start; initiate +bek noun bacteria +ben verb to bend (something); fold +ber descriptor barely; hardly at all +bey descriptor basic; simple; plain +bil noun building; a structure with a roof and walls +biz descriptor busy/busily; preoccupied +ble descriptor blank; bare; bald +blw descriptor blue +bly noun blood +blö verb to blast (something); cause to explode; detonate; pop; burst +bok noun block; rectangular prism; a solid geometric object +bon noun bone +bor noun border; outline; frame +brc verb to brush (hair); comb +brd noun bird +bre noun bread; roll +brk verb to break (something); snap; shatter; tear; rip +brt descriptor bright/brightly; light; shining +brv descriptor brave; bold/boldly; courageous; confident +brð verb to breathe (something) +bud noun butter +bum noun bump; lump; pile; mound +bun noun button; key; an input device which is pressed +but preposition but; however; in contrast +buy preposition by; happening by means of; with +buz noun buzz; hum; hiss +bwk noun book +bwn preposition between; among; within +byd descriptor beautiful/beautifully; pretty +byf preposition before +byk preposition because +bym verb to become (something) +byn noun bean; legume +byp noun beep; blip; chirp; squeak +bys verb to bounce (something); cause to bounce; reflect; deflect +byt verb to bite (something) +böd noun body +böj noun object; item +böl noun ball; sphere +cak verb to act (like something); perform (as something); behave as; pose as +cas verb to ask (a question) +caw verb to shower (a substance); spray +ceg noun egg +cek verb to shake (something) +cen descriptor any; no particular instance of +cep noun shape; form; design; layout; structure +cif preposition if; happening under the condition that +cik noun chicken +cin preposition in; inside of; within +cit noun shit +con noun ocean; sea +cot verb to show; point; draw attention to; demonstrate; indicate; reveal +coy verb to enjoy (something); like; prefer +crn verb to earn (something); deserve; merit +crt noun shirt +cup descriptor up +cwd descriptor should; appropriate; proper/properly; supposed to +cwg noun sugar +cwp noun shoe +cwr descriptor sure; certain/certainly +cwt verb to shoot (ammunition); fire +cyp noun sheep; lamb +cöl descriptor all; every +cön preposition on (something); on top of; supported by +cöp noun shop; store +dam verb to damn +dan verb to understand; comprehend +dav verb to advertise (something) +def verb to defend (something/someone); protect; guard; keep safe; preserve; conserve +dej noun danger; peril +dem verb to demand (something); request; order; command +der noun direction; way; path +des verb to describe (something); explain; report +det verb to identify (something); recognize; be familiar with +dey noun day; either 24 hours or the period of sunlight +dic noun dish; plate +did suffix makes a verb into a passive descriptor +dif descriptor different; differing; contrasting +dig verb to dig (in something) +dim noun atom +dip verb to depend (on something); be controlled or determined by; rely +div verb to divide (something); split; distribute +diz noun disease; illness; sickness; germ +dof noun dough +dor noun door; gate +drt noun dirt; soil; ground +dun descriptor done; finished; complete/completely +dus noun dust; powder +duz descriptor does; makes the sentence a question (optional; removes ambiguity) +dwn verb to do (something); perform (an action); be involved with; participate in +dög noun dog +dök noun document; essay; article +döl noun dollar +döm descriptor automatic/automatically; with no external intervention +fac descriptor fancy; formal +fam noun family +fas descriptor fast; quick/quickly +fen noun friend +fer descriptor fair/fairly; just; right +fes noun face (of a person or animal) +fet verb to fight (someone); attack +feð noun feather +fic noun fish +fid verb to find; come to know where something is; discover +fig noun flag +fim noun woman; female +fiq noun finger; toe +fis descriptor first; initial +fiv descriptor five +flo noun floor +fly noun flower +flö descriptor flat; even; smooth +fod descriptor forward +fok verb to focus (on something); pay attention to; concentrate on +fom noun foam; sponge; cake +fon noun phone; telephone +for preposition for; intended for; for the purpose of; so that; to +fot noun foot; a unit of length +fre descriptor in a fraction; over; -th/-nd; precedes a number +frn noun furniture +fro noun friction +frt preposition in front of +frw noun fruit +fry descriptor free/freely +fuk verb to fuck +ful descriptor full; with no space remaining +fun descriptor funny; humorous +fwc noun meat; flesh; muscle +fwd noun food +fwl noun fuel +fwr descriptor four +fwt noun foot; a part of the body +fyc descriptor flashing; blinking; sparkling; glimmering +fyl verb to feel (an object or emotion); sense +fyr noun fire +fön descriptor often; frequent/frequently; occupational/occupationally; as a job; routinely; as the primary purpose; as a tool for +fös noun office +gal noun gallon +gat descriptor exact; precise; specific; particular +gem noun game; competition; sport +ger descriptor angry/angrily; mad +get verb to get (something); receive +gil noun english; the language +gis noun glasses; used to aid vision +gle noun glass; a transparent material +gof verb to go (on a surface); travel; move one's self +gon noun organ (of the body) +gos noun ghost; spirit +gre descriptor gray/grey +grp noun group; category +gry verb to agree (with something or someone) +grö noun grass +gul descriptor guilty; shameful; sorry +guv noun government; a system of law +gwd descriptor good/well +gyn descriptor green +gyt verb to greet (someone); welcome +gör noun garbage; waste; trash +han noun hand; a part of the body +hap descriptor happy/happily; glad +hat noun hat +hav verb to have; own; possess +hed noun head; a part of the body +hen descriptor happening; occurring +hep verb to help (to do something); assist in +her noun hair; fur; wool +hev descriptor heavy/heavily +hey noun hello +hit verb to hit (something); beat; strike; crash into +hol noun hole; pit +hom noun home +hos noun house +hot descriptor horizontal; perpendicular to gravity +hrt verb to hurt (something); damage; harm; injure +hwd verb to hold (something); grab; physically support +hwk noun hook +hyr verb to hear +höl descriptor hollow; with an empty cavity +jak descriptor actual; real; existing +jed noun edge +jek preposition except; not including +jem noun gem; crystal; jewel +jer noun air +jor preposition or; either one +jum verb to jump (over something) +jus verb to adjust (something) +jwr preposition during (something); not necessarily from the start to end of +jws noun juice +jöb noun job; occupation +jöp verb to drop (something); make fall +jör verb to draw (an image) +kan verb can; capable of; able to do (something) +kap noun capsule; pellet; pill; pod +kas verb to carry (something); bring +kat noun cat +kaw noun cow; cattle +keb noun wire; cable +kef descriptor careful/carefully; alert; prudent; cautious; gentle/gently +kel verb to collect (something); gather +ken descriptor common/commonly; normal; usual; ordinary; regular; typical +kep noun concept; idea; thought; topic; subject +ker verb to care about (something); have concern for; worry about; respect +kes noun extent; degree; amount; quantity; used for uncountable items or actions +ket verb to connect (something); join; attach +kev descriptor clever; smart; intelligent +key descriptor okay; decent/decently; acceptable +kin verb to continue (something); keep doing +kip noun clip; clamp; used for attaching things +kit noun kind; type; sort +klo noun clothes; for wearing +klr descriptor clear/clearly; transparent +kly descriptor clean +klö noun cloud; smoke +kod noun code +kol verb to be equal to; be the same as; be identical to +kon verb to count (something); find the quantity of +kor descriptor correct/correctly; right +kot noun coat; jacket; clothes for cold weather +koy verb to contain; include; encompass +krn noun corn +kro descriptor crazy/crazily; mad; wild +krt descriptor creative/creatively; innovative +krv descriptor curved; round +kry verb to cry (speech); weep +krö preposition across +kuc verb to control (something); drive; manipulate; rule +kuf descriptor comfortable +kul noun color +kup noun cup; bucket; bowl +kut verb to cut (something); chop; shear; slice +kuv verb to cover (something); wrap +kwd descriptor could; the verb could happen; possible/possibly; may; might; perhaps; maybe +kwp noun company; business +kwt verb to compute (a result); calculate +kyt descriptor cute; adorable +köd noun quality; trait +köf noun coffee +köm descriptor calm/calmly +köp verb to copy (something); make one more; duplicate; multiply +kör noun car +köx noun cloth; fabric +köz verb to cause (something); make happen; be the reason for; so; therefore +lad descriptor loud/loudly; noisy +laf verb to laugh (at something) +lan noun land; parcel; lot; country +lat noun outlet (for electricity or another resource); spout; dispenser; faucet +leb noun label; tag +lef descriptor left; leftward; toward the left +lek noun electricity +leq noun language +ler noun lever +let verb to let (something occur); allow; permit +lev noun level (of a game, building, etc); layer; shelf +lic noun liquid +lim noun limb; appendage; neck; arm; leg; branch +lis noun list +lit noun limit; constraint; the maximum permissible amount +liv descriptor alive; living; lively +lok noun lake; pond +lrn verb to learn; study; research +lum noun lumber; wood +luv verb to love; adore +lwf preposition to the left of; on the left side of +lwp noun loop; a shape which has no end +lyf noun leaf +lyk preposition like; similar to; related to +lyn noun line +lyr descriptor early +lyt noun light; either light itself or a light producing source +lög noun logic; reason; sense +lök verb to lock (something) +löm descriptor almost; nearly +löq descriptor long; with a great length; tall +lör descriptor large; big; great +lös descriptor also; too; in addition +löt descriptor a lot of; many +löv noun law; rule; regulation +mad noun matter +mag noun magnet +man noun man; male +map noun map +max noun math; mathematics +med noun medicine +mej verb to measure (something) +mek verb to make (something); create; produce; cause to exist; build; construct +mel noun mail; letter (to be sent as mail) +mem noun member; an individual in a group +mer verb to marry (someone); become a spouse of +met noun material; substance +mid noun middle; centre +mil noun milk +min noun minute +mis noun mistake; accident +mit noun mint +mod noun metal +mok noun machine; device +mon descriptor main; chief; principal; primary +mor descriptor more; -er; to a greater extent; "long" becomes "longer" +mos descriptor -est; to the greatest extent; most; "long" becomes "longest" +mot descriptor most; the majority; almost all +muc noun mushroom; fungus +mul noun mile +mun noun money; currency +mwl noun mammal +mwn noun moon +mwv verb to move (something); cause to go; cause to travel +mwz noun music +myn verb to mean (something); signify; represent; imply +myt verb to meet (someone) +myw verb to amuse (someone); entertain; be fun to +mök verb to mark (something) +möl noun mollusk; soft-bellied creature; snail; octopus; squid +möt noun market; economy +nam noun animal; creature +nap noun napkin; tissue +nec noun nature; phenomena not made by man +ned preposition instead of; in the place of +nem noun name; title +ner noun energy +nes descriptor next; following +net noun net; mesh +nev noun environment; setting; surroundings; context; circumstance +nic verb to interest (someone); be interesting to; fascinate +nif noun information; data; signal +nin descriptor nine +niq suffix makes a verb into a gerund +nis suffix makes a descriptor or preposition into a noun which represents the quality or state of the word +nol descriptor only; alone; by himself/herself/itself/yourself/myself/themselves/ourselves; just; without anything else; without the assistance or company of other people; with no other action; with no other quality; in no other place +non verb to know; remember +nor descriptor north +nos verb to notice; become aware of +not noun note; a reminder for someone +noy verb to annoy (someone); be annoying to; irritate +nuf descriptor enough; sufficient/sufficiently +num noun number; quantity; amount; used for countable items +nut noun nut +nuy noun I/me; the speaker +nuz noun noise; sound +nwb descriptor new/newly; young +nwz noun news; tabloid +nyd verb to need; require; must +nyr preposition near; close to; around; along; with a short distance +nys descriptor nice; kind +nöb noun knob; handle; for holding or for opening a door +nöt descriptor not; makes a word false; no (in response to a question) +pad noun pattern +pak noun plastic +pan noun pants +pat noun planet +pax noun path; pathway; passage; passageway +ped noun party +pek noun picture; image +pel noun pencil +pen noun pen; for writing +pep noun paper +per noun parent; mother; father +pig noun pig +pik verb to pick (an option); choose; decide; select; vote for +pil noun pillow; cushion +pin noun pain; ache +ple verb to play (a game or instrument) +plo noun plant +plw noun place; position; region; area; location; point +ply descriptor please; makes a verb imperative +plö verb to plan; scheme +pod descriptor proud/proudly +pog noun program (on a computer); application +pol noun police; security +pon verb to open (something) +por verb to pour (a substance); spill +pos noun price; cost +pot noun point; grade; a unit of score +poy descriptor polite/politely; civilized +poz noun prize; reward; award; bonus +pre verb to predict (something); expect; infer; assume; estimate; judge; guess +prl descriptor purple; violet +pro descriptor professional; experienced; expert; skilled +prp noun purpose; the reason for which something exists +prs noun person +prt verb to buy; purchase +prw noun problem; conflict; issue; drama; trouble; puzzle; challenge; flaw +pry verb to practice (a skill); exercise +prö descriptor probable/probably; likely +pub descriptor public/publicly +put noun potato +pwc verb to push; apply a force; press +pwn noun pound +pwr descriptor pure/purely +pwt verb to put; place; add +pyt noun pizza +pök noun project +pöl preposition parallel to; along +pön noun horse; pony +pöp descriptor popular; cool; famous +pör noun part; piece; component +pös noun pasta +rad noun order; permutation; organization +rek noun rectangle +rel noun rail; track; for holding or for trains +ren noun rain +rep verb to respond (with an action); reply; react +req descriptor ranked; having a place in an order; -st/-nd/-rd/-th; a number will follow; used for ordinal numerals +rer suffix makes a verb into a noun that routinely performs the action; makes a descriptor into a noun which routinely is characterized by the trait +res verb to rest (on something); lie; take a break; relax +ret verb to relate (to something) +rey suffix makes a verb into a noun which routinely receives the action +rid verb to ride (a vehicle or animal) +rin noun ornament; decoration +rit verb to write (text) +riv noun river; stream +rob noun rubber +rod noun road; street +rog verb to organize (something); sort; make neat +ron noun range; span; length; interval +rov preposition over; above; high +rox noun earth; the planet +rub verb to rub (a surface); drag on +rug noun rug; carpet; mat +run verb to run (on something) +rus noun rice +rut noun reptile +rwm noun room; chamber +rwv verb to approve; confirm; praise; support +ryc verb to reach (for something) +ryd verb to read (text) +ryn noun rodent +rys noun resource; nutrient; supply +röd descriptor ready; prepared +rök noun rock; stone +röt noun art +röx noun arthropod; animal with exoskeleton; insect; crustacean; bug +sac noun sandwich +sal noun salad +san noun sand +sat noun status; state; mode +saw descriptor sour +seb verb to celebrate (something) +sed verb to send (something); submit +sef noun self; himself; herself; itself; ourselves; themselves; yourself; yourselves; causes the verb to be reflective; refers to the subject of the containing clause +sek noun ceramic; porcelain +sel noun cell; part of an organism +sen noun sentence +set noun system +sev descriptor seven +sey verb to say (something); speak; talk; tell +sib noun sibling; brother; sister +sic noun string; thread; lace; rope +sik descriptor six +sil descriptor cylinder +sim noun symbol; letter; digit; character +sis suffix makes a noun plural +sit verb to sit (on a surface) +ske verb to scare; frighten +sko noun screen; monitor; display +skr verb to scratch; scrape +skw noun school +sky noun sky +sle verb to slide (on something); glide; slip +slw noun slope; incline; ramp +sly verb to sleep (on something) +sme noun smell; odor; scent +sod noun soda +sop noun soap +soq descriptor strong; fit; powerful +sot noun science +spe descriptor special; original; unique +spr verb to spread (something); cause to spread +spw noun space; void; gap; vacuum; the absence of anything +spy descriptor spicy +srf (N); surface; skin +srk noun circle +srt descriptor straight; extending or moving in one direction only; direct +ste verb to stay (in a group); remain; continue to be; be in the rest +sto noun story; tale; rumor +str noun star; sun +stw verb to stick to (something); adhere to +sty descriptor still; still true; not moving +stö noun start; beginning; the start of an object or span +sud noun side; face (of an object) +sug verb suggest (to do something); advise; direct; instruct; guide; lead +sum descriptor some; a; an; a particular instance of (previously unmentioned) +sup verb to suppose (that something is true); have an opinion; think that; believe +suy noun sign +swo noun switch; for making and breaking a circuit +swp noun soup +swy descriptor sweet +syc verb to see (something) +syd noun seed +sym verb to seem like (something); appear to be; look like +söf descriptor soft +sök noun sock +söl noun solid; a state of matter +sön verb to stand (on a surface) +sör noun stair; step +sös noun sauce +söt noun salt +söv verb to solve (something); repair; fix +tak verb to trick (someone); deceive; fool +tan noun town; village; city +tas noun task; job +tce verb to change (something); make different; modify +tco noun chair; couch +tcr verb to try (something); attempt; make an effort +tcw descriptor true/truly; in fact; did; indeed; yes (in response to a question) +tcy noun cheese +tcö noun chocolate +teb noun table +tec noun texture; how something feels +tem noun time; period; moment; either a specific point or a span +tep verb to taper (to a point); gradually become narrow until converging; be sharp toward +tes verb to test; experiment (with something) +tey verb to take (something); actively remove +tid suffix makes a verb into a passive descriptor +til preposition until +tis noun taste; flavor +tok verb to check; inspect; see the status of something +tor noun tree +tos verb to chase (someone/something); pursue +tot descriptor total/totally; entire/entirely; whole; full/fully; complete/completely +toy noun toy +trg descriptor together; with each other +trn verb to turn (something); rotate; change the orientation of +trp verb to capture; trap +tuc verb to touch; make contact with +tum noun tomato +tuy verb to tie (a string) +twc descriptor too; excessive/excessively; to too much of an extent +twl noun tool +twn descriptor two +twr preposition to; towards; in the direction of +tws verb to trust; rely on; depend on +tyc verb to teach (something); educate +tym noun team +vak noun axle; used in a hinge +val noun value; worth +van preposition and +vat preposition at +vaz descriptor as; to a certain extent; so +vej noun vegetable +vek verb to excite (someone); make eager +vel descriptor available; accessible +veq noun angle; degree measure; corner; joint; hinge +ver descriptor very; to a great extent; quite +vet descriptor vertical; parallel to gravity +vid noun video; movie +vim descriptor important; serious; matter; relevant +vis descriptor viscous; thick; gooey +vit verb to visit; be a guest at; tour +viz verb to be (an instance/kind of) +vok noun vehicle +vot descriptor eight +vun preposition of; originating from; possessed by; related to +vwd descriptor would; conditional or hypothetical +vwn noun oven; stove; grill +vyn descriptor even; emphasizes something surprising or extreme +völ descriptor already +vöt descriptor anti; opposite; inverse in meaning +web noun web; internet +wed noun word +weg verb to wait (for something) +wek verb to work (on something); do labor +wel preposition while; during; for; for the duration of; from the start to the end of +wer verb to wear (an article) +wet descriptor wet; damp +wev verb to wave (something); move back and forth; swing +wey noun way; method; means; manner; mode +weð descriptor whether; expresses the truth of a statement +wic noun wind; gust; breeze +wid noun window +wil descriptor will; going to; causes a verb to be in the future tense +wim descriptor which; whom; extracts the direct or prepositional object from a situation noun so that the object takes the place of the situation noun in the parent clause +win verb to win (a competition); be victorious in; succeed at +wis descriptor which; who; extracts the subject from a situation noun so that the subject takes the place of the situation noun in the parent clause +wit descriptor which; interrogative identity +wix preposition with; along with; accompanied by +wod descriptor wide +wol noun world +wom descriptor warm; a little hot +wor noun war; battle; combat +woð noun weather; climate +wun descriptor one +wuz descriptor was; -ed; causes a verb to be in the past tense +wyl noun wheel +wyn descriptor on; active/actively; doing something +wys descriptor white +wyt noun wheat +wök verb to walk (on something) +wöl noun wall +wön verb to want; wish for; hope for; seek +wöt noun water +xik descriptor thick; large in the tertiary direction +xiq noun thing; the most general noun +xok verb to think (about something) +xro verb to throw (something); toss +xrw preposition through; in and out of +xry descriptor three +yer noun year +yol noun oil +yos descriptor east +yot verb to eat (something); consume; drink +ywl descriptor useful; helpful +ywn noun you; the person being addressed +ywt noun unit +ywz verb to use +zam noun example; model +zis suffix makes a noun plural +zyp descriptor easy/easily +zyr descriptor zero +ðan preposition than; relative to; with respect to; in comparison with +ðat descriptor that; a more distant specific one +ðeq verb to thank (for doing something) +ðis descriptor this; a close specific one +ðor descriptor other; another; a different one +ðyt descriptor the; a specific one |