From cc28abec9884fa0b2ace2a87378269f2c275dd84 Mon Sep 17 00:00:00 2001 From: Dave Gramlich Date: Tue, 28 Mar 2017 13:14:18 -0400 Subject: [PATCH 1/3] datastore: fix broken links logging: fix broken links storage: fix broken links --- packages/datastore/src/query.js | 12 ++++++------ packages/logging/src/entry.js | 6 +++--- packages/logging/src/index.js | 18 +++++++++--------- packages/logging/src/log.js | 12 ++++++------ packages/logging/src/sink.js | 14 +++++++------- packages/storage/src/bucket.js | 8 ++++---- packages/storage/src/file.js | 10 +++++----- packages/storage/src/index.js | 2 +- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/packages/datastore/src/query.js b/packages/datastore/src/query.js index 49fc312d1c8..e09bf934e89 100644 --- a/packages/datastore/src/query.js +++ b/packages/datastore/src/query.js @@ -74,7 +74,7 @@ function Query(scope, namespace, kinds) { * * *To filter by ancestors, see {module:datastore/query#hasAncestor}.* * - * @resource [Datastore Filters]{@link https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Filters} + * @resource [Datastore Filters]{@link https://cloud.google.com/datastore/docs/concepts/queries#datastore-property-filter-nodejs} * * @param {string} property - The field name. * @param {string=} operator - Operator (=, <, >, <=, >=). Default: `=` @@ -119,7 +119,7 @@ Query.prototype.filter = function(property, operator, value) { /** * Filter a query by ancestors. * - * @resource [Datastore Ancestor Filters]{@link https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Ancestor_filters} + * @resource [Datastore Ancestor Filters]{@link https://cloud.google.com/datastore/docs/concepts/queries#datastore-ancestor-query-nodejs} * * @param {Key} key - Key object to filter by. * @return {module:datastore/query} @@ -136,7 +136,7 @@ Query.prototype.hasAncestor = function(key) { * Sort the results by a property name in ascending or descending order. By * default, an ascending sort order will be used. * - * @resource [Datastore Sort Orders]{@link https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Sort_orders} + * @resource [Datastore Sort Orders]{@link https://cloud.google.com/datastore/docs/concepts/queries#datastore-ascending-sort-nodejs} * * @param {string} property - The property to order by. * @param {object=} options - Options object. @@ -200,7 +200,7 @@ Query.prototype.select = function(fieldNames) { /** * Set a starting cursor to a query. * - * @resource [Query Cursors]{@link https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Query_cursors} + * @resource [Query Cursors]{@link https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets} * * @param {string} cursorToken - The starting cursor token. * @return {module:datastore/query} @@ -238,7 +238,7 @@ Query.prototype.end = function(end) { /** * Set a limit on a query. * - * @resource [Query Limits]{@link https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Retrieving_results} + * @resource [Query Limits]{@link https://cloud.google.com/datastore/docs/concepts/queries#datastore-limit-nodejs} * * @param {number} n - The number of results to limit the query to. * @return {module:datastore/query} @@ -255,7 +255,7 @@ Query.prototype.limit = function(n) { /** * Set an offset on a query. * - * @resource [Query Offsets]{@link https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Retrieving_results} + * @resource [Query Offsets]{@link https://cloud.google.com/datastore/docs/concepts/queries#datastore-limit-nodejs} * * @param {number} n - The offset to start from after the start cursor. * @return {module:datastore/query} diff --git a/packages/logging/src/entry.js b/packages/logging/src/entry.js index 498a97bd71b..a494ff5a7a7 100644 --- a/packages/logging/src/entry.js +++ b/packages/logging/src/entry.js @@ -30,13 +30,13 @@ var eventId = new EventId(); /** * Create an entry object to define new data to insert into a log. * - * @resource [LogEntry JSON representation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/LogEntry} + * @resource [LogEntry JSON representation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry} * * @alias module:logging/entry * @constructor * * @param {object=} metadata - See a - * [LogEntry Resource](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/LogEntry). + * [LogEntry Resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry). * @param {object|string} data - The data to use as the value for this log * entry. * @@ -109,7 +109,7 @@ function Entry(metadata, data) { * @private * * @param {object} entry - An API representation of an entry. See a - * [LogEntry](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/LogEntry). + * [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry). * @return {module:logging/entry} */ Entry.fromApiResponse_ = function(entry) { diff --git a/packages/logging/src/index.js b/packages/logging/src/index.js index 83bbf2f10ba..8e669785c29 100644 --- a/packages/logging/src/index.js +++ b/packages/logging/src/index.js @@ -90,16 +90,16 @@ util.inherits(Logging, commonGrpc.Service); /** * Create a sink. * - * @resource [Sink Overview]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks} + * @resource [Sink Overview]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks} * @resource [Advanced Logs Filters]{@link https://cloud.google.com/logging/docs/view/advanced_filters} - * @resource [projects.sinks.create API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks/create} + * @resource [projects.sinks.create API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create} * * @throws {Error} if a name is not provided. * @throws {Error} if a config object is not provided. * * @param {string} name - Name of the sink. * @param {object} config - See a - * [Sink resource](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks#LogSink). + * [Sink resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogSink). * @param {module:storage/bucket|module:bigquery/dataset|module:pubsub/topic} config.destination - * The destination. The proper ACL scopes will be granted to the provided * destination. @@ -191,10 +191,10 @@ Logging.prototype.createSink = function(name, config, callback) { * use the object returned in other API calls, such as * {module:logging/log#write}. * - * @resource [LogEntry JSON representation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/LogEntry} + * @resource [LogEntry JSON representation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry} * * @param {object=|string=} resource - See a - * [Monitored Resource](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/MonitoredResource). + * [Monitored Resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource). * @param {object|string} data - The data to use as the value for this log * entry. * @return {module:logging/entry} @@ -233,7 +233,7 @@ Logging.prototype.entry = function(resource, data) { /** * List the entries in your logs. * - * @resource [entries.list API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/entries/list} + * @resource [entries.list API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list} * * @param {object=} options - Filtering options. * @param {boolean} options.autoPaginate - Have pagination handled @@ -352,7 +352,7 @@ Logging.prototype.getEntriesStream = common.paginator.streamify('getEntries'); /** * Get the sinks associated with this project. * - * @resource [projects.sinks.list API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks/list} + * @resource [projects.sinks.list API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/list} * * @param {object=} options - Configuration object. * @param {boolean} options.autoPaginate - Have pagination handled @@ -449,7 +449,7 @@ Logging.prototype.getSinksStream = common.paginator.streamify('getSinks'); /** * Get a reference to a Stackdriver Logging log. * - * @resource [Log Overview]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.logs} + * @resource [Log Overview]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs} * * @param {string} name - Name of the existing log. * @param {object=} options - Configuration object. @@ -467,7 +467,7 @@ Logging.prototype.log = function(name, options) { /** * Get a reference to a Stackdriver Logging sink. * - * @resource [Sink Overview]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks} + * @resource [Sink Overview]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks} * * @param {string} name - Name of the existing sink. * @return {module:logging/sink} diff --git a/packages/logging/src/log.js b/packages/logging/src/log.js index 00137e324d2..aab982658f9 100644 --- a/packages/logging/src/log.js +++ b/packages/logging/src/log.js @@ -51,7 +51,7 @@ var Metadata = require('./metadata.js'); * produced by the Apache Web Server, but the log * `compute.googleapis.com/activity_log` is produced by Google Compute Engine. * - * @resource [Introduction to Logs]{@link https://cloud.google.com/logging/docs/api/#logs} + * @resource [Introduction to Logs]{@link https://cloud.google.com/logging/docs/basic-concepts#logs} * * @alias module:logging/log * @constructor @@ -77,7 +77,7 @@ function Log(logging, name, options) { /** * Delete the log. * - * @resource [projects.logs.delete API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.logs/delete} + * @resource [projects.logs.delete API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete} * * @param {function=} callback - The callback function. * @param {?error} callback.err - An error returned while making this @@ -263,10 +263,10 @@ Log.prototype.emergency = function(entry, options, callback) { * use the object returned in other API calls, such as * {module:logging/log#write}. * - * @resource [LogEntry JSON representation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/LogEntry} + * @resource [LogEntry JSON representation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry} * * @param {object=} metadata - See a - * [LogEntry Resource](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/LogEntry). + * [LogEntry Resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry). * @param {object|string} data - The data to use as the value for this log * entry. * @return {module:logging/entry} @@ -342,7 +342,7 @@ Log.prototype.error = function(entry, options, callback) { * This method is a wrapper around {module:logging#getEntries}, but with a * filter specified to only return entries from this log. * - * @resource [entries.list API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/entries/list} + * @resource [entries.list API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list} * * @param {object=} options - Filtering options. * @param {boolean} options.autoPaginate - Have pagination handled @@ -518,7 +518,7 @@ Log.prototype.warning = function(entry, options, callback) { * While you may write a single entry at a time, batching multiple entries * together is preferred to avoid reaching the queries per second limit. * - * @resource [entries.write API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/entries/write} + * @resource [entries.write API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write} * * @param {module:logging/entry|module:logging/entry[]} entry - A log entry, or * array of entries, to write. diff --git a/packages/logging/src/sink.js b/packages/logging/src/sink.js index 71f30f8b1b0..25ace550247 100644 --- a/packages/logging/src/sink.js +++ b/packages/logging/src/sink.js @@ -36,7 +36,7 @@ var util = require('util'); * storage), Google BigQuery datasets (for log analysis), Google Pub/Sub (for * streaming to other applications). * - * @resource [Introduction to Sinks]{@link https://cloud.google.com/logging/docs/api/#sinks} + * @resource [Introduction to Sinks]{@link https://cloud.google.com/logging/docs/basic-concepts#sinks} * * @alias module:logging/sink * @constructor @@ -82,7 +82,7 @@ function Sink(logging, name) { /** * Delete the sink. * - * @resource [projects.sink.delete API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks/delete} + * @resource [projects.sink.delete API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete} * * @param {function=} callback - The callback function. * @param {?error} callback.err - An error returned while making this @@ -116,8 +116,8 @@ function Sink(logging, name) { /** * Get the sink's metadata. * - * @resource [Sink Resource]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks#LogSink} - * @resource [projects.sink.get API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks/get} + * @resource [Sink Resource]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogSink} + * @resource [projects.sink.get API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get} * * @param {function=} callback - The callback function. * @param {?error} callback.err - An error returned while making this @@ -192,11 +192,11 @@ Sink.prototype.setFilter = function(filter, callback) { /** * Set the sink's metadata. * - * @resource [Sink Resource]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks#LogSink} - * @resource [projects.sink.update API Documentation]{@link https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks/update} + * @resource [Sink Resource]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogSink} + * @resource [projects.sink.update API Documentation]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update} * * @param {object} metadata - See a - * [Sink resource](https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks#LogSink). + * [Sink resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogSink). * @param {function=} callback - The callback function. * @param {?error} callback.err - An error returned while making this * request. diff --git a/packages/storage/src/bucket.js b/packages/storage/src/bucket.js index 64a50bcfd56..be862e2b433 100644 --- a/packages/storage/src/bucket.js +++ b/packages/storage/src/bucket.js @@ -256,14 +256,14 @@ function Bucket(storage, name) { * the ACLs defined on your bucket, as well as set, update, and delete them. * * Buckets also have - * [default ACLs](https://cloud.google.com/storage/docs/accesscontrol#default) + * [default ACLs](https://cloud.google.com/storage/docs/access-control/lists#default) * for all created files. Default ACLs specify permissions that all new * objects added to the bucket will inherit by default. You can add, delete, * get, and update entities and permissions for these as well with * {module:storage/bucket#acl.default}. * * @resource [About Access Control Lists]{@link http://goo.gl/6qBBPO} - * @resource [Default ACLs]{@link https://cloud.google.com/storage/docs/accesscontrol#default} + * @resource [Default ACLs]{@link https://cloud.google.com/storage/docs/access-control/lists#default} * * @mixes module:storage/acl * @@ -294,8 +294,8 @@ function Bucket(storage, name) { }); /** - * Cloud Storage Buckets have [default ACLs](http://goo.gl/YpGdyv) for - * all created files. You can add, delete, get, and update entities and + * Cloud Storage Buckets have [default ACLs](https://cloud.google.com/storage/docs/access-control/lists#default) + * for all created files. You can add, delete, get, and update entities and * permissions for these as well. The method signatures and examples are all * the same, after only prefixing the method call with `default`. * diff --git a/packages/storage/src/file.js b/packages/storage/src/file.js index 35d49cb7051..55a5a29e69c 100644 --- a/packages/storage/src/file.js +++ b/packages/storage/src/file.js @@ -744,7 +744,7 @@ File.prototype.createReadStream = function(options) { * Create a unique resumable upload session URI. This is the first step when * performing a resumable upload. * - * See the [Resumable upload guide](https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable) + * See the [Resumable upload guide](https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload) * for more on how the entire process works. * *

Note

@@ -753,7 +753,7 @@ File.prototype.createReadStream = function(options) { * any of the details, see {module:storage/createWriteStream}. Resumable uploads * are performed by default. * - * @resource [Resumable upload guide]{@link https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable} + * @resource [Resumable upload guide]{@link https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload} * * @param {object=} options - Configuration object. * @param {object} options.metadata - Metadata to set on the file. @@ -843,7 +843,7 @@ File.prototype.createResumableUpload = function(options, callback) { * NOTE: Writable streams will emit the `finish` event when the file is fully * uploaded. * - * @resource [Upload Options (Simple or Resumable)]{@link https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#uploads} + * @resource [Upload Options (Simple or Resumable)]{@link https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload} * @resource [Objects: insert API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/objects/insert} * * @param {object=} options - Configuration object. @@ -1183,7 +1183,7 @@ File.prototype.setEncryptionKey = function(encryptionKey) { * Get a signed policy document to allow a user to upload data with a POST * request. * - * @resource [Policy Document Reference]{@link https://cloud.google.com/storage/docs/reference-methods#policydocument} + * @resource [Policy Document Reference]{@link https://cloud.google.com/storage/docs/xml-api/post-object#policydocument} * * @throws {Error} If an expiration timestamp from the past is given. * @throws {Error} If options.equals has an array with less or more than two @@ -1351,7 +1351,7 @@ File.prototype.getSignedPolicy = function(options, callback) { /** * Get a signed URL to allow limited time access to the file. * - * @resource [Signed URLs Reference]{@link https://cloud.google.com/storage/docs/access-control#Signed-URLs} + * @resource [Signed URLs Reference]{@link https://cloud.google.com/storage/docs/access-control/signed-urls} * * @throws {Error} if an expiration timestamp from the past is given. * diff --git a/packages/storage/src/index.js b/packages/storage/src/index.js index 3124a89d0fd..12b4e670906 100644 --- a/packages/storage/src/index.js +++ b/packages/storage/src/index.js @@ -101,7 +101,7 @@ util.inherits(Storage, common.Service); * - `gcs.acl.READER_ROLE` - ("READER") * - `gcs.acl.WRITER_ROLE` - ("WRITER") * - * @resource [About Access Control Lists]{@link https://cloud.google.com/storage/docs/access-control#About-Access-Control-Lists} + * @resource [About Access Control Lists]{@link https://cloud.google.com/storage/docs/access-control/lists} * * @type {object} * From c7cd4d64b8803558460fa5aec3fef2c5f5b12f53 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Fri, 31 Mar 2017 13:35:21 -0400 Subject: [PATCH 2/3] language: fix docs --- README.md | 106 ++++++++--- packages/language/README.md | 74 +------- packages/language/src/document.js | 303 +++++++++++------------------- 3 files changed, 196 insertions(+), 287 deletions(-) diff --git a/README.md b/README.md index eb55fc36c4d..bb0acd82203 100644 --- a/README.md +++ b/README.md @@ -305,10 +305,26 @@ var languageClient = language({ // Get the entities from a sentence. languageClient.detectEntities('Stephen of Michigan!', function(err, entities) { - // entities = { - // people: ['Stephen'], - // places: ['Michigan'] - // } + // entities = [ + // { + // name: 'Stephen', + // type: 'PERSON', + // metadata: { + // mid: '/m/05d8y4q' + // }, + // salience: 0.7309288382530212, + // mentions: [ + // { + // text: { + // content: 'Stephen', + // beginOffset: -1 + // }, + // type: 'PROPER' + // } + // ] + // }, + // // ... + // ] }); // Create a document if you plan to run multiple detections. @@ -316,32 +332,76 @@ var document = languageClient.document('Contributions welcome!'); // Analyze the sentiment of the document. document.detectSentiment(function(err, sentiment) { - // sentiment = 100 // Large numbers represent more positive sentiments. + // sentiment = { + // magnitude: 0.5, + // score: 0.5 + // } }); // Parse the syntax of the document. -document.annotate(function(err, annotations) { - // annotations = { +document.annotate(function(err, annotation) { + // annotation = { // language: 'en', - // sentiment: 100, - // entities: {}, - // sentences: ['Contributions welcome!'], - // tokens: [ + // sentiment: { + // magnitude: 0.30000001192092896, + // score: 0.30000001192092896 + // }, + // entities: [ // { - // text: 'Contributions', - // partOfSpeech: 'Noun (common and proper)', - // partOfSpeechTag: 'NOUN' - // }, - // { - // text: 'welcome', - // partOfSpeech: 'Verb (all tenses and modes)', - // partOfSpeechTag: 'VERB' - // }, + // name: 'Contributions', + // type: 'OTHER', + // metadata: {}, + // salience: 1, + // mentions: [ + // { + // text: { + // content: 'Contributions', + // beginOffset: -1 + // }, + // type: 'COMMON' + // } + // ] + // } + // ], + // sentences: [ // { - // text: '!', - // partOfSpeech: 'Punctuation', - // partOfSpeechTag: 'PUNCT' + // text: { + // content: 'Contributions welcome!', + // beginOffset: -1 + // }, + // sentiment: { + // magnitude: 0.30000001192092896, + // score: 0.30000001192092896 + // } // } + // ], + // tokens: [ + // { + // text: { + // content: 'Contributions', + // beginOffset: -1 + // }, + // partOfSpeech: { + // tag: 'NOUN', + // aspect: 'ASPECT_UNKNOWN', + // case: 'CASE_UNKNOWN', + // form: 'FORM_UNKNOWN', + // gender: 'GENDER_UNKNOWN', + // mood: 'MOOD_UNKNOWN', + // number: 'PLURAL', + // person: 'PERSON_UNKNOWN', + // proper: 'PROPER_UNKNOWN', + // reciprocity: 'RECIPROCITY_UNKNOWN', + // tense: 'TENSE_UNKNOWN', + // voice: 'VOICE_UNKNOWN' + // }, + // dependencyEdge: { + // headTokenIndex: 1, + // label: 'NSUBJ' + // }, + // lemma: 'contribution' + // }, + // // ... // ] // } }); diff --git a/packages/language/README.md b/packages/language/README.md index ab1aca3713e..c447ef707c9 100644 --- a/packages/language/README.md +++ b/packages/language/README.md @@ -36,24 +36,7 @@ language.detectEntities('Stephen of Michigan!', function(err, entities) { // } // ] // }, - // { - // name: 'Michigan', - // type: 'LOCATION', - // metadata: { - // mid: '/m/04rrx', - // wikipedia_url: 'http://en.wikipedia.org/wiki/Michigan' - // }, - // salience: 0.26907116174697876, - // mentions: [ - // { - // text: { - // content: 'Michigan', - // beginOffset: -1 - // }, - // type: 'PROPER' - // } - // ] - // } + // // ... // ] }); @@ -69,8 +52,8 @@ document.detectSentiment(function(err, sentiment) { }); // Parse the syntax of the document. -document.annotate(function(err, annotations) { - // annotations = { +document.annotate(function(err, annotation) { + // annotation = { // language: 'en', // sentiment: { // magnitude: 0.30000001192092896, @@ -131,56 +114,7 @@ document.annotate(function(err, annotations) { // }, // lemma: 'contribution' // }, - // { - // text: { - // content: 'welcome', - // beginOffset: -1 - // }, - // partOfSpeech: { - // tag: 'VERB', - // aspect: 'ASPECT_UNKNOWN', - // case: 'CASE_UNKNOWN', - // form: 'FORM_UNKNOWN', - // gender: 'GENDER_UNKNOWN', - // mood: 'INDICATIVE', - // number: 'NUMBER_UNKNOWN', - // person: 'PERSON_UNKNOWN', - // proper: 'PROPER_UNKNOWN', - // reciprocity: 'RECIPROCITY_UNKNOWN', - // tense: 'PRESENT', - // voice: 'VOICE_UNKNOWN' - // }, - // dependencyEdge: { - // headTokenIndex: 1, - // label: 'ROOT' - // }, - // lemma: 'welcome' - // }, - // { - // text: { - // content: '!', - // beginOffset: -1 - // }, - // partOfSpeech: { - // tag: 'PUNCT', - // aspect: 'ASPECT_UNKNOWN', - // case: 'CASE_UNKNOWN', - // form: 'FORM_UNKNOWN', - // gender: 'GENDER_UNKNOWN', - // mood: 'MOOD_UNKNOWN', - // number: 'NUMBER_UNKNOWN', - // person: 'PERSON_UNKNOWN', - // proper: 'PROPER_UNKNOWN', - // reciprocity: 'RECIPROCITY_UNKNOWN', - // tense: 'TENSE_UNKNOWN', - // voice: 'VOICE_UNKNOWN' - // }, - // dependencyEdge: { - // headTokenIndex: 1, - // label: 'P' - // }, - // lemma: '!' - // } + // // ... // ] // } }); diff --git a/packages/language/src/document.js b/packages/language/src/document.js index fece3587339..e2499fc52e3 100644 --- a/packages/language/src/document.js +++ b/packages/language/src/document.js @@ -268,58 +268,39 @@ Document.PART_OF_SPEECH = { * // annotation = { * // language: 'en', * // sentiment: { - * // score: 1, - * // magnitude: 4 + * // magnitude: 0.5, + * // score: 0.5 * // }, - * // entities: { - * // organizations: [ - * // { - * // name: 'Google', - * // type: 'ORGANIZATION', - * // metadata: { - * // wikipedia_url: 'http://en.wikipedia.org/wiki/Google' - * // }, - * // salience: 0.65137446, - * // mentions: [ - * // { - * // text: { - * // content: 'Google', - * // beginOffset: -1 - * // }, - * // type: 'PROPER' - * // } - * // ] - * // } - * // ], - * // places: [ - * // { - * // name: 'American', - * // type: 'LOCATION', - * // metadata: { - * // wikipedia_url: 'http://en.wikipedia.org/wiki/United_States' + * // entities: [ + * // { + * // name: 'Google', + * // type: 'ORGANIZATION', + * // metadata: { + * // mid: '/m/045c7b', + * // wikipedia_url: 'http://en.wikipedia.org/wiki/Google' + * // }, + * // salience: 0.7532734870910645, + * // mentions: [ + * // { + * // text: { + * // content: 'Google', + * // beginOffset: -1 + * // }, + * // type: 'PROPER' * // }, - * // salience: 0.13947370648384094, - * // mentions: [ - * // { - * // text: [ - * // { - * // content: 'American', - * // beginOffset: -1 - * // }, - * // type: 'PROPER' - * // ] - * // } - * // ] + * // // ... * // } - * // ] - * // }, + * // } + * // ], * // sentences: [ * // { * // text: { - * // content: - * // 'Google is an American multinational technology company' + - * // 'specializing in Internet-related services and products.', + * // content: 'Google is an American multinational technology...', * // beginOffset: -1 + * // }, + * // sentiment: { + * // magnitude: 0.5, + * // score: 0.5 * // } * // } * // ], @@ -331,26 +312,25 @@ Document.PART_OF_SPEECH = { * // }, * // partOfSpeech: { * // tag: 'NOUN', - * // aspect: 'PERFECTIVE', - * // case: 'ADVERBIAL', - * // form: 'ADNOMIAL', - * // gender: 'FEMININE', - * // mood: 'IMPERATIVE', + * // aspect: 'ASPECT_UNKNOWN', + * // case: 'CASE_UNKNOWN', + * // form: 'FORM_UNKNOWN', + * // gender: 'GENDER_UNKNOWN', + * // mood: 'MOOD_UNKNOWN', * // number: 'SINGULAR', - * // person: 'FIRST', + * // person: 'PERSON_UNKNOWN', * // proper: 'PROPER', - * // reciprocity: 'RECIPROCAL', - * // tense: 'PAST', - * // voice: 'PASSIVE' + * // reciprocity: 'RECIPROCITY_UNKNOWN', + * // tense: 'TENSE_UNKNOWN', + * // voice: 'VOICE_UNKNOWN' * // }, * // dependencyEdge: { * // headTokenIndex: 1, - * // label: 'NSUBJ', - * // description: 'Nominal subject' + * // label: 'NSUBJ' * // }, * // lemma: 'Google' * // }, - * // ... + * // // ... * // ] * // } * }); @@ -371,51 +351,30 @@ Document.PART_OF_SPEECH = { * // annotation = { * // language: 'en', * // sentiment: { - * // score: 1, - * // magnitude: 4 + * // magnitude: 0.5, + * // score: 0.5 * // }, - * // entities: { - * // organizations: [ - * // { - * // name: 'Google', - * // type: 'ORGANIZATION', - * // metadata: { - * // wikipedia_url: 'http://en.wikipedia.org/wiki/Google' - * // }, - * // salience: 0.65137446, - * // mentions: [ - * // { - * // text: { - * // content: 'Google', - * // beginOffset: -1 - * // }, - * // type: 'PROPER' - * // } - * // ] - * // } - * // ], - * // places: [ - * // { - * // name: 'American', - * // type: 'LOCATION', - * // metadata: { - * // wikipedia_url: 'http://en.wikipedia.org/wiki/United_States' + * // entities: [ + * // { + * // name: 'Google', + * // type: 'ORGANIZATION', + * // metadata: { + * // mid: '/m/045c7b', + * // wikipedia_url: 'http://en.wikipedia.org/wiki/Google' + * // }, + * // salience: 0.7532734870910645, + * // mentions: [ + * // { + * // text: { + * // content: 'Google', + * // beginOffset: -1 + * // }, + * // type: 'PROPER' * // }, - * // salience: 0.13947370648384094, - * // mentions: [ - * // { - * // text: [ - * // { - * // content: 'American', - * // beginOffset: -1 - * // }, - * // type: 'PROPER' - * // ] - * // } - * // ] + * // // ... * // } - * // ] - * // }, + * // } + * // ] * // } * }); * @@ -520,44 +479,28 @@ Document.prototype.annotate = function(options, callback) { * // Error handling omitted. * } * - * // entities = { - * // organizations: [ - * // { - * // name: 'Google', - * // type: 'ORGANIZATION', - * // metadata: { - * // wikipedia_url: 'http: * //en.wikipedia.org/wiki/Google' - * // }, - * // salience: 0.65137446, - * // mentions: [ - * // { - * // text: { - * // content: 'Google', - * // beginOffset: -1 - * // } - * // } - * // ] - * // } - * // ], - * // places: [ - * // { - * // name: 'American', - * // type: 'LOCATION', - * // metadata: { - * // wikipedia_url: 'http: * //en.wikipedia.org/wiki/United_States' + * // entities = [ + * // { + * // name: 'Google', + * // type: 'ORGANIZATION', + * // metadata: { + * // mid: '/m/045c7b', + * // wikipedia_url: 'http://en.wikipedia.org/wiki/Google' + * // }, + * // salience: 0.7532734870910645, + * // mentions: [ + * // { + * // text: { + * // content: 'Google', + * // beginOffset: -1 + * // }, + * // type: 'PROPER' * // }, - * // salience: 0.13947371, - * // mentions: [ - * // { - * // text: { - * // content: 'American', - * // beginOffset: -1 - * // } - * // } - * // ] + * // // ... * // } - * // ] - * // } + * // }, + * // // ... + * // ] * }); * * //- @@ -611,19 +554,8 @@ Document.prototype.detectEntities = function(options, callback) { * } * * // sentiment = { - * // score: 1, - * // magnitude: 4, - * // sentences: [ - * // { - * // text: { - * // content: - * // 'Google is an American multinational technology company' + - * // 'specializing in Internet-related services and products.', - * // beginOffset: -1 - * // } - * // } - * // ], - * // language: 'en' + * // magnitude: 0.5, + * // score: 0.5 * // } * }); * @@ -667,7 +599,7 @@ Document.prototype.detectSentiment = function(options, callback) { * [`EncodingType`](https://cloud.google.com/natural-language/reference/rest/v1/EncodingType) * @param {function} callback - The callback function. * @param {?error} callback.err - An error occurred while making this request. - * @param {object} callback.syntax - The syntax recognized from the text. + * @param {object[]} callback.syntax - The syntax recognized from the text. * @param {object} callback.apiResponse - The full API response. * * @example @@ -676,51 +608,34 @@ Document.prototype.detectSentiment = function(options, callback) { * // Error handling omitted. * } * - * // syntax = { - * // sentences: [ - * // { - * // text: { - * // content: - * // 'Google is an American multinational technology company' + - * // 'specializing in Internet-related services and products.', - * // beginOffset: -1 - * // }, - * // sentiment: { - * // score: 1 - * // magnitude: 4 - * // } - * // } - * // ], - * // tokens: [ - * // { - * // text: { - * // content: 'Google', - * // beginOffset: -1 - * // }, - * // partOfSpeech: { - * // tag: 'NOUN', - * // aspect: 'PERFECTIVE', - * // case: 'ADVERBIAL', - * // form: 'ADNOMIAL', - * // gender: 'FEMININE', - * // mood: 'IMPERATIVE', - * // number: 'SINGULAR', - * // person: 'FIRST', - * // proper: 'PROPER', - * // reciprocity: 'RECIPROCAL', - * // tense: 'PAST', - * // voice: 'PASSIVE' - * // }, - * // dependencyEdge: { - * // headTokenIndex: 1, - * // label: 'NSUBJ', - * // description: 'Nominal subject' - * // }, - * // lemme: 'Google' - * // } - * // ], - * // language: 'en' - * // } + * // syntax = [ + * // { + * // text: { + * // content: 'Google', + * // beginOffset: -1 + * // }, + * // partOfSpeech: { + * // tag: 'NOUN', + * // aspect: 'ASPECT_UNKNOWN', + * // case: 'CASE_UNKNOWN', + * // form: 'FORM_UNKNOWN', + * // gender: 'GENDER_UNKNOWN', + * // mood: 'MOOD_UNKNOWN', + * // number: 'SINGULAR', + * // person: 'PERSON_UNKNOWN', + * // proper: 'PROPER', + * // reciprocity: 'RECIPROCITY_UNKNOWN', + * // tense: 'TENSE_UNKNOWN', + * // voice: 'VOICE_UNKNOWN' + * // }, + * // dependencyEdge: { + * // headTokenIndex: 1, + * // label: 'NSUBJ' + * // }, + * // lemma: 'Google' + * // }, + * // // ... + * // ] * }); * * //- From 45a05369db77428c6369958ff55c3ec6321b13e2 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Fri, 31 Mar 2017 13:35:48 -0400 Subject: [PATCH 3/3] spanner: fix formatting in docs --- packages/spanner/src/transaction.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/packages/spanner/src/transaction.js b/packages/spanner/src/transaction.js index 6d6493ba336..6c169248e8e 100644 --- a/packages/spanner/src/transaction.js +++ b/packages/spanner/src/transaction.js @@ -489,7 +489,7 @@ Transaction.prototype.run = function(query, callback) { * this.end(); * }) * .on('end', function() {}); - * }); + * }); */ Transaction.prototype.runStream = function(query) { var self = this; @@ -646,23 +646,6 @@ Transaction.prototype.retry_ = function(timeout, callback) { * }); * }); * }); - * - * //- - * // You can also omit the callback and return a Promise. - * //- - * transaction.run_(function() { - * return transaction.run('SELECT * FROM Singers') - * .then(function() { - * transaction.insert('Singers', { - * SingerId: 'Id3b', - * Name: 'Joe West' - * }); - * - * return transaction.commit(); - * }); - * }).then(function() { - * // Transaction committed successfully. - * }); */ Transaction.prototype.run_ = function(fn) { this.runFn_ = fn;