semantic-bit


Namesemantic-bit JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryGenerate structured JSON metadata for up to 5000 characters of text.
upload_time2025-11-02 16:53:19
maintainerNone
docs_urlNone
authorDan Ray, Gregory Blacketter
requires_python>=3.9
licenseMIT
keywords text analysis json
VCS
bugtrack_url
requirements matplotlib numpy pytest build twine
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ο»Ώgit # semantic-bit Package

This directory contains the Python package implementation of semantic-bit.

## πŸš€ Quick Start - Gradio App

```bash
# From the project root (semantic_bit_theory/)

# 1. Activate virtual environment
source venv/bin/activate          # macOS/Linux
venv\Scripts\activate             # Windows

# 2. Run the app
cd semantic_bit
python -m demo.gradio_app

# Opens at: http://localhost:7860
```

**Or use the convenience script:**
```bash
./start_gradio.sh      # macOS/Linux
./start_gradio.bat       # Windows
```

---

## Package Structure

```
semantic_bit/
β”œβ”€β”€ src/semantic_bit/     # Source code
β”‚   β”œβ”€β”€ __init__.py       # Package exports and API
β”‚   β”œβ”€β”€ semantic.py       # Core SBT implementation  
β”‚   β”œβ”€β”€ cli.py           # Command line interface
β”‚   └── analyzer.py      # Legacy text analysis
β”œβ”€β”€ tests/               # Test suite (62+ tests)
β”œβ”€β”€ pyproject.toml       # Package configuration
└── pytest.ini          # Test configuration
```

## Development

This package is part of the larger semantic_bit_theory project.

**πŸ“– For complete documentation, see the [project README](../README.md)**

### Quick Development Setup

```bash
# From the project root (semantic_bit_theory/)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install all development dependencies
pip install -r requirements.txt

# Install this package in editable mode
pip install -e ./semantic_bit

# Run tests
pytest semantic_bit/tests/
```

**Note:** The core `semantic-bit` package has **zero runtime dependencies**. Development dependencies (matplotlib, numpy, pytest) are only needed for working on the repository, not for using the published package.

### Testing

```bash
# Run all tests
pytest

# Run specific test categories  
pytest tests/test_semantic.py::TestEncoding -v
```

**πŸ“– For detailed testing instructions, see [Testing Guide](../docs/testing.md)**

### Gradio Visual Testing App

An interactive web interface for testing pattern detection, visualization, and SVG animation generation.

#### Setup

```bash
# From the project root (semantic_bit_theory/)

# 1. Create virtual environment with Python 3.13 or 3.12
#    (Python 3.14 has compatibility issues with some dependencies)
python3.13 -m venv venv

# 2. Activate the virtual environment
source venv/bin/activate  # On Windows: venv/Scripts/activate

# 3. Install Gradio and dependencies
pip install gradio graphviz

# 4. Install semantic_bit package in editable mode
pip install -e ./semantic_bit
```

#### Running the App

**Option 1: With Activated Virtual Environment** (Recommended)

```bash
# From the project root (semantic_bit_theory/)

# Activate the virtual environment first:
source venv/bin/activate          # macOS/Linux
# OR
venv/Scripts/activate             # Windows

# Then run the app (works from any directory):
cd semantic_bit
python -m demo.gradio_app

# When done, deactivate:
deactivate
```

**Option 2: Direct Python Path** (No activation needed)

```bash
# From the project root (semantic_bit_theory/)

# macOS/Linux:
./venv/bin/python semantic_bit/demo/gradio_app.py

# Windows:
venv/Scripts/python.exe semantic_bit/demo/gradio_app.py
```

**Option 3: Convenience Script** ⭐

```bash
# From the project root
./start_gradio.sh      # macOS/Linux
# OR
start_gradio.bat       # Windows
```

The app will open at: **http://localhost:7860**

#### Features

- **Interactive text processing**: Enter text and see semantic patterns extracted
- **Graph visualization**: Visual representation of semantic relationships
- **Pattern inspection**: Color-coded pattern display
- **JSON output**: View the raw Semantic Bit JSON structure
- **Enrichments**: Link assets and functions to patterns (optional)
- **SVG Animation** *(NEW)*: Generate animated SVG slideshows from text

#### System Requirements

- **macOS**: Requires system Graphviz for graph rendering
  ```bash
  brew install graphviz
  ```

- **Linux**: Install via package manager
  ```bash
  sudo apt-get install graphviz  # Debian/Ubuntu
  sudo yum install graphviz      # Red Hat/CentOS
  ```

#### Troubleshooting

**"Which virtual environment should I use?"**

The project should have **ONE** virtual environment in the project root:
- βœ… Use: `/Users/.../semantic_bit_theory/venv/` (project root)
- ❌ Don't use: `.venv`, `semantic_bit/venv`, or other locations

If you have multiple venv directories, remove the extras:
```bash
# From project root
rm -rf .venv semantic_bit/venv  # Remove any extras
# Keep only: venv/
```

**"ModuleNotFoundError: No module named 'gradio'"**

Your virtual environment isn't activated or dependencies aren't installed:
```bash
source venv/bin/activate          # Activate first
pip install gradio graphviz       # Install dependencies
pip install -e ./semantic_bit     # Install package
```

**"python: command not found" (Windows)**

Use `python` instead of `python3`:
```bash
python -m venv venv               # Create venv
venv\Scripts\activate             # Activate
python -m demo.gradio_app         # Run app
```

## Package Development

### Building and Publishing

```bash
# Install build tools (or use pip install -r requirements.txt from project root)
pip install build twine

# Build the package (from the semantic_bit/ directory)
python3.10 -m build

# Upload to PyPI
python3.10 -m twine upload dist/*
```

**Note:** A `.pypirc` file in your home directory is recommended for PyPI authentication. See the [Twine documentation](https://twine.readthedocs.io/) for details.

For complete project information, installation instructions, and usage examples, see the [main project README](../README.md).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "semantic-bit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "text, analysis, json",
    "author": "Dan Ray, Gregory Blacketter",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/07/6f/b41c92f254b2aaee666c88c6d86254a1b8ae21cb30052391f64dcd567203/semantic_bit-1.0.2.tar.gz",
    "platform": null,
    "description": "\ufeffgit # semantic-bit Package\n\nThis directory contains the Python package implementation of semantic-bit.\n\n## \ud83d\ude80 Quick Start - Gradio App\n\n```bash\n# From the project root (semantic_bit_theory/)\n\n# 1. Activate virtual environment\nsource venv/bin/activate          # macOS/Linux\nvenv\\Scripts\\activate             # Windows\n\n# 2. Run the app\ncd semantic_bit\npython -m demo.gradio_app\n\n# Opens at: http://localhost:7860\n```\n\n**Or use the convenience script:**\n```bash\n./start_gradio.sh      # macOS/Linux\n./start_gradio.bat       # Windows\n```\n\n---\n\n## Package Structure\n\n```\nsemantic_bit/\n\u251c\u2500\u2500 src/semantic_bit/     # Source code\n\u2502   \u251c\u2500\u2500 __init__.py       # Package exports and API\n\u2502   \u251c\u2500\u2500 semantic.py       # Core SBT implementation  \n\u2502   \u251c\u2500\u2500 cli.py           # Command line interface\n\u2502   \u2514\u2500\u2500 analyzer.py      # Legacy text analysis\n\u251c\u2500\u2500 tests/               # Test suite (62+ tests)\n\u251c\u2500\u2500 pyproject.toml       # Package configuration\n\u2514\u2500\u2500 pytest.ini          # Test configuration\n```\n\n## Development\n\nThis package is part of the larger semantic_bit_theory project.\n\n**\ud83d\udcd6 For complete documentation, see the [project README](../README.md)**\n\n### Quick Development Setup\n\n```bash\n# From the project root (semantic_bit_theory/)\npython -m venv .venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n\n# Install all development dependencies\npip install -r requirements.txt\n\n# Install this package in editable mode\npip install -e ./semantic_bit\n\n# Run tests\npytest semantic_bit/tests/\n```\n\n**Note:** The core `semantic-bit` package has **zero runtime dependencies**. Development dependencies (matplotlib, numpy, pytest) are only needed for working on the repository, not for using the published package.\n\n### Testing\n\n```bash\n# Run all tests\npytest\n\n# Run specific test categories  \npytest tests/test_semantic.py::TestEncoding -v\n```\n\n**\ud83d\udcd6 For detailed testing instructions, see [Testing Guide](../docs/testing.md)**\n\n### Gradio Visual Testing App\n\nAn interactive web interface for testing pattern detection, visualization, and SVG animation generation.\n\n#### Setup\n\n```bash\n# From the project root (semantic_bit_theory/)\n\n# 1. Create virtual environment with Python 3.13 or 3.12\n#    (Python 3.14 has compatibility issues with some dependencies)\npython3.13 -m venv venv\n\n# 2. Activate the virtual environment\nsource venv/bin/activate  # On Windows: venv/Scripts/activate\n\n# 3. Install Gradio and dependencies\npip install gradio graphviz\n\n# 4. Install semantic_bit package in editable mode\npip install -e ./semantic_bit\n```\n\n#### Running the App\n\n**Option 1: With Activated Virtual Environment** (Recommended)\n\n```bash\n# From the project root (semantic_bit_theory/)\n\n# Activate the virtual environment first:\nsource venv/bin/activate          # macOS/Linux\n# OR\nvenv/Scripts/activate             # Windows\n\n# Then run the app (works from any directory):\ncd semantic_bit\npython -m demo.gradio_app\n\n# When done, deactivate:\ndeactivate\n```\n\n**Option 2: Direct Python Path** (No activation needed)\n\n```bash\n# From the project root (semantic_bit_theory/)\n\n# macOS/Linux:\n./venv/bin/python semantic_bit/demo/gradio_app.py\n\n# Windows:\nvenv/Scripts/python.exe semantic_bit/demo/gradio_app.py\n```\n\n**Option 3: Convenience Script** \u2b50\n\n```bash\n# From the project root\n./start_gradio.sh      # macOS/Linux\n# OR\nstart_gradio.bat       # Windows\n```\n\nThe app will open at: **http://localhost:7860**\n\n#### Features\n\n- **Interactive text processing**: Enter text and see semantic patterns extracted\n- **Graph visualization**: Visual representation of semantic relationships\n- **Pattern inspection**: Color-coded pattern display\n- **JSON output**: View the raw Semantic Bit JSON structure\n- **Enrichments**: Link assets and functions to patterns (optional)\n- **SVG Animation** *(NEW)*: Generate animated SVG slideshows from text\n\n#### System Requirements\n\n- **macOS**: Requires system Graphviz for graph rendering\n  ```bash\n  brew install graphviz\n  ```\n\n- **Linux**: Install via package manager\n  ```bash\n  sudo apt-get install graphviz  # Debian/Ubuntu\n  sudo yum install graphviz      # Red Hat/CentOS\n  ```\n\n#### Troubleshooting\n\n**\"Which virtual environment should I use?\"**\n\nThe project should have **ONE** virtual environment in the project root:\n- \u2705 Use: `/Users/.../semantic_bit_theory/venv/` (project root)\n- \u274c Don't use: `.venv`, `semantic_bit/venv`, or other locations\n\nIf you have multiple venv directories, remove the extras:\n```bash\n# From project root\nrm -rf .venv semantic_bit/venv  # Remove any extras\n# Keep only: venv/\n```\n\n**\"ModuleNotFoundError: No module named 'gradio'\"**\n\nYour virtual environment isn't activated or dependencies aren't installed:\n```bash\nsource venv/bin/activate          # Activate first\npip install gradio graphviz       # Install dependencies\npip install -e ./semantic_bit     # Install package\n```\n\n**\"python: command not found\" (Windows)**\n\nUse `python` instead of `python3`:\n```bash\npython -m venv venv               # Create venv\nvenv\\Scripts\\activate             # Activate\npython -m demo.gradio_app         # Run app\n```\n\n## Package Development\n\n### Building and Publishing\n\n```bash\n# Install build tools (or use pip install -r requirements.txt from project root)\npip install build twine\n\n# Build the package (from the semantic_bit/ directory)\npython3.10 -m build\n\n# Upload to PyPI\npython3.10 -m twine upload dist/*\n```\n\n**Note:** A `.pypirc` file in your home directory is recommended for PyPI authentication. See the [Twine documentation](https://twine.readthedocs.io/) for details.\n\nFor complete project information, installation instructions, and usage examples, see the [main project README](../README.md).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate structured JSON metadata for up to 5000 characters of text.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/antfriend/semantic_bit_theory/blob/main/README.md",
        "Repository": "https://github.com/antfriend/semantic_bit_theory"
    },
    "split_keywords": [
        "text",
        " analysis",
        " json"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9649b87ddd99a7732e0a7690cd7533045dd5297c122cc84b96866de2a295f572",
                "md5": "218d6adf7f4099b0ec451b2ac304f143",
                "sha256": "3fa440503164720544a0e7bee55c4b6456951d73a2a607f9d40bed21f5e85970"
            },
            "downloads": -1,
            "filename": "semantic_bit-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "218d6adf7f4099b0ec451b2ac304f143",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 36550,
            "upload_time": "2025-11-02T16:53:18",
            "upload_time_iso_8601": "2025-11-02T16:53:18.432985Z",
            "url": "https://files.pythonhosted.org/packages/96/49/b87ddd99a7732e0a7690cd7533045dd5297c122cc84b96866de2a295f572/semantic_bit-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "076fb41c92f254b2aaee666c88c6d86254a1b8ae21cb30052391f64dcd567203",
                "md5": "5385ba2b27a12eb0cff012566c151a9e",
                "sha256": "04ea1a4b77d78ca719c9d8e7ed6bc30818ee56efccd7da770cb2dd3e51ed7bd0"
            },
            "downloads": -1,
            "filename": "semantic_bit-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5385ba2b27a12eb0cff012566c151a9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 40156,
            "upload_time": "2025-11-02T16:53:19",
            "upload_time_iso_8601": "2025-11-02T16:53:19.356267Z",
            "url": "https://files.pythonhosted.org/packages/07/6f/b41c92f254b2aaee666c88c6d86254a1b8ae21cb30052391f64dcd567203/semantic_bit-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-02 16:53:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "antfriend",
    "github_project": "semantic_bit_theory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.5.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.21.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "build",
            "specs": [
                [
                    ">=",
                    "0.10.0"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        }
    ],
    "lcname": "semantic-bit"
}
        
Elapsed time: 0.57455s