Metadata-Version: 2.1
Name: ghana-nlp
Version: 0.1.4
Summary: A Python library for interacting with the GhanaNLP API
Home-page: https://pnlarbi.vercel.app/
Author: Prince Larbi
Author-email: phiddyconcept@gmail.com
Project-URL: Source, https://github.com/PhidLarkson/Ghana-NLP-Python-Library
Project-URL: Documentation, https://pkwolffe.hashnode.dev/ghana-nlp-python-library
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests

# Ghana NLP Python Library 

The **[Ghana NLP API](https://translation.ghananlp.org/) Python Library** provides an easy way to integrate local African language technologies into your Python projects. Whether you're looking for **translation**, **speech-to-text (STT)**, or **text-to-speech (TTS)**, this library makes it simple and intuitive to get started.

## Features

- **Translation**: Translate text between supported African languages (e.g., English to Twi).
- **Speech-to-Text (STT)**: Convert audio files into text.
- **Text-to-Speech (TTS)**: Generate natural-sounding speech from text in local languages.

## Installation

You can install the library directly from PyPI:

```bash
pip install ghana-nlp
```

## Usage

### Initialize the Library

First, import the library and set your API key:

```python
from ghana_nlp import GhanaNLP

nlp = GhanaNLP(api_key="your_api_key_here")
```

### Translation Example

Translate from English to Twi:

```python
result = nlp.translate("Hello, how are you?", language_pair="en-tw")
print(result)  # Wo ho te sɛn?
```

### Speech-to-Text (STT)

Convert an audio file (WAV format) to text:

```python
result = nlp.speech_to_text("your_audio_file.wav", language="tw")
print(result)
```

### Text-to-Speech (TTS)

Convert text to speech:

```python
result = nlp.text_to_speech("Good morning", lang="tw")
print(result)  # Outputs a URL to the generated audio file
```

## Supported Languages

The library supports multiple African languages, including:
- **English (en)**
- **Twi (tw)**
- **Ga (gaa)**
- **Ewe (ee)**
- **Fante (fat)**
- **Dagbani (dag)**, and more!

## Error Handling

The library provides clear error messages if something goes wrong, such as incorrect language codes or invalid API requests. Check the `message` field in the response for details.

## License

This library is licensed under the MIT License.

---

For more details, check out the [documentation](https://pkwolffe.hashnode.dev/ghana-nlp-python-library) and start building cool stuff with **Ghana NLP**! 🎉
