Skip to main content

Smart Babylon Library. A deterministic infinite library generator. Generate unique, deterministic books and pages based on coordinate systems without storing any data.

Project description

Smart Babylon Library v1.0.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.


🚧 Project Status: Research & Development

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.


PyPI Downloads GitHub top language GitHub release (latest by date) GitHub GitHub Repo stars GitHub watchers GitHub forks PyPI - Downloads PyPI PyPI - Format


🚀 Version Information

Current Version: 1.0.1 (New Architecture)

This release represents a complete architectural rewrite with significant improvements:

  • 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

  • Fixed errors

  • Added the ability to configure character sets

Legacy Version: 0.6.5 (Deprecated)

⚠️ Version 0.6.5 and earlier are no longer supported. The previous monolithic architecture has been replaced by the new modular system. Users of older versions should migrate to 1.0.0+.

Key breaking changes:

  • New import paths and class names
  • Different configuration system
  • Updated coordinate structure
  • Enhanced API with better object model

📚 Related Research Publications

This library implements concepts from our published research:

Features

  • 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
  • Configurable: Customize book lengths, page sizes, and character sets
  • JSON Support: Full serialization to JSON format
  • Unicode Support: Cyrillic, Latin, digits, and punctuation

Installation

pip install smart-babylon-library

Quick Start

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}")

Coordinate System

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

Configuration

Customize library generation:

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

# Basic configuration
config = LibraryConfig(
    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
)

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

library = SmartBabylonLibrary(config)

API Reference

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 with properties:

  • title - Book title (generated)
  • max_pages - Total pages in book
  • coordinates - Book coordinates
  • get_page(page_number) - Get specific page
  • to_dict() - Convert to dictionary
  • to_json() - Convert to JSON

LibraryPage

Page class with properties:

  • content - Page content (generated)
  • page_number - Page number
  • coordinates - Page coordinates
  • to_dict() - Convert to dictionary
  • to_json() - Convert to JSON

Examples

Basic Usage

from smart_babylon_library import SmartBabylonLibrary

library = SmartBabylonLibrary()
book = library.get_book(1, 2, 3, 4, 5)

# Access book properties
print(f"Title: {book.title}")
print(f"Total pages: {book.max_pages}")

# Read pages
for page_num in range(min(3, book.max_pages)):
    page = book.get_page(page_num)
    print(f"Page {page_num}: {page.content[:50]}...")

JSON Serialization

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

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

Custom Configuration

from smart_babylon_library import SmartBabylonLibrary, LibraryConfig

# For short documents
short_config = LibraryConfig(
    title_length_range=(5, 50),
    content_length_range=(100, 500),
    pages_per_book_range=(1, 10)
)

# For long novels  
novel_config = LibraryConfig(
    title_length_range=(10, 100),
    content_length_range=(1000, 5000), 
    pages_per_book_range=(50, 200)
)

short_library = SmartBabylonLibrary(short_config)
novel_library = SmartBabylonLibrary(novel_config)

Character Sets

Library supports configurable character sets. By default includes all sets, but can be customized:

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

Custom Character Sets:

from smart_babylon_library.character_sets.core import CharacterSet
from smart_babylon_library.library.config import LibraryConfig

class MyCharset(CharacterSet):
    @property
    def characters(self):
        chars = list("ABC123!@#")
        return sorted(chars)
    
    @property  
    def name(self) -> str:
        return "My Custom Charset"

config = LibraryConfig(character_sets=[MyCharset()])

Deterministic Behavior

Content generation is deterministic based on coordinates:

# 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

⚠️ Important Legal Notice

NO WARRANTY: This software is provided for academic and research purposes only. The authors make no warranties, express or implied, regarding the software's functionality, security, or fitness for any purpose. Users assume all responsibility and risk for use.

RESEARCH STATUS: This implementation is part of ongoing research into deterministic systems and pointer-based architectures. It should not be used in production environments or for any critical applications.

License

BSD 3-Clause License

GitHub

https://github.com/smartlegionlab/smart-babylon-library

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smart_babylon_library-1.0.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smart_babylon_library-1.0.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file smart_babylon_library-1.0.1.tar.gz.

File metadata

  • Download URL: smart_babylon_library-1.0.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for smart_babylon_library-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b69eda6fe1c67c90dc1dbffa7e288c1c0fbe282f7f13b8f0626a9d2a54d11eb3
MD5 76e0bf8b7f546971601e2c69e98de73b
BLAKE2b-256 aa7cf400031f203006857f30aaa07d78fb6e2b8046cb3e7902fc2ed986a939e2

See more details on using hashes here.

File details

Details for the file smart_babylon_library-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for smart_babylon_library-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 186efef55dc33eae23626e3a1cf7106586161f6f4e69548f8a873edbac70594f
MD5 b30db5f4e39cbe3192972c84dbd545c1
BLAKE2b-256 cb7cbf5235c6cf65f1b3b2eed11f72ec0856cdf901033ee9b4d3f39c164ac35b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page