Intelligent data ingestion and tokenization pipeline
Project description
Suur Data
Intelligent data ingestion and tokenization pipeline.
Suur Data fetches text from any source, filters it by topic using a neural relevance scorer, then tokenizes it using either a pretrained HuggingFace tokenizer or a custom-trained BPE tokenizer.
Installation
# Core (URLs, .txt, .csv, .json, .html)
pip install -e .
# With all optional formats + HuggingFace tokenizers
pip install -e ".[all]"
Python API
from suur_data import suur_data
# Minimal — fetches URL, no filter, GPT-2 tokenizer
tokens = suur_data("https://en.wikipedia.org/wiki/Neuroscience")
# Filter by topic, custom BPE tokenizer
tokens = suur_data(
"research_paper.pdf",
topic="quantum computing",
tokenizer="custom",
vocab_size=4000,
save_dir="./my_tokenizer",
)
# Local file, pretrained BERT tokenizer, strict filter
tokens = suur_data(
"~/corpus/biology.txt",
topic="cell biology",
tokenizer="pretrained",
model="bert",
threshold=0.10,
)
# Skip the filter entirely
tokens = suur_data("data.csv", no_filter=True)
print(tokens[:20]) # list of integer token IDs
print(len(tokens)) # total token count
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data_location |
str | — | URL or local file path |
topic |
str | "" |
Subject for relevance filtering (empty = skip filter) |
tokenizer |
str | "pretrained" |
"pretrained" or "custom" |
model |
str | "gpt2" |
HuggingFace model shortcut or full ID |
vocab_size |
int | 8000 |
BPE vocab size for custom tokenizer |
threshold |
float | `0.05`` | Cosine similarity cutoff (0.0–1.0) |
save_dir |
str | None |
Path to save tokenizer files |
no_filter |
bool | False |
Skip the relevance filter |
verbose |
bool | True |
Show progress output |
Returns
List[int] — flat list of integer token IDs.
CLI
# Basic URL fetch
suur_data fetch https://example.com/article --topic "machine learning"
# PDF with custom BPE tokenizer
suur_data fetch paper.pdf --topic "protein folding" --tokenizer custom --vocab-size 6000
# Local file, pretrained BERT, save tokenizer
suur_data fetch corpus.txt --tokenizer pretrained --model bert --save-dir ./bert_tok
# Skip filter, save tokens to file
suur_data fetch data.json --no-filter --output tokens.json
# See supported models
suur_data models
# See supported file formats
suur_data formats
Supported Input Formats
| Format | Notes |
|---|---|
.txt, .md, .rst |
Plain text |
.pdf |
Requires pdfminer.six |
.docx |
Requires python-docx |
.csv, .tsv |
All cells joined as text |
.json |
Recursively flattened key-value pairs |
.html, .htm |
Scripts/styles stripped (requires beautifulsoup4) |
.epub |
E-books (requires ebooklib + beautifulsoup4) |
| HTTP/HTTPS URL | Auto-downloaded, then parsed by extension |
Pretrained Model Shortcuts
| Shortcut | Model |
|---|---|
gpt2 |
GPT-2 (OpenAI) |
bert |
BERT base uncased |
roberta |
RoBERTa base |
distilbert |
DistilBERT base uncased |
t5 |
T5 small |
You can also pass any HuggingFace Hub model ID directly:
--model "facebook/opt-125m"
Architecture
Source (URL / file)
│
▼
Stage 1: Ingest
Handles 8 file types + HTTP download
│
▼
Stage 2: Neural Filter
Splits into paragraph chunks
Scores each chunk against topic via TF-IDF cosine similarity
Drops chunks below threshold
│
▼
Stage 3: Tokenize
┌─────────────────────┐ ┌────────────────────────────┐
│ Pretrained mode │ │ Custom mode │
│ HuggingFace │ │ BPE trainer (HF library │
│ AutoTokenizer │ │ or pure-Python fallback) │
└─────────────────────┘ └────────────────────────────┘
│
▼
List[int] ← token IDs
Dependency Matrix
| Feature | Required packages |
|---|---|
| Core pipeline | requests, beautifulsoup4, scikit-learn, numpy, click, chardet |
| PDF support | pdfminer.six |
| .docx support | python-docx |
| .epub support | ebooklib |
| Pretrained tokenizers | transformers |
| Fast BPE training | tokenizers |
All optional — the tool degrades gracefully with built-in fallbacks when optional packages are missing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file suur_data-1.0.0.tar.gz.
File metadata
- Download URL: suur_data-1.0.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
843979c4d21373cff7d9c4c3a1730925cd5444c4d9a1edfd19a6f122f135c2f8
|
|
| MD5 |
b0310ed0fbdbcf5d130526d5a0e38d27
|
|
| BLAKE2b-256 |
ca9593f564f78d175dd9932fa4534ab7085691a60a387f5158a4309a60a4fc27
|
File details
Details for the file suur_data-1.0.0-py3-none-any.whl.
File metadata
- Download URL: suur_data-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa1c880f7c4d3a86a04957c81cceab875748df749494071ffb9fb66a740aa9a5
|
|
| MD5 |
7cd5f558ac6116fe4eb2af62d44f3b27
|
|
| BLAKE2b-256 |
bf1eb71b6bfafcd9a3007db43ebced4328991becd5826536c5f68bd76f2b5fd0
|