Skip to content

phineas-pta/library-babel

Repository files navigation

URBabel: Unicode romanized Library of Babel

about

a Python transpilation of @zwyx ’s Library of Babel: mainly a CLI with limited multi-language input support

for personal fun and also coding challenge

see ABOUT for more details about my exploration journey

see DETAILS for technical details about this implementation

this program is STILL INTENDED FOR PYTHON DEVELOPERS: dependencies installation isn’t trivial for end users

credits

all illustrations in this repo are just links to the website of Jonathan Basile and Tom Snelling

dependencies

  • Python version ≥ 3.14 (free-threading not required)
  • General Multi-Precision (GMP) arithmetic: gmpy2: to crunch very big number
  • International Components for Unicode (ICU): pyicu: to deal with unicode inputs
  • optional pillow to output image
  • optional fpdf2 to output pdf, using JuliaMono typeface from https://github.com/cormullion/juliamono

command example on my machine (windows):

pip install pillow gmpy2 fpdf2 https://github.com/cgohlke/pyicu-build/releases/download/v2.16.2/pyicu-2.16.2-cp314-cp314-win_amd64.whl

command example on Linux or Mac (conda may be easier):

pip install pillow gmpy2 fpdf2 pyicu

usage

i include a text file that u can use to test the program

python -m urbabel.cli search -i docs/3-EXTRA.md -o tmp/book-1.txt -save-pos -save-img -save-pdf

on my computer, process a book take ~3s, then save to .png take ~2s, RAM usage < 200 MiB

RECOMMENDATION: use a modern monospace file to properly render all characters, like JuliaMono, Fira Code, Iosevka, etc.

COMPATIBILITY: see https://github.com/unicode-org/last-resort-font

extra 1: to generate books in your own language without latin characters: edit:

extra 2: to change font in PDF output: edit path to font file in pdf.py

TODO

(not in any particular order)

  • TXT / PNG / PDF input / output
  • setup github / gitlab ci/cd to automate testing
  • better user interface: text / graphical / web
  • verify the number of characters filtered: 8175 8145 in book content, 149625 159613 in book id
  • GPU acceleration for base conversion maybe not really necessary
  • Julia version ? not worth the effort at the moment

About

a Python transpilation of @Zwyx ’s Library of Babel: mainly a CLI with limited multi-language input support

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages