Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kimslawson opened this issue Nov 12, 2022 · 2 comments
Open

Comments

@kimslawson
Copy link

kimslawson commented Nov 12, 2022

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

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

@kimslawson kimslawson changed the title #NNNGM O Fortuna - Unix fortunes via google translate #NNNGM “O Fortuna” - Unix fortunes in Latin via google translate Nov 12, 2022
@kimslawson
Copy link
Author

kimslawson commented Nov 26, 2022

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants