semvec/pypi-packages huggingface dataset:
simplebayes 2.1.0
A memory-based, optional-persistence naïve bayesian text classifier.
License: MIT
Requires Python: >=3.8
Keywords: bayes, classifier, naive, text, spam

# simplebayes

A memory-based, optional-persistence naïve bayesian text classifier.

This work is heavily inspired by the python "redisbayes" module found here:
[https://github.com/jart/redisbayes](https://github.com/jart/redisbayes) and [https://pypi.python.org/pypi/redisbayes](https://pypi.python.org/pypi/redisbayes)

I've elected to write this to alleviate the network/time requirements when using the bayesian classifier to classify large sets of text, or when attempting to train with very large sets of sample data.

## Build Status

![Build](https://github.com/hickeroar/simplebayes/actions/workflows/test.yml/badge.svg?branch=master)
![Coverage](https://img.shields.io/badge/coverage-100%-brightgreen.svg?style=flat)
![Pylint](https://img.shields.io/badge/pylint-10.00/10-brightgreen.svg?style=flat)
![Flake8](https://img.shields.io/badge/flake8-passing-brightgreen.svg?style=flat)

## Installation

```bash
pip install simplebayes
```

## Basic Usage

```python
import simplebayes
bayes = simplebayes.SimpleBayes()

bayes.train('good', 'sunshine drugs love sex lobster sloth')
bayes.train('bad', 'fear death horror government zombie')

assert bayes.classify('sloths are so cute i love them') == 'good'
assert bayes.classify('i would fear a zombie and love the government') == 'bad'

print(bayes.score('i fear zombies and love the government'))

bayes.untrain('bad', 'fear death')

assert bayes.tally('bad') == 3
```

## Cache Usage

```python
import simplebayes
bayes = simplebayes.SimpleBayes(
    cache_path='/my/cache/',
    cache_file='project-a.pickle',
)
# Cache file is '/my/cache/project-a.pickle'
# Default cache_path is '/tmp/'
# Default cache_file is '_simplebayes.pickle'

if not bayes.cache_train():
    # Unable to load cache data, so we're training it
    bayes.train('good', 'sunshine drugs love sex lobster sloth')
    bayes.train('bad', 'fear death horror government zombie')

    # Saving the cache so next time the training won't be needed
    bayes.cache_persist()
```

Use different `cache_file` values when running multiple `SimpleBayes` objects
to avoid cache collisions.

## Tokenizer Override

```python
import simplebayes

def my_tokenizer(sample):
    return sample.split()

bayes = simplebayes.SimpleBayes(tokenizer=my_tokenizer)
```

## License

MIT, see `LICENSE`.

## API Documentation

[http://hickeroar.github.io/simplebayes/simplebayes.html](http://hickeroar.github.io/simplebayes/simplebayes.html)
ouro-sdk 1.0.0
Python SDK for the Ouroboros decentralized blockchain network
License: MIT
Requires Python: >=3.8
Keywords: ouroboros, blockchain, sdk, crypto, bft, hotstuff

# ouro-sdk

Python SDK for the [Ouroboros](https://github.com/ouroboros-network/ouroboros) decentralized blockchain network.

## Install

```bash
pip install ouro-sdk

# For async support (AsyncOuroClient):
pip install ouro-sdk[async]
```

## Quick Start (sync)

```python
from ouro_sdk import OuroClient

client = OuroClient("http://localhost:8000", api_key="your-api-key")

# Check health
print(client.health())  # {'status': 'healthy', ...}

# Get consensus state
c = client.consensus()
print(f"View: {c['view']}, Leader: {c['leader']}")

# Get balance
bal = client.balance("ouro1myaddress")
print(f"Balance: {bal['balance']} nanoouro")

# Submit a transaction
result = client.submit_transaction({
    "sender": "ouro1abc...",
    "recipient": "ouro1xyz...",
    "amount": 1_000_000_000,  # 1 OURO
    "signature": "hex-encoded-signature",
})
print(f"TX: {result['tx_id']}")

# Combined status snapshot
status = client.status()
print(f"Online: {status['online']}, Block: {status.get('metrics', {}).get('block_height')}")
```

## Quick Start (async)

```python
import asyncio
from ouro_sdk import AsyncOuroClient

async def main():
    client = AsyncOuroClient("http://localhost:8000", api_key="your-api-key")
    health = await client.health()
    consensus = await client.consensus()
    status = await client.status()
    print(status)

asyncio.run(main())
```

## API Reference

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| `health()` | GET /health | No | Node liveness |
| `identity()` | GET /identity | No | Node ID, role, uptime |
| `consensus()` | GET /consensus | No | View, leader, last block |
| `peers()` | GET /peers | No | Connected peers |
| `balance(address)` | GET /ouro/balance/:addr | No | OURO balance |
| `nonce(address)` | GET /ouro/nonce/:addr | No | Account nonce |
| `metrics()` | GET /metrics/json | Yes | TPS, sync %, mempool |
| `resources()` | GET /resources | Yes | CPU, RAM, disk |
| `mempool()` | GET /mempool | Yes | Mempool contents |
| `network_stats()` | GET /network/stats | Yes | Network stats |
| `get_transaction(id)` | GET /tx/:id | Yes | Transaction lookup |
| `submit_transaction(tx)` | POST /tx/submit | Yes | Submit transaction |
| `transfer(from, to, amt)` | POST /ouro/transfer | Yes | Transfer OURO |
| `status()` | combined | - | Full snapshot |

## Environment Variables

- `OURO_API_KEY` — API key for protected endpoints

## License

MIT