Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcominerva/translatorservice
A lightweight library that uses Cognitive Translator Service for text translation and Cognitive Speech Service for text-to-speech and speech-to-text
https://github.com/marcominerva/translatorservice
cognitive-services hacktoberfest speech speech-api speech-recognition speech-to-text text-to-speech translation-service translator
Last synced: 16 days ago
JSON representation
A lightweight library that uses Cognitive Translator Service for text translation and Cognitive Speech Service for text-to-speech and speech-to-text
- Host: GitHub
- URL: https://github.com/marcominerva/translatorservice
- Owner: marcominerva
- License: mit
- Created: 2016-09-29T10:12:42.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-09T21:21:50.000Z (4 months ago)
- Last Synced: 2024-10-13T14:24:52.979Z (about 1 month ago)
- Topics: cognitive-services, hacktoberfest, speech, speech-api, speech-recognition, speech-to-text, text-to-speech, translation-service, translator
- Language: C#
- Homepage:
- Size: 753 KB
- Stars: 12
- Watchers: 8
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Translator Service
[![GitHub Super-Linter](https://github.com/marcominerva/TranslatorService/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
A lightweight library that uses Cognitive Translator Service for text translation and Cognitive Speech Service for text-to-speech and speech-to-text.
To use this library, you must register an [All-In-One Cognitive Service](https://portal.azure.com/#create/Microsoft.CognitiveServicesAllInOne) or [Translator Service](https://portal.azure.com/#create/Microsoft.CognitiveServicesTextTranslation) and [Speech Service](https://portal.azure.com/#create/Microsoft.CognitiveServicesSpeechServices) on Azure to obtain the Subscription keys. Keep in mind that Regional endpoints are available, so you need to pass the region name to the library according to your registration.
**Installation**
The library is available on [NuGet](https://www.nuget.org/packages/TranslatorService/). Just search *TranslatorService* in the **Package Manager GUI** or run the following command in the **Package Manager Console**:
Install-Package TranslatorService
**Usage****Translation**
It's usage is straightforward. For example, if you want to translate text:
// Use a Global Translator Service
var translatorClient = new TranslatorClient("");// Use a Regional Translation Service
var translatorClient = new TranslatorClient("", "");
// Use an external HttpClient (i.e. coming from IHttpClientFactory)
var translatorClient = new TranslatorClient(httpClient, "", "");
var response = await translatorClient.TranslateAsync("Today is really a nice day.", to: "it");
Console.WriteLine(
$"Detected source language: {response.DetectedLanguage.Language} ({response.DetectedLanguage.Score:P2})");
Console.WriteLine(response.Translation.Text);**Speech Recognition**
var speechClient = new SpeechClient("", "");
// Use an external HttpClient (i.e. coming from IHttpClientFactory)
var speechClient = new SpeechClient(httpClient, "", "");var response = await speechClient.RecognizeAsync(audioStream, "en-US", RecognitionResultFormat.Detailed);
Console.WriteLine($"Recognition Result: {response.RecognitionStatus}");
Console.WriteLine(response.DisplayText);**Speech Synthesis**
var speechClient = new SpeechClient("", "");
// Use an external HttpClient (i.e. coming from IHttpClientFactory)
var speechClient = new SpeechClient(httpClient, "", "");var responseStream = await speechClient.SpeakAsync(new TextToSpeechParameters
{
Language = "en-US",
VoiceType = Gender.Female,
VoiceName = "en-US-AriaNeural",
Text = "Hello everyone! Today is really a nice day.",
});In the [Samples](https://github.com/marcominerva/TranslatorService/tree/master/Samples) folder are available samples for .NET Core and the Universal Windows Platform.
**Contribute**
The project is continually evolving. We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can.