Skip to content

Commit

Permalink
Translator Text API V3 (#5230)
Browse files Browse the repository at this point in the history
* Translator Text API V3

* Fix path and override

* Fix a typo and few other improvements in descriptions.

* Remove after_scripts

* Update readme.md

* Update readme.md
  • Loading branch information
yangyuan authored and sarangan12 committed Feb 28, 2019
1 parent 5305cfa commit d2fc42e
Show file tree
Hide file tree
Showing 9 changed files with 1,546 additions and 0 deletions.
130 changes: 130 additions & 0 deletions specification/cognitiveservices/data-plane/TranslatorText/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Cognitive Services Translator Text SDK

> see https://aka.ms/autorest
Configuration for generating Translator Text SDK.

The current release is `release_3_0`.

``` yaml

tag: release_3_0
add-credentials: true
openapi-type: data-plane
```
# Releases
### Release 3.0
These settings apply only when `--tag=release_3_0` is specified on the command line.

``` yaml $(tag) == 'release_3_0'
input-file: stable/v3.0/TranslatorText.json
```

## Swagger to SDK

This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.

``` yaml $(swagger-to-sdk)
swagger-to-sdk:
- repo: azure-sdk-for-python
- repo: azure-sdk-for-java
- repo: azure-sdk-for-go
- repo: azure-sdk-for-nodejs
```

## CSharp Settings
These settings apply only when `--csharp` is specified on the command line.
``` yaml $(csharp)
csharp:
sync-methods: None
license-header: MICROSOFT_MIT_NO_VERSION
azure-arm: false
namespace: Microsoft.Azure.CognitiveServices.TranslatorText
output-folder: $(csharp-sdks-folder)/CognitiveServices/dataPlane/TranslatorText/TranslatorText/Generated
clear-output-folder: true
```

## Python

These settings apply only when `--python` is specified on the command line.
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
Use `--python-mode=update` if you already have a setup.py and just want to update the code itself.

``` yaml $(python)
python-mode: create
python:
license-header: MICROSOFT_MIT_NO_VERSION
add-credentials: true
payload-flattening-threshold: 2
namespace: azure.cognitiveservices.translatortext
package-name: azure-cognitiveservices-translatortext
clear-output-folder: true
```
``` yaml $(python) && $(python-mode) == 'update'
python:
no-namespace-folders: true
output-folder: $(python-sdks-folder)/azure-cognitiveservices-translatortext/azure/cognitiveservices/translatortext
```
``` yaml $(python) && $(python-mode) == 'create'
python:
basic-setup-py: true
output-folder: $(python-sdks-folder)/azure-cognitiveservices-translatortext
```

## Go

These settings apply only when `--go` is specified on the command line.

``` yaml $(go)
go:
license-header: MICROSOFT_APACHE_NO_VERSION
namespace: translatortext
clear-output-folder: true
```

### Go multi-api

``` yaml $(go) && $(multiapi)
batch:
- tag: release_3_0
```

### Tag: release_3_0 and go

These settings apply only when `--tag=release_3_0 --go` is specified on the command line.
Please also specify `--go-sdk-folder=<path to the root directory of your azure-sdk-for-go clone>`.

``` yaml $(tag) == 'release_3_0' && $(go)
output-folder: $(go-sdk-folder)/services/cognitiveservices/v3.0/$(namespace)
```
## Java

These settings apply only when `--java` is specified on the command line.
Please also specify `--azure-libraries-for-java-folder=<path to the root directory of your azure-libraries-for-java clone>`.

``` yaml $(java)
java:
azure-arm: true
namespace: com.microsoft.azure.cognitiveservices.translatortext
license-header: MICROSOFT_MIT_NO_CODEGEN
payload-flattening-threshold: 1
output-folder: $(azure-libraries-for-java-folder)/cognitiveservices/data-plane/translatortext
with-optional-parameters: true
with-single-async-method: true
```

## Node.js

``` yaml $(nodejs)
nodejs:
package-name: azure-cognitiveservices-newssearch
package-version: 3.0.0
output-folder: $(node-sdks-folder)/lib/services/translatorText
azure-arm: false
generate-license-txt: true
generate-package-json: true
generate-readme-md: false
```

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"parameters": {
"Ocp-Apim-Subscription-Key": "{API key}",
"Endpoint": "https://api.cognitive.microsofttranslator.com",
"api-version": "3.0",
"language": "en",
"text": [
{
"text": "How are you? I am fine. What did you do today?"
}
]
},
"responses": {
"200": {
"headers": {
},"body":
[
{
"sentLen": [
13,
11,
22
]
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"parameters": {
"Ocp-Apim-Subscription-Key": "{API key}",
"Endpoint": "https://api.cognitive.microsofttranslator.com",
"api-version": "3.0",
"text": [
{
"text": "I would really like to drive your car."
}
]
},
"responses": {
"200": {
"headers": {
},"body":
[
{
"language":"en",
"score":1.0,
"isTranslationSupported":true,
"isTransliterationSupported":false,
"alternatives":[
{
"language":"fil",
"score":1.0,
"isTranslationSupported":true,
"isTransliterationSupported":false
},
{
"language":"nb",
"score":1.0,
"isTranslationSupported":true,
"isTransliterationSupported":false
}
]
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"parameters": {
"Ocp-Apim-Subscription-Key": "{API key}",
"Endpoint": "https://api.cognitive.microsofttranslator.com",
"api-version": "3.0",
"from": "en",
"to": "es",
"text": [
{
"text": "bug",
"translation": "bicho"
}
]
},
"responses": {
"200": {
"headers": {
},"body":
[
{
"normalizedSource": "bug",
"normalizedTarget": "bicho",
"examples": [
{
"sourcePrefix": "You feel like a ",
"sourceTerm": "bug",
"sourceSuffix": ".",
"targetPrefix": "Te sientes como un ",
"targetTerm": "bicho",
"targetSuffix": "."
},
{
"sourcePrefix": "Not to mention your friend the ",
"sourceTerm": "bug",
"sourceSuffix": ".",
"targetPrefix": "Aparte de tu amigo, el ",
"targetTerm": "bicho",
"targetSuffix": "."
},
{
"sourcePrefix": "Get on the magic ",
"sourceTerm": "bug",
"sourceSuffix": ".",
"targetPrefix": "Suban al ",
"targetTerm": "bicho",
"targetSuffix": " mágico."
},
{
"sourcePrefix": "Because this ",
"sourceTerm": "bug",
"sourceSuffix": " is not an insect.",
"targetPrefix": "Porque este ",
"targetTerm": "bicho",
"targetSuffix": " no es un insecto."
},
{
"sourcePrefix": "I still taste that ",
"sourceTerm": "bug",
"sourceSuffix": ".",
"targetPrefix": "Aún tengo el sabor de ese ",
"targetTerm": "bicho",
"targetSuffix": "."
}
]
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"parameters": {
"Ocp-Apim-Subscription-Key": "{API key}",
"Endpoint": "https://api.cognitive.microsofttranslator.com",
"api-version": "3.0",
"from": "en",
"to": "es",
"text": [
{
"text": "bug"
}
]
},
"responses": {
"200": {
"headers": {
},"body":
[
{
"normalizedSource": "bug",
"displaySource": "bug",
"translations": [
{
"normalizedTarget": "bicho",
"displayTarget": "bicho",
"posTag": "NOUN",
"confidence": 0.2405,
"prefixWord": "",
"backTranslations": [
{
"normalizedText": "bug",
"displayText": "bug",
"numExamples": 15,
"frequencyCount": 315
},
{
"normalizedText": "critter",
"displayText": "critter",
"numExamples": 5,
"frequencyCount": 27
},
{
"normalizedText": "varmint",
"displayText": "varmint",
"numExamples": 1,
"frequencyCount": 4
}
]
}
]
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"parameters": {
"Ocp-Apim-Subscription-Key": "{API key}",
"Endpoint": "https://api.cognitive.microsofttranslator.com",
"api-version": "3.0",
"scope": "translation"
},
"responses": {
"200": {
"headers": {
},"body":
{
"translation":{
"af":{
"name":"Afrikaan",
"nativeName":"Afrikaans",
"dir":"ltr"
},
"ar":{
"name":"Arabic",
"nativeName":"العربية",
"dir":"rtl"
},
"ja":{
"name":"Japanese",
"nativeName":"日本語",
"dir":"ltr"
},
"ko":{
"name":"Korean",
"nativeName":"한국어",
"dir":"ltr"
},
"th":{
"name":"Thai",
"nativeName":"ไทย",
"dir":"ltr"
},
"zh-Hans":{
"name":"Chinese Simplified",
"nativeName":"简体中文",
"dir":"ltr"
},
"zh-Hant":{
"name":"Chinese Traditional",
"nativeName":"繁體中文",
"dir":"ltr"
}
}
}
}
}
}
Loading

0 comments on commit d2fc42e

Please sign in to comment.