Skip to content

Commit

Permalink
Translate Automl samples (#131)
Browse files Browse the repository at this point in the history
* initial translation commit

* readme fix - check cloud link

* first round style fixes

* style fix 2

* Thanks Ace!

* template path fix

* Fix ENV variable for project Id (GCLOUD_PROJECT)

* Translate AutoML samples

* fixing lint issues

* re-trigger tests
  • Loading branch information
nirupa-kumar authored Sep 27, 2018
1 parent f07d245 commit 757cad7
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
139 changes: 139 additions & 0 deletions packages/google-cloud-translate/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,142 @@ For more information, see https://cloud.google.com/translate/docs

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md

### automlTranslationDataset

View the [source code][automlTranslationDataset_code].

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/automl/automlTranslationDataset.js,samples/README.md)

__Usage:__ `node automlTranslationDataset.js --help`

```
automlTranslationDataset.js <command>
Commands:
automlTranslationDataset.js create-dataset creates a new Dataset
automlTranslationDataset.js list-datasets list all Datasets
automlTranslationDataset.js get-dataset Get a Dataset
automlTranslationDataset.js delete-dataset Delete a dataset
automlTranslationDataset.js import-data Import labeled items into dataset
Options:
--version Show version number [boolean]
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
--datasetName, -n Name of the Dataset [string] [default: "testDataSet"]
--datasetId, -i Id of the dataset [string]
--filter, -f Name of the Dataset to search for [string] [default: "translationDatasetMetadata:*"]
--multilabel, -m Type of the classification problem, False - MULTICLASS, True - MULTILABEL.
[string] [default: false]
--outputUri, -o URI (or local path) to export dataset [string]
--path, -p URI or local path to input .csv, or array of .csv paths
[string] [default: "gs://nodejs-docs-samples-vcm/en-ja.csv"]
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "nodejs-docs-samples"]
--source, -s The source language to be translated from [string]
--target, -t The target language to be translated to [string]
--help Show help [boolean]
Examples:
node automlTranslationDataset.js create-dataset -n "newDataSet" -s "en" -t "ja"
node automlTranslationDataset.js list-datasets -f "translationDatasetMetadata:*"
node automlTranslationDataset.js get-dataset -i "DATASETID"
node automlTranslationDataset.js delete-dataset -i "DATASETID"
node automlTranslationDataset.js import-data -i "dataSetId" -p "gs://myproject/mytraindata.csv"
For more information, see https://cloud.google.com/translate/docs
```

[automlTranslationDataset_docs]: https://cloud.google.com/translate/docs
[automlTranslationDataset_code]: automl/automlTranslationDataset.js

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md

### automlTranslationModel

View the [source code][automlTranslationModel_code].

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/automl/automlTranslationModel.js,samples/README.md)

__Usage:__ `node translate.js --help`

```
automlTranslationModel.js <command>
Commands:
automlTranslationModel.js create-model creates a new Model
automlTranslationModel.js get-operation-status Gets status of current operation
automlTranslationModel.js list-models list all Models
automlTranslationModel.js get-model Get a Model
automlTranslationModel.js list-model-evaluations List model evaluations
automlTranslationModel.js get-model-evaluation Get model evaluation
automlTranslationModel.js delete-model Delete a Model
Options:
--version Show version number [boolean]
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
--datasetId, -i Id of the dataset [string]
--filter, -f Name of the Dataset to search for [string] [default: ""]
--modelName, -m Name of the model [string] [default: false]
--modelId, -a Id of the model [string] [default: ""]
--modelEvaluationId, -e Id of the model evaluation [string] [default: ""]
--operationFullId, -o Full name of an operation [string] [default: ""]
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "nodejs-docs-samples"]
--help Show help [boolean]
Examples:
node automlTranslationModel.js create-model -i "DatasetID" -m "myModelName"
node automlTranslationModel.js get-operation-status -i "datasetId" -o "OperationFullID"
node automlTranslationModel.js list-models -f "translationModelMetadata:*"
node automlTranslationModel.js get-model -a "ModelID"
node automlTranslationModel.js list-model-evaluations -a "ModelID"
node automlTranslationModel.js get-model-evaluation -a "ModelId" -e "ModelEvaluationID"
node automlTranslationModel.js delete-model -a "ModelID"
For more information, see https://cloud.google.com/translate/docs
```

[automlTranslationModel_docs]: https://cloud.google.com/translate/docs
[automlTranslationModel_code]: automl/automlTranslationModel.js

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md

### automlTranslationPredict

View the [source code][automlTranslationPredict_code].

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/automl/automlTranslationPredict.js,samples/README.md)

__Usage:__ `node translate.js --help`

```
automlTranslationPredict.js <command>
Commands:
automlTranslationPredict.js predict classify the content
Options:
--version Show version number [boolean]
--computeRegion, -c region name e.g. "us-central1" [string] [default: "us-central1"]
--filePath, -f local text file path of the content to be classified
[string] [default: "./resources/testInput.txt"]
--modelId, -i Id of the model which will be used for text classification [string]
--projectId, -z The GCLOUD_PROJECT string, e.g. "my-gcloud-project" [number] [default: "203278707824"]
--translationAllowFallback, -t Use true if AutoML will fallback to use a Google translation model fortranslation
requests if the specified AutoML translation model cannotserve the request. Use false
to not use Google translation model. [string] [default: "False"]
--help Show help [boolean]
Examples:
node automlTranslationPredict.js predict -i "modelId" -f "./resources/testInput.txt" -t "False"
For more information, see https://cloud.google.com/translate/docs
```

[automlTranslationPredict_docs]: https://cloud.google.com/translate/docs
[automlTranslationPredict_code]: automl/automlTranslationPredict.js

[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-translate&page=editor&open_in_editor=samples/README.md

2 changes: 2 additions & 0 deletions packages/google-cloud-translate/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
},
"dependencies": {
"@google-cloud/translate": "^2.1.2",
"@google-cloud/automl": "^0.1.1",
"mathjs": "^5.1.0",
"yargs": "^12.0.1"
},
"devDependencies": {
Expand Down

0 comments on commit 757cad7

Please sign in to comment.