Smart Babylon Library v1.1.1

A deterministic infinite library generator inspired by Borges' 'The Library of Babel'

Generate unique, deterministic books and pages based on coordinate systems without storing any data.

Python Babylonian Library Text Generator Deterministic PyPI Research

Smart Babylon Library is a deterministic infinite library generator inspired by Borges' 'The Library of Babel'. It generates unique, deterministic books and pages based on a 6-dimensional coordinate system without storing any data.

Version 1.1.1 adds powerful Multi-Universe Support and enhanced JSON serialization, allowing you to create isolated libraries with different configurations where the same coordinates produce different content across universes.

  • Deterministic Generation — same coordinates always produce the same content
  • Infinite Library — virtually unlimited books and pages through coordinate system
  • Zero Storage — content generated on-demand, nothing stored
  • Multi-Universe Support — create isolated libraries with different configurations
  • Configurable — customize book lengths, page sizes, and character sets
  • JSON Support — full serialization to JSON format with universe support
  • Unicode Support — Cyrillic, Latin, digits, and punctuation
  • Modular OOP Design — clean separation of concerns

Each item is located using 6-dimensional coordinates:

  • floor — Library floor
  • room — Room number
  • cabinet — Cabinet number
  • shelf — Shelf number
  • book — Book number
  • page — Page number

Different universes produce different content for the same coordinates, allowing for isolated libraries with different configurations:

from smart_babylon_library import SmartBabylonLibrary, LibraryConfig

# Different universes - different content
fantasy_config = LibraryConfig(universe="middle_earth")
scifi_config = LibraryConfig(universe="andromeda_galaxy")

fantasy_library = SmartBabylonLibrary(fantasy_config)
scifi_library = SmartBabylonLibrary(scifi_config)

# Same coordinates, different content
fantasy_book = fantasy_library.get_book(1, 1, 1, 1, 1)
scifi_book = scifi_library.get_book(1, 1, 1, 1, 1)

print(fantasy_book.title != scifi_book.title)  # True

# Universe is included in JSON serialization
print(fantasy_book.to_json())  # Includes 'universe' field

Installation

pip install smart-babylon-library

Basic Usage

from smart_babylon_library import SmartBabylonLibrary

# Create library instance
library = SmartBabylonLibrary()

# Get a book by coordinates
book = library.get_book(floor=1, room=3, cabinet=2, shelf=5, book_number=42)

print(f"Book: {book}")
print(f"Title: {book.title}")
print(f"Pages: {book.max_pages}")

# Access specific page
page = book.get_page(0)
print(f"Page content: {page.content}")

Basic Configuration:

from smart_babylon_library import SmartBabylonLibrary, LibraryConfig

# Basic configuration
config = LibraryConfig(
    universe="my_library",              # Universe name
    title_length_range=(10, 100),      # Title length range
    content_length_range=(500, 2000),  # Page content length range
    pages_per_book_range=(5, 50)       # Pages per book range
)

library = SmartBabylonLibrary(config)

Custom Character Sets:

from smart_babylon_library import SmartBabylonLibrary, LibraryConfig
from smart_babylon_library.character_sets.alphabets import LatinAlphabet, CyrillicAlphabet
from smart_babylon_library.character_sets.digits import Digits

# Custom character sets (only Latin and digits)
custom_config = LibraryConfig(
    universe="numeric_world",
    title_length_range=(10, 50),
    content_length_range=(200, 1000),
    pages_per_book_range=(5, 20),
    character_sets=[LatinAlphabet(), Digits()]
)

library = SmartBabylonLibrary(custom_config)

Built-in Character Sets:

  • CyrillicAlphabet() — Russian alphabet (upper and lower case)
  • LatinAlphabet() — English alphabet (upper and lower case)
  • Digits() — Numbers (0-9)
  • Punctuation() — Punctuation and symbols

SmartBabylonLibrary — Main Library Class

  • get_book(floor, room, cabinet, shelf, book_number) — Get book by coordinates
  • get_book_from_dict(coordinates_dict) — Get book from dictionary
  • get_book_json(coordinates_dict) — Get book as JSON string
  • get_page(floor, room, cabinet, shelf, book_number, page) — Get page by coordinates
  • get_page_from_dict(coordinates_dict) — Get page from dictionary
  • get_page_json(coordinates_dict) — Get page as JSON string

LibraryBook — Book Class

  • title — Book title (generated)
  • max_pages — Total pages in book
  • coordinates — Book coordinates
  • config — Library configuration with universe
  • get_page(page_number) — Get specific page
  • to_dict() — Convert to dictionary (includes universe)
  • to_json() — Convert to JSON (includes universe)

LibraryPage — Page Class

  • content — Page content (generated)
  • page_number — Page number
  • coordinates — Page coordinates
  • config — Library configuration with universe
  • to_dict() — Convert to dictionary (includes universe)
  • to_json() — Convert to JSON (includes universe)

# Get book as JSON (includes universe)
book_json = library.get_book_json({
    'floor': 1, 'room': 1, 'cabinet': 1,
    'shelf': 1, 'book': 1, 'page': 0
})

# Get page as JSON (includes universe)
page_json = library.get_page_json({
    'floor': 1, 'room': 1, 'cabinet': 1,
    'shelf': 1, 'book': 1, 'page': 42
})

print(book_json)  # Includes 'universe' field

Content generation is deterministic based on coordinates and universe:

# Same coordinates = same content
book1 = library.get_book(1, 1, 1, 1, 1)
book2 = library.get_book(1, 1, 1, 1, 1)

assert book1.title == book2.title
assert book1.get_page(0).content == book2.get_page(0).content

# Different universe = different content (even with same coordinates)
other_library = SmartBabylonLibrary(LibraryConfig(universe="other"))
book3 = other_library.get_book(1, 1, 1, 1, 1)

assert book1.title != book3.title  # Different universes

Current Version: 1.1.1 (Multi-Universe Support)

  • Multi-Universe Support — Create isolated libraries with different configurations
  • Enhanced Configuration — Universe parameter for deterministic isolation
  • Complete JSON Integration — Universe field included in all serializations
  • Full Roundtrip Support — Serialize/deserialize with universe preservation
  • Universe-Based Determinism — Content generation isolated per universe

Version 1.0.1 (New Architecture):

  • Modular OOP Design — Clean separation of concerns
  • Enhanced Configuration — Flexible LibraryConfig system with character sets customization
  • JSON Serialization — Full object serialization support
  • Type Safety — Improved type hints and validation
  • Research Integration — Implements concepts from published papers

⚠️ Legacy Version 0.6.5 and earlier are no longer supported. Users of older versions should migrate to 1.0.0+.

This library implements concepts from our published research:

  • Pointer-Based Security Paradigm10.5281/zenodo.17204738
    Architectural shift from data protection to data non-existence
  • Local Data Regeneration Paradigm10.5281/zenodo.17264327
    Ontological shift from data transmission to synchronous state discovery
  • Deterministic Game Engine10.5281/zenodo.17383447
    Practical implementation validating the theoretical paradigms
  • Position-Candidate-Hypothesis (PCH) Paradigm10.5281/zenodo.17614888
    A new research direction for NP-Complete problems

IMPORTANT DISCLAIMER: This project is currently in active research and development phase. It is provided as-is for academic and experimental purposes only. No guarantees of stability, security, or fitness for any particular purpose are provided. Users assume all risks associated with usage.

Full legal disclaimer: See DISCLAIMER.md

License: BSD 3-Clause License