Skip to main content

A Python library for interacting with the GhanaNLP API

Reason this release was yanked:

A bit inconsistent

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?", source_lang="en", target_lang="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")
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghana-nlp-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

ghana_nlp-0.1.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file ghana-nlp-0.1.2.tar.gz.

File metadata

  • Download URL: ghana-nlp-0.1.2.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

Hashes for ghana-nlp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 334eae58aa96ee132bc893f003558c73b7fedf83031a5aeefcbe029d36d32ebf
MD5 e309f36ae0537acc9964fec4d7c6ce2c
BLAKE2b-256 6e3a38bfd03bbc77c24062fbd768b61bca736098142278e8ae2482f5f83f111f

See more details on using hashes here.

File details

Details for the file ghana_nlp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ghana_nlp-0.1.2-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

Hashes for ghana_nlp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2b6bd85ecf2cd8b96756db9a7a22916809061b1c0037b5ffff2e45471928d94
MD5 4cdbe01ca01a1b76c2943fdb273444de
BLAKE2b-256 f170bc35367ef4f14190710bdb9ff2258d7c9341df45b8ae56175f2dbb869c69

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page