Metadata-Version: 2.1
Name: botbuilder-sangamam-cognitive-text-translate
Version: 0.3.0
Summary: Microsoft Bot Builder sangamam Middleware test recognizer
Home-page: https://github.com/rvinothrajendran
Author: Bot Builder sangamam
Author-email: r.vinoth@live.com
License: MIT
Keywords: botbuilder bots ai botframework middleware text translate
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.8
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 3 - Alpha
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Description-Content-Type: text/markdown

# Translate Middleware

The Translate Middleware library is a use to translate text using cognitive services translator.<BR>
Cognitive Services Translator is a cloud-based machine translation service you can to translate text in with a simple REST API call

## Installing

    pip install botbuilder-sangamam-cognitive-text-translate

## Usage

All middleware is created and used in the same way. For example, import the `TranslateMiddleware` class from the package, and add it to your bot adapter:

    from botbuilder.sangamam.cognitive.text.translate import TranslateMiddleware , TranslateSettings

    translate_settings = TranslateSettings()
    translate_settings.subscription_key = ''
    translate_settings.from_lang = 'en'
    translate_settings.to_lang = ['de','it','ta']
    translate_settings.subscription_region = ''

    adapter.use(TranslateMiddleware(translate_settings));

When used, the `turn_state` on the `TurnContext` will have a property named `translate_response`, which will be an return an TranslateResponse object.

Supported middleware classes include:

| Class | Property/Properties on `turn_state` |
| ---- | ----------- |
| `TranslateMiddleware` | `context.turn_state.get("translate_response")` |

# TranslateService
TranslateService is use to translate text using cognitive services translator without Middleware.
    
    from botbuilder.sangamam.cognitive.text.translate import TranslateService , TranslateSettings ,TranslateResponse

    translate_settings = TranslateSettings()
    translate_settings.subscription_key = ''
    translate_settings.from_lang = 'en'
    translate_settings.to_lang = ['de','it','ta']
    translate_settings.subscription_region = ''
    
    
    //call the translate service 
    
    service = TranslateService(translate_settings)
    response = service.translate_text('hello')
    


