NaNoGenMo / 2022

National Novel Generation Month, 2022 edition.
51 stars 0 forks source link

#NNNGM “O Fortuna” - Unix fortunes in Latin via google translate #30

Open kimslawson opened 1 year ago

kimslawson commented 1 year ago

What's better than fortunes? Fortunes in Latin, of course!

This is my NanoNanoGenMo entry for 2022 (now completed).

kimslawson commented 1 year ago

Changed from a dependency on a local installation of fortune(1) to using the fortune API documented here https://helloacm.com/fortune/. Shortened the code significantly (thanks, pestis!)

Here's the code (233 bytes)

import googletrans as g,requests as r
w=0
e='unicode_escape'
while w<5e4:t=g.Translator().translate(r.get('https://api.justyy.workers.dev/api/fortune').text.encode('raw_'+e).decode(e),'la').text.strip('"');print(t);w+=len(t.split())

Sample output

Knucklehead: "Pulsate, pulsate";
Pee Wee: "Quis est?"
Knucklehead: "Parva ot domina."
Pee Wee: "Liddle ol' domina quae?"
Knucklehead: "Te non scio yodel"

Femina quam emisti - et minima est pretiosa - magnum accipit
multum pecuniae. Omne tempus tuum mulier quae se donat.
-- Balzac

Si parum astutus es, mitior esses.
-- Benjamin Disraeli

Homines sine ulla condicione praestantur ut vitiis sint pleni.

saccharum tata, n.
Aliquam quis aliquam lacus.

Ne sis pernecessarius, si reponi non potes, promoveri non potes.

QOTD:
"Nescio quid hoc est, sed "F" solum id dignissim.

Est enim moderatio rei fatalis. Nihil proficit sicut intemperantia.
-- Oscar Wilde

…

Repo

Here's the repository

kimslawson commented 1 year ago

Added a PDF version of the output, formatted as a book with LaTeX.