A Python library for interacting with the GhanaNLP API
Reason this release was yanked:
Sloppy docs
Project description
Ghana NLP Python Library
The Ghana NLP API 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:
pip install ghana-nlp
Usage
Initialize the Library
First, import the library and set your API key:
from ghana_nlp import GhanaNLP
nlp = GhanaNLP(api_key="your_api_key_here")
Translation Example
Translate from English to Twi:
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:
result = nlp.speech_to_text("your_audio_file.wav", language="tw")
print(result)
Text-to-Speech (TTS)
Convert text to speech:
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 and start building cool stuff with Ghana NLP! 🎉
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
File details
Details for the file ghana-nlp-0.1.4.tar.gz
.
File metadata
- Download URL: ghana-nlp-0.1.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2335770d94203f8f89b9ad03444c82b745264a2b9e077cb606a14469d6f60773 |
|
MD5 | 186a8d6c70366805b1720bb0b0b339e2 |
|
BLAKE2b-256 | 3eb655a0a8a2d0cddd8d9f7ea08a853d3d6223d897a624e8b9485978a7966273 |
File details
Details for the file ghana_nlp-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: ghana_nlp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9614763af55501b4f7e7616b13fdce5c08dd526a12731448e8a728ecc43a4ee4 |
|
MD5 | 3a4f418100b4b6f5cfcf8bb14ac918fc |
|
BLAKE2b-256 | e510db39c2829e5a732c7c7a4691f66f89783205977b8e78e4b8d344a9456d06 |