Skip to content

Commit f729844

Browse files
authored
Merge pull request #110600 from swmachan/master
Updated alignment and dynamic dictionary sections
2 parents cd32bc8 + 645a871 commit f729844

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

articles/azure-government/documentation-government-cognitiveservices.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,10 @@ For more information, please see [public documentation](../cognitive-services/Fa
624624
### Variations
625625
* The URI for accessing the Text Translation API in Azure Government is:
626626
- `https://api.cognitive.microsofttranslator.us`
627+
* [Virtual Network support](../cognitive-services/cognitive-services-virtual-networks.md) for Translator service is limited to only `US Gov Virginia` region.
628+
The URI for accessing the API is:
629+
- `https://<your-custom-domain>.cognitiveservices.azure.us/translator/text/v3.0`
630+
- You can find your custom domain endpoint in the overview blade on the Azure portal once the resource is created.
627631
* There are 2 regions `USGovVirginia` and `USGovArizona`
628632
### Text Translation Method
629633
The below example uses [Text Translation - Translate method](../cognitive-services/translator/reference/v3-0-translate.md) to translate a string of text from a language into another specified language. There are multiple [language codes](https://api.cognitive.microsofttranslator.com/languages?api-version=3.0&scope=translation) that can be used with the Text Translation API.
@@ -634,10 +638,11 @@ The sample is written in C#.
634638

635639
1. Create a new Console solution in Visual Studio.
636640
2. Replace Program.cs with the corresponding code below.
637-
3. Replace the `subscriptionKey` value with the key value that you retrieved above.
638-
4. Replace the `region` value with the region value where you created your translator resource.
639-
5. Replace the `text` value with text that you want to translate.
640-
6. Run the program.
641+
3. Replace the `endpoint` value with the URI as explained in the `Variations` section.
642+
4. Replace the `subscriptionKey` value with the key value that you retrieved above.
643+
5. Replace the `region` value with the region value where you created your translator resource.
644+
6. Replace the `text` value with text that you want to translate.
645+
7. Run the program.
641646

642647
You can also test out different languages and texts by replacing the "text", "from", and "to" variables in Program.cs.
643648

@@ -659,7 +664,7 @@ namespace TextTranslator
659664
{
660665
class Program
661666
{
662-
static string host = "https://api.cognitive.microsofttranslator.us";
667+
static string host = "PASTE ENDPOINT HERE";
663668
static string path = "/translate?api-version=3.0";
664669
// Translate to German.
665670
static string params_ = "&to=de";

articles/cognitive-services/Translator/reference/v3-0-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: translator-text
1010
ms.topic: reference
11-
ms.date: 4/2/2020
11+
ms.date: 4/17/2020
1212
ms.author: swmachan
1313
---
1414

@@ -142,7 +142,7 @@ An authentication token is valid for 10 minutes. The token should be reused when
142142

143143
## Virtual Network support
144144

145-
Translator service is now available with Virtual Network capabilities in limited regions (`WestUS2`, `EastUS`, `SouthCentralUS`, `WestUS`, `Central US EUAP`, `global`). To enable Virtual Network, please see [Configuring Azure Cognitive Services Virtual Networks](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-virtual-networks?tabs=portal).
145+
Translator service is now available with Virtual Network capabilities in limited regions (`WestUS2`, `EastUS`, `SouthCentralUS`, `WestUS`, `CentralUSEUAP`, `global`). To enable Virtual Network, please see [Configuring Azure Cognitive Services Virtual Networks](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-virtual-networks?tabs=portal).
146146

147147
Once you turn on this capability, you must use the custom endpoint to call the Translator API. You cannot use the global translator endpoint ("api.cognitive.microsofttranslator.com") and you cannot authenticate with an access token.
148148

articles/cognitive-services/Translator/reference/v3-0-translate.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: translator-text
1111
ms.topic: reference
12-
ms.date: 03/20/2020
12+
ms.date: 04/17/2020
1313
ms.author: swmachan
1414
---
1515

@@ -450,6 +450,14 @@ The response is:
450450

451451
### Obtain alignment information
452452

453+
Alignment is returned as a string value of the following format for every word of the source. The information for each word is separated by a space, including for non-space-separated languages (scripts) like Chinese:
454+
455+
[[SourceTextStartIndex]:[SourceTextEndIndex][TgtTextStartIndex]:[TgtTextEndIndex]] *
456+
457+
Example alignment string: "0:0-7:10 1:2-11:20 3:4-0:3 3:4-4:6 5:5-21:21".
458+
459+
In other words, the colon separates start and end index, the dash separates the languages, and space separates the words. One word may align with zero, one, or multiple words in the other language, and the aligned words may be non-contiguous. When no alignment information is available, the Alignment element will be empty. The method returns no error in that case.
460+
453461
To receive alignment information, specify `includeAlignment=true` on the query string.
454462

455463
```curl
@@ -479,9 +487,10 @@ Obtaining alignment information is an experimental feature that we have enabled
479487

480488
* Alignment is not available for text in HTML format i.e., textType=html
481489
* Alignment is only returned for a subset of the language pairs:
482-
- from English to any other language;
483-
- from any other language to English except for Chinese Simplified, Chinese Traditional, and Latvian to English;
490+
- English to/from any other language except Chinese Traditional, Cantonese (Traditional) or Serbian (Cyrillic).
484491
- from Japanese to Korean or from Korean to Japanese.
492+
- from Japanese to Chinese Simplified and Chinese Simplified to Japanese.
493+
- from Chinese Simplified to Chinese Traditional and Chinese Traditional to Chinese Simplified.
485494
* You will not receive alignment if the sentence is a canned translation. Example of a canned translation is "This is a test", "I love you" and other high frequency sentences.
486495
* Alignment is not available when you apply any of the approaches to prevent translation as described [here](../prevent-translation.md)
487496

@@ -511,7 +520,7 @@ The response is:
511520

512521
### Translate with dynamic dictionary
513522

514-
If you already know the translation you want to apply to a word or a phrase, you can supply it as markup within the request. The dynamic dictionary is only safe for compound nouns like proper names and product names.
523+
If you already know the translation you want to apply to a word or a phrase, you can supply it as markup within the request. The dynamic dictionary is only safe for proper nouns such as personal names and product names.
515524

516525
The markup to supply uses the following syntax.
517526

0 commit comments

Comments
 (0)