Grand Diomande Research · Full HTML Reader
Cross-Script Bridge Python SDK
```python detected = csb.detect("ߒߞߏ ߛߓߍ") print(detected.script) # nko print(detected.confidence) # 1.0 print(detected.breakdown) # {'nko': 1.0, 'arabic': 0.0, 'latin': 0.0} ```
Full Public Reader
Cross-Script Bridge Python SDK
Real-time translation between N'Ko (ߒߞߏ), Arabic (العربية), and Latin scripts.
Installation
bash
pip install cross-script-bridge
# With streaming support
pip install cross-script-bridge[streaming]Quick Start
python
from cross_script_bridge import CrossScriptBridge
# Initialize client
csb = CrossScriptBridge([sensitive field redacted])
# Translate N'Ko to Latin
result = csb.translate("ߒߞߏ", target='latin')
print(result.output) # n'ko
# Translate Latin to N'Ko
result = csb.translate("Hello", target='nko')
print(result.output) # ߤߋߟߏ
# Auto-detect source script
result = csb.translate("مرحبا", target='latin')
print(result.source) # arabic (auto-detected)
print(result.output) # marhabaFeatures
Script Detection
python
detected = csb.detect("ߒߞߏ ߛߓߍ")
print(detected.script) # nko
print(detected.confidence) # 1.0
print(detected.breakdown) # {'nko': 1.0, 'arabic': 0.0, 'latin': 0.0}Phonetic Analysis
python
analysis = csb.analyze("ߒߞߏ")
print(analysis.ipa) # nko
print(analysis.difficulty) # beginner
print(analysis.characters) # [{'char': 'ߒ', 'name': 'NKO LETTER N', 'ipa': 'n'}, ...]Batch Translation
python
results = csb.batch([
{'text': 'ߒߞߏ', 'target': 'latin'},
{'text': 'Hello', 'target': 'nko'},
{'text': 'سلام', 'target': 'latin'}
])
for r in results.results:
print(f"{r['input']} → {r['output']}")Streaming Translation
python
# Character-by-character streaming
for char in csb.stream("Hello World", target='nko'):
print(char, end='', flush=True)Convenience Methods
python
# Quick translations
nko = csb.to_nko("Hello") # ߤߋߟߏ
arabic = csb.to_arabic("Hello") # هيلو
latin = csb.to_latin("ߒߞߏ") # n'koConfiguration
python
csb = CrossScriptBridge(
[sensitive field redacted], # API key (optional for demo)
base_url='http://localhost:5002', # API server URL
timeout=30 # Request timeout in seconds
)Error Handling
python
from cross_script_bridge import CrossScriptBridge, CSBError
try:
result = csb.translate("", target='nko')
except CSBError as e:
print(f"Error: {e.message}")
print(f"Status: {e.status_code}")
print(f"Response: {e.response}")Scripts Supported
| Script | Code | Direction | Sample |
|---|---|---|---|
| N'Ko | `nko` | RTL | ߒߞߏ |
| Arabic | `arabic` | RTL | العربية |
| Latin | `latin` | LTR | Hello |
License
MIT
Promotion Decision
Attach run IDs, datasets, metrics, and reproduction commands.
Source Anchor
NKo/tools/sdk/python/README.md
Detected Structure
Method · Evaluation