Metadata-Version: 2.4
Name: cmt-voice-za
Version: 1.0.0
Summary: African-language AI coding assistant for Python — converts spoken isiZulu, isiXhosa, Sesotho, Setswana, Sepedi, Tshivenda, Xitsonga to Python code
Author: Mzwandile Zulu
Keywords: zulu xhosa sesotho setswana sepedi tshivenda xitsonga african languages python voice coding AI
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Education
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: anthropic>=0.25.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: full
Requires-Dist: anthropic>=0.25.0; extra == "full"
Requires-Dist: pandas; extra == "full"
Requires-Dist: numpy; extra == "full"
Requires-Dist: matplotlib; extra == "full"
Requires-Dist: seaborn; extra == "full"
Requires-Dist: scikit-learn; extra == "full"
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 🎤 CMT_Voice

**African-language AI coding assistant for Python and VS Code**

> *"Funda iCSV ebizwa abafundi.csv bese ukhombisa imigqa emihlanu"*
> → `df = pd.read_csv("abafundi.csv")` + `print(df.head())`

CMT_Voice lets South African students, researchers, and developers **write Python by speaking isiZulu, isiXhosa, Sesotho, Setswana, Sepedi, Tshivenda, Xitsonga**, and English — directly inside VS Code or Jupyter Notebooks.

---

## ✨ Features

- **All Python keywords** in 7+ South African languages
- **All built-in functions** (`print`, `len`, `range`, `input`, `open`, ...)
- **pandas** — read CSV/Excel, head, describe, groupby, merge, pivot ...
- **NumPy** — arrays, math, random, reshape, matrix ops ...
- **Matplotlib + Seaborn** — line, bar, histogram, scatter, pie, heatmap ...
- **Scikit-Learn** — train/test split, RandomForest, SVM, KNN, accuracy, PCA ...
- **TensorFlow / Keras** — Sequential, Dense, compile, fit, predict, save ...
- **PyTorch** — tensors, nn.Module, optimizers, backward, CUDA ...
- **Flask** — routes, GET/POST, jsonify, run ...
- **File operations** — open, read, write, os.path, makedirs ...
- **AI fallback** — Claude AI handles anything not in the dictionary
- **VS Code extension** — `Ctrl+Shift+V` to open the translation panel
- **Multi-turn context** — remembers your current file for smarter completions

---

## 🚀 Quick Start

### Install Python package

```bash
pip install cmt-voice
```

### Use in Python

```python
import cmt_voice as cmtv

# Configure (reads ANTHROPIC_API_KEY env var automatically)
cmtv.configure()

# Translate simple phrase
print(cmtv.translate("Phrinta Sawubona"))
# → print("Sawubona")

# Translate with AI for complex intents
print(cmtv.translate("Funda iCSV ebizwa abafundi.csv bese ukhombisa imigqa emihlanu"))
# → df = pd.read_csv("abafundi.csv")
# → print(df.head())

# Interactive REPL
cmtv.listen_loop()
```

### VS Code Extension

1. Copy the `vscode_extension/` folder to your VS Code extensions directory
2. Set your API key in Settings → CMT_Voice → API Key
3. Open any `.py` file
4. Press **`Ctrl+Shift+V`** (Mac: `Cmd+Shift+V`) to open the panel
5. Type in any South African language → click Translate → Insert

---

## 🗣️ Language Examples

### Keywords

| Spoken | Language | Python |
|--------|----------|--------|
| `Phrinta Sawubona` | isiZulu | `print("Sawubona")` |
| `Khombisa igama` | isiZulu | `print(igama)` |
| `Laetsa lebitso` | Sesotho | `print(lebitso)` |
| `Bontsha leina` | Setswana | `print(leina)` |
| `Uma x inkulu kuno 5` | isiZulu | `if x > 5:` |
| `Xa x inkulu ku 5` | isiXhosa | `if x > 5:` |
| `Haeba x e fetisa 5` | Sesotho | `if x > 5:` |
| `Ngaphandle kwalokho` | isiZulu | `else:` |
| `Phinda i in range 10` | isiZulu | `for i in range(10):` |
| `Ngenkathi x inkulu kuno 0` | isiZulu | `while x > 0:` |
| `Dala umsebenzi obizwa sawubona` | isiZulu | `def sawubona():` |
| `Buyisa umphumela` | isiZulu | `return umphumela` |
| `iKilasi Mfundi` | isiZulu | `class Mfundi:` |
| `Zama` | isiZulu | `try:` |
| `Uma kunephutha Exception` | isiZulu | `except Exception:` |
| `Fakisa pandas` | isiZulu | `import pandas as pd` |
| `Iqiniso` | isiZulu | `True` |
| `Amanga` | isiZulu | `False` |
| `Lutho` | isiZulu | `None` |

### Data Science (pandas)

| Spoken | Python |
|--------|--------|
| `Funda iCSV ebizwa data.csv` | `df = pd.read_csv("data.csv")` |
| `Funda iExcel ebizwa data.xlsx` | `df = pd.read_excel("data.xlsx")` |
| `Khombisa imigqa emihlanu yokuqala` | `print(df.head())` |
| `Bonisa ulwazi` | `df.info()` |
| `Chaza idatha` | `df.describe()` |
| `Ubunjalo bedatha` | `df.shape` |
| `Susa ulutho` | `df.dropna()` |
| `Hlela ngamanani` | `df.sort_values('column')` |
| `Hlanganisa ngemihlobo` | `df.groupby('column')` |
| `Gcina njengescsv` | `df.to_csv("output.csv")` |

### Machine Learning (scikit-learn)

| Spoken | Python |
|--------|--------|
| `Hlukanisa idatha ibe yi-training ne-testing` | `X_train, X_test, y_train, y_test = train_test_split(...)` |
| `Dala i-random forest` | `model = RandomForestClassifier()` |
| `Dala i-logistic regression` | `model = LogisticRegression()` |
| `Dala i-svm` | `model = SVC()` |
| `Qeqesha imodeli` | `model.fit(X_train, y_train)` |
| `Bikezela` | `predictions = model.predict(X_test)` |
| `Bonisa ukunemba` | `print(accuracy_score(y_test, predictions))` |
| `Bonisa inhlalo` | `print(classification_report(...))` |
| `Lungisa idatha` | `scaler = StandardScaler()` |
| `Nciphisa izikhombisi` | `pca = PCA(n_components=2)` |

### Visualisation (matplotlib/seaborn)

| Spoken | Python |
|--------|--------|
| `Dweba umugqa` | `plt.plot(x, y)` |
| `Dweba i-bar chart` | `plt.bar(x, y)` |
| `Dweba i-histogram` | `plt.hist(data)` |
| `Dweba amachashazi` | `plt.scatter(x, y)` |
| `Dweba i-pie chart` | `plt.pie(sizes)` |
| `Faka isihloko Imiphumela` | `plt.title("Imiphumela")` |
| `Dweba igraph` | `plt.show()` |
| `Dweba i-heatmap` | `sns.heatmap(df.corr())` |
| `Dweba i-pairplot` | `sns.pairplot(df)` |

### Deep Learning (TensorFlow/PyTorch)

| Spoken | Python |
|--------|--------|
| `Dala i-neural network` | `model = tf.keras.Sequential()` |
| `Faka i-dense layer` | `model.add(tf.keras.layers.Dense(64, activation='relu'))` |
| `Faka i-dropout` | `model.add(tf.keras.layers.Dropout(0.5))` |
| `Lungisa imodeli` | `model.compile(optimizer='adam', ...)` |
| `Qeqesha imodeli` | `model.fit(X_train, y_train, epochs=10)` |
| `Hlola imodeli` | `loss, acc = model.evaluate(X_test, y_test)` |
| `Gcina imodeli` | `model.save("imodeli.h5")` |

---

## 🏗️ Architecture

```
CMT_Voice/
├── cmt_voice/
│   ├── __init__.py          # Public API
│   ├── engine.py            # Core engine (local + AI translation)
│   └── mappings.py          # 1000+ language → Python mappings
├── vscode_extension/
│   ├── package.json         # Extension manifest
│   └── src/extension.js     # VS Code extension (Ctrl+Shift+V)
├── examples/
│   ├── all_examples.py      # Full test suite
│   └── data_science_izulu.py # Complete isiZulu ML workflow
├── setup.py
└── README.md
```

**Translation pipeline:**
```
Spoken SA Language
       ↓
  LocalTranslator (dictionary, instant)
       ↓ (no match)
  AITranslator (Claude API, handles complex/novel phrases)
       ↓
  Post-processing (clean indentation, strip fences)
       ↓
  Valid Python Code → inserted at cursor in VS Code
```

---

## ⚙️ Configuration

```python
import cmt_voice as cmtv

cmtv.configure(
    api_key="sk-ant-...",        # or set ANTHROPIC_API_KEY env var
    model="claude-sonnet-4-6",   # Claude model
    always_use_ai=False,         # True = always use AI (slower, more accurate)
)
```

VS Code settings (`settings.json`):
```json
{
  "cmtvoice.apiKey": "sk-ant-...",
  "cmtvoice.model": "claude-sonnet-4-6",
  "cmtvoice.alwaysUseAI": false,
  "cmtvoice.addImportsAutomatically": true,
  "cmtvoice.insertAtCursor": true,
  "cmtvoice.language": "auto"
}
```

---

## 🌍 Supported Languages

| Language | Region |
|----------|--------|
| isiZulu | KwaZulu-Natal, Gauteng |
| isiXhosa | Eastern Cape, Western Cape |
| Sesotho | Free State, Lesotho |
| Setswana | North West, Botswana |
| Sepedi (Northern Sotho) | Limpopo |
| Tshivenda | Limpopo |
| Xitsonga | Limpopo, Mpumalanga |
| English | All provinces |
| Mixed SA | Any combination |

---

## 🎯 Roadmap

- [x] v1.0 — Python package with 1000+ mappings
- [x] v1.0 — VS Code extension (Ctrl+Shift+V)
- [ ] v1.1 — Jupyter Notebook extension (speak → cell code)
- [ ] v1.2 — Real microphone input (speech-to-text → code)
- [ ] v1.3 — More languages (Siswati, isiNdebele, Afrikaans)
- [ ] v2.0 — Full IDE plugin (JetBrains, Cursor)
- [ ] v2.0 — Voice activation ("Hey CMT") support

---

## 📄 License

MIT License — built for African students, researchers, and developers.

*Sala kahle. Totsiens. Goodbye.*
