ghana-nlp


Nameghana-nlp JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://pnlarbi.vercel.app/
SummaryA Python library for interacting with the GhanaNLP APIs
upload_time2024-09-25 11:53:33
maintainerNone
docs_urlNone
authorPrince Larbi
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
```
And update to the lastest version

```bash
python -m pip install --upgrade 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 

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)  # audio binary, write a code to either serve to an audio file or play directly
```

Check this repo to guide you with dealing with audio binary data: [EXAMPLE CODE](https://github.com/PhidLarkson/ghananlp-tts-python)


## 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**! 🎉

            

Raw data

            {
    "_id": null,
    "home_page": "https://pnlarbi.vercel.app/",
    "name": "ghana-nlp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Prince Larbi",
    "author_email": "phiddyconcept@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7c/8a/70e93384008e132277e82b68262520dce9e2148be5fde240617bf743fd80/ghana-nlp-0.1.5.tar.gz",
    "platform": null,
    "description": "# Ghana NLP Python Library \n\nThe **[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.\n\n## Features\n\n- **Translation**: Translate text between supported African languages (e.g., English to Twi).\n- **Speech-to-Text (STT)**: Convert audio files into text.\n- **Text-to-Speech (TTS)**: Generate natural-sounding speech from text in local languages.\n\n## Installation\n\nYou can install the library directly from PyPI:\n\n```bash\npip install ghana-nlp\n```\nAnd update to the lastest version\n\n```bash\npython -m pip install --upgrade ghana-nlp\n```\n\n## Usage\n\n### Initialize the Library\n\nFirst, import the library and set your API key:\n\n```python\nfrom ghana_nlp import GhanaNLP\n\nnlp = GhanaNLP(api_key=\"your_api_key_here\")\n```\n\n### Translation \n\nTranslate from English to Twi:\n\n```python\nresult = nlp.translate(\"Hello, how are you?\", language_pair=\"en-tw\")\nprint(result)  # Wo ho te s\u025bn?\n```\n\n### Speech-to-Text (STT)\n\nConvert an audio file (WAV format) to text:\n\n```python\nresult = nlp.speech_to_text(\"your_audio_file.wav\", language=\"tw\")\nprint(result) \n```\n\n### Text-to-Speech (TTS)\n\nConvert text to speech:\n\n```python\nresult = nlp.text_to_speech(\"Good morning\", lang=\"tw\")\nprint(result)  # audio binary, write a code to either serve to an audio file or play directly\n```\n\nCheck this repo to guide you with dealing with audio binary data: [EXAMPLE CODE](https://github.com/PhidLarkson/ghananlp-tts-python)\n\n\n## Supported Languages\n\nThe library supports multiple African languages, including:\n- **English (en)**\n- **Twi (tw)**\n- **Ga (gaa)**\n- **Ewe (ee)**\n- **Fante (fat)**\n- **Dagbani (dag)**, and more!\n\n## Error Handling\n\nThe 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.\n\n## License\n\nThis library is licensed under the MIT License.\n\n---\n\nFor more details, check out the [documentation](https://pkwolffe.hashnode.dev/ghana-nlp-python-library) and start building cool stuff with **Ghana NLP**! \ud83c\udf89\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python library for interacting with the GhanaNLP APIs",
    "version": "0.1.5",
    "project_urls": {
        "Documentation": "https://pkwolffe.hashnode.dev/ghana-nlp-python-library",
        "Homepage": "https://pnlarbi.vercel.app/",
        "Source": "https://github.com/PhidLarkson/Ghana-NLP-Python-Library"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "200e37bc6a0bc897b7a6f1bc583589b9f2ee0bc6b90a63d18551ab2f19de2591",
                "md5": "b7c46699fc42c6c2445991028d3b5bfd",
                "sha256": "65ae8d813a7a1f8603f01bb41f2fd07a9bf2ea1dcadfedf77d472fb0c4067981"
            },
            "downloads": -1,
            "filename": "ghana_nlp-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b7c46699fc42c6c2445991028d3b5bfd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4416,
            "upload_time": "2024-09-25T11:53:32",
            "upload_time_iso_8601": "2024-09-25T11:53:32.041262Z",
            "url": "https://files.pythonhosted.org/packages/20/0e/37bc6a0bc897b7a6f1bc583589b9f2ee0bc6b90a63d18551ab2f19de2591/ghana_nlp-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c8a70e93384008e132277e82b68262520dce9e2148be5fde240617bf743fd80",
                "md5": "6cc68fae97676cba685676873094c58a",
                "sha256": "d723a9b7ba7996c46b32e123e911ed5dbe0e45fba7f410dad6c920cfcf4ed2bf"
            },
            "downloads": -1,
            "filename": "ghana-nlp-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "6cc68fae97676cba685676873094c58a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4605,
            "upload_time": "2024-09-25T11:53:33",
            "upload_time_iso_8601": "2024-09-25T11:53:33.842713Z",
            "url": "https://files.pythonhosted.org/packages/7c/8a/70e93384008e132277e82b68262520dce9e2148be5fde240617bf743fd80/ghana-nlp-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-25 11:53:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PhidLarkson",
    "github_project": "Ghana-NLP-Python-Library",
    "github_not_found": true,
    "lcname": "ghana-nlp"
}
        
Elapsed time: 6.48364s