Metadata-Version: 2.1
Name: faster_translate
Version: 0.1.2
Summary: A simple translation utility using Hugging Face models.
Author-email: Sawradip Saha <sawradip0@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Sawradip Saha
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Keywords: translation,huggingface,nlp
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: huggingface_hub>=0.0.12
Requires-Dist: ctranslate2>=4.1.0
Requires-Dist: tokenizers>=0.15.2


# Faster Translate

Faster Translate is a high-performance translation library built on top of ctranslate2 and designed for fast and efficient translation. It provides an easy-to-use interface for translating text in various languages with support for pre-trained models from Hugging Face's model hub.

## Features

- High-speed translation leveraging ctranslate2
- Support for loading models directly from Hugging Face's model hub


## Installation

To install Faster Translate, you can use pip:

```
pip install faster-translate
```

## Usage:

Initialize with supported model name:

```
from faster_translate import TranslateModel

model = TranslateModel.from_pretrained("banglanmt_bn2en")
```

Or, `ct2` converted models, local or from huggingfcae hub:
```
from faster_translate import TranslateModel

model = TranslateModel.from_pretrained(
    "sawradip/faster-translate-banglanmt-bn2en-t5",
    normalizer_func = "buetnlpnormalizer"
                                       )

```

You can translate a single sentence:
```
model.translate_single("দেশে বিদেশি ঋণ নিয়ে এখন বেশ আলোচনা হচ্ছে। এই ঋণ পরিশোধের চাপ ধীরে ধীরে বাড়ছে। গত ২০২২-২৩ অর্থবছরে মোট ২৬৭ কোটি ডলারের ঋণ পরিশোধ করতে হয়েছে। আগামী সাত বছরে ঋণ পরিশোধের পরিমাণ বেড়ে দ্বিগুণ হবে বলে মনে করছে অর্থনৈতিক সম্পর্ক বিভাগ (ইআরডি)।")
```

Or a batch:
```
model.translate_batch([
    "দেশে বিদেশি ঋণ নিয়ে এখন বেশ আলোচনা হচ্ছে। এই ঋণ পরিশোধের চাপ ধীরে ধীরে বাড়ছে। গত ২০২২-২৩ অর্থবছরে মোট ২৬৭ কোটি ডলারের ঋণ পরিশোধ করতে হয়েছে। আগামী সাত বছরে ঋণ পরিশোধের পরিমাণ বেড়ে দ্বিগুণ হবে বলে মনে করছে অর্থনৈতিক সম্পর্ক বিভাগ (ইআরডি)।",
    "রাত তিনটার দিকে কাঁচামাল নিয়ে গুলিস্তান থেকে পুরান ঢাকার শ্যামবাজারের আড়তে যাচ্ছিলেন লিটন ব্যাপারী। "
    ])
```

### Currently Supported Models
* [BanglaNMT(BUET)](https://github.com/csebuetnlp/banglanmt) -> (Bangla -> English) - `banglanmt_bn2en`
* [BanglaNMT(BUET)](https://github.com/csebuetnlp/banglanmt) -> (English -> Bangla) - `banglanmt_en2bn`

### Features to be supported:
* Model comversion Scripts
* Direct HF dataset translation





