Skip to main content

Microsoft Bot Builder sangamam Middleware test recognizer

Project description

Translate Middleware

The Translate Middleware library is a use to translate text using cognitive services translator.
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')

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

File details

Details for the file botbuilder-sangamam-cognitive-text-translate-0.3.0.tar.gz.

File metadata

File hashes

Hashes for botbuilder-sangamam-cognitive-text-translate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 bf2682e42e43bbfcf67fd6560c7849ab1c0d56507d9d7ac703f310bfc9fa6158
MD5 e4846de7ca30eabaa1e8e7d9052b2dad
BLAKE2b-256 72ee9a2adfc7ffaa77d2adc61551320af0efdfa58a505da7501c1735466583b0

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