A Python library for interacting with the GhanaNLP API
Reason this release was yanked:
Error handling and request format
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.3.tar.gz
.
File metadata
- Download URL: ghana-nlp-0.1.3.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 | e5e85117b0db1a7486a06da8405f36b6c6a27f85e69e7b5d8110a1bd639cf4ba |
|
MD5 | 11aad235c5306f87b387d21a020d3ceb |
|
BLAKE2b-256 | d60bba6e0b4a1f7c8ace58b2974652da73bf822a9f4e1c1a2e537ebd84aa8ce8 |
File details
Details for the file ghana_nlp-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: ghana_nlp-0.1.3-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 | 520e4e4bb37fe37557c4dd108a447d90e9835f5c8e20acff43f607aea785f49d |
|
MD5 | 3ae78bf830d0902c6c39942776d89294 |
|
BLAKE2b-256 | 8012bd2eb2b748037861f0f7dad6507810ffd7a6523ddef697b515de1c07104b |