From 3ba5c568179b04326ef9cc9874f2d18da99e51d6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 10:45:29 -0400 Subject: [PATCH] feat: Add support for V1 and V2 classification models (#376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add support for V1 and V2 classification models for the V1 API PiperOrigin-RevId: 475599241 Source-Link: https://github.com/googleapis/googleapis/commit/05b99f982df9837c294ea3475a571a9252c68326 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3dcdbed8d968f634be0a2d3107237d232ee8b061 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2RjZGJlZDhkOTY4ZjYzNGJlMGEyZDMxMDcyMzdkMjMyZWU4YjA2MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Add support for V1 and V2 classification models for the V1Beta2 API PiperOrigin-RevId: 475604619 Source-Link: https://github.com/googleapis/googleapis/commit/044a15c14b1a1939684ad271c13ac84c5ac6a2c7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/410020af934c7248f7804770d6f8ec4571bfa551 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDEwMDIwYWY5MzRjNzI0OGY3ODA0NzcwZDZmOGVjNDU3MWJmYTU1MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: fix docstring formatting Committer: @parthea PiperOrigin-RevId: 476410563 Source-Link: https://github.com/googleapis/googleapis/commit/7f579ee5968051f12c86a2ea50bcdeb1fbd5df94 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ae0240e097a196c070e15deaae66464b42c8e014 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWUwMjQwZTA5N2ExOTZjMDcwZTE1ZGVhYWU2NjQ2NGI0MmM4ZTAxNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- google/cloud/language/__init__.py | 2 + google/cloud/language_v1/__init__.py | 2 + .../services/language_service/async_client.py | 14 +-- .../services/language_service/client.py | 14 +-- google/cloud/language_v1/types/__init__.py | 2 + .../language_v1/types/language_service.py | 96 +++++++++++++-- google/cloud/language_v1beta2/__init__.py | 2 + .../services/language_service/async_client.py | 2 +- .../services/language_service/client.py | 2 +- .../language_service/transports/grpc.py | 2 +- .../transports/grpc_asyncio.py | 2 +- .../cloud/language_v1beta2/types/__init__.py | 2 + .../types/language_service.py | 109 +++++++++++++++++- scripts/fixup_language_v1_keywords.py | 2 +- scripts/fixup_language_v1beta2_keywords.py | 2 +- 15 files changed, 227 insertions(+), 28 deletions(-) diff --git a/google/cloud/language/__init__.py b/google/cloud/language/__init__.py index 60d1431a..74c4351e 100644 --- a/google/cloud/language/__init__.py +++ b/google/cloud/language/__init__.py @@ -32,6 +32,7 @@ AnnotateTextRequest, AnnotateTextResponse, ClassificationCategory, + ClassificationModelOptions, ClassifyTextRequest, ClassifyTextResponse, DependencyEdge, @@ -60,6 +61,7 @@ "AnnotateTextRequest", "AnnotateTextResponse", "ClassificationCategory", + "ClassificationModelOptions", "ClassifyTextRequest", "ClassifyTextResponse", "DependencyEdge", diff --git a/google/cloud/language_v1/__init__.py b/google/cloud/language_v1/__init__.py index 9e99392d..acafe86d 100644 --- a/google/cloud/language_v1/__init__.py +++ b/google/cloud/language_v1/__init__.py @@ -27,6 +27,7 @@ AnnotateTextRequest, AnnotateTextResponse, ClassificationCategory, + ClassificationModelOptions, ClassifyTextRequest, ClassifyTextResponse, DependencyEdge, @@ -54,6 +55,7 @@ "AnnotateTextRequest", "AnnotateTextResponse", "ClassificationCategory", + "ClassificationModelOptions", "ClassifyTextRequest", "ClassifyTextResponse", "DependencyEdge", diff --git a/google/cloud/language_v1/services/language_service/async_client.py b/google/cloud/language_v1/services/language_service/async_client.py index 9657c9ed..6a7f7172 100644 --- a/google/cloud/language_v1/services/language_service/async_client.py +++ b/google/cloud/language_v1/services/language_service/async_client.py @@ -248,7 +248,7 @@ async def sample_analyze_sentiment(): The request object. The sentiment analysis request message. document (:class:`google.cloud.language_v1.types.Document`): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -367,7 +367,7 @@ async def sample_analyze_entities(): request (Union[google.cloud.language_v1.types.AnalyzeEntitiesRequest, dict]): The request object. The entity analysis request message. document (:class:`google.cloud.language_v1.types.Document`): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -485,7 +485,7 @@ async def sample_analyze_entity_sentiment(): The request object. The entity-level sentiment analysis request message. document (:class:`google.cloud.language_v1.types.Document`): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -603,7 +603,7 @@ async def sample_analyze_syntax(): request (Union[google.cloud.language_v1.types.AnalyzeSyntaxRequest, dict]): The request object. The syntax analysis request message. document (:class:`google.cloud.language_v1.types.Document`): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -717,7 +717,7 @@ async def sample_classify_text(): The request object. The document classification request message. document (:class:`google.cloud.language_v1.types.Document`): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -829,12 +829,12 @@ async def sample_annotate_text(): annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call. document (:class:`google.cloud.language_v1.types.Document`): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. features (:class:`google.cloud.language_v1.types.AnnotateTextRequest.Features`): - The enabled features. + Required. The enabled features. This corresponds to the ``features`` field on the ``request`` instance; if ``request`` is provided, this should not be set. diff --git a/google/cloud/language_v1/services/language_service/client.py b/google/cloud/language_v1/services/language_service/client.py index e19359b8..9b67ea6a 100644 --- a/google/cloud/language_v1/services/language_service/client.py +++ b/google/cloud/language_v1/services/language_service/client.py @@ -453,7 +453,7 @@ def sample_analyze_sentiment(): The request object. The sentiment analysis request message. document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -562,7 +562,7 @@ def sample_analyze_entities(): request (Union[google.cloud.language_v1.types.AnalyzeEntitiesRequest, dict]): The request object. The entity analysis request message. document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -670,7 +670,7 @@ def sample_analyze_entity_sentiment(): The request object. The entity-level sentiment analysis request message. document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -778,7 +778,7 @@ def sample_analyze_syntax(): request (Union[google.cloud.language_v1.types.AnalyzeSyntaxRequest, dict]): The request object. The syntax analysis request message. document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -882,7 +882,7 @@ def sample_classify_text(): The request object. The document classification request message. document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -984,12 +984,12 @@ def sample_annotate_text(): annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call. document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. features (google.cloud.language_v1.types.AnnotateTextRequest.Features): - The enabled features. + Required. The enabled features. This corresponds to the ``features`` field on the ``request`` instance; if ``request`` is provided, this should not be set. diff --git a/google/cloud/language_v1/types/__init__.py b/google/cloud/language_v1/types/__init__.py index 0f35f2e3..b4b20c9c 100644 --- a/google/cloud/language_v1/types/__init__.py +++ b/google/cloud/language_v1/types/__init__.py @@ -25,6 +25,7 @@ AnnotateTextRequest, AnnotateTextResponse, ClassificationCategory, + ClassificationModelOptions, ClassifyTextRequest, ClassifyTextResponse, DependencyEdge, @@ -51,6 +52,7 @@ "AnnotateTextRequest", "AnnotateTextResponse", "ClassificationCategory", + "ClassificationModelOptions", "ClassifyTextRequest", "ClassifyTextResponse", "DependencyEdge", diff --git a/google/cloud/language_v1/types/language_service.py b/google/cloud/language_v1/types/language_service.py index 2cd79d57..431fa9f1 100644 --- a/google/cloud/language_v1/types/language_service.py +++ b/google/cloud/language_v1/types/language_service.py @@ -29,6 +29,7 @@ "EntityMention", "TextSpan", "ClassificationCategory", + "ClassificationModelOptions", "AnalyzeSentimentRequest", "AnalyzeSentimentResponse", "AnalyzeEntitySentimentRequest", @@ -728,12 +729,76 @@ class ClassificationCategory(proto.Message): ) +class ClassificationModelOptions(proto.Message): + r"""Model options available for classification requests. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + v1_model (google.cloud.language_v1.types.ClassificationModelOptions.V1Model): + Setting this field will use the V1 model and + V1 content categories version. The V1 model is a + legacy model; support for this will be + discontinued in the future. + + This field is a member of `oneof`_ ``model_type``. + v2_model (google.cloud.language_v1.types.ClassificationModelOptions.V2Model): + Setting this field will use the V2 model with + the appropriate content categories version. The + V2 model is a better performing model. + + This field is a member of `oneof`_ ``model_type``. + """ + + class V1Model(proto.Message): + r"""Options for the V1 model.""" + + class V2Model(proto.Message): + r"""Options for the V2 model. + + Attributes: + content_categories_version (google.cloud.language_v1.types.ClassificationModelOptions.V2Model.ContentCategoriesVersion): + The content categories used for + classification. + """ + + class ContentCategoriesVersion(proto.Enum): + r"""The content categories used for classification.""" + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0 + V1 = 1 + V2 = 2 + + content_categories_version = proto.Field( + proto.ENUM, + number=1, + enum="ClassificationModelOptions.V2Model.ContentCategoriesVersion", + ) + + v1_model = proto.Field( + proto.MESSAGE, + number=1, + oneof="model_type", + message=V1Model, + ) + v2_model = proto.Field( + proto.MESSAGE, + number=2, + oneof="model_type", + message=V2Model, + ) + + class AnalyzeSentimentRequest(proto.Message): r"""The sentiment analysis request message. Attributes: document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. encoding_type (google.cloud.language_v1.types.EncodingType): The encoding type used by the API to calculate sentence offsets. @@ -789,7 +854,7 @@ class AnalyzeEntitySentimentRequest(proto.Message): Attributes: document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. encoding_type (google.cloud.language_v1.types.EncodingType): The encoding type used by the API to calculate offsets. @@ -838,7 +903,7 @@ class AnalyzeEntitiesRequest(proto.Message): Attributes: document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. encoding_type (google.cloud.language_v1.types.EncodingType): The encoding type used by the API to calculate offsets. @@ -887,7 +952,7 @@ class AnalyzeSyntaxRequest(proto.Message): Attributes: document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. encoding_type (google.cloud.language_v1.types.EncodingType): The encoding type used by the API to calculate offsets. @@ -943,7 +1008,10 @@ class ClassifyTextRequest(proto.Message): Attributes: document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. + classification_model_options (google.cloud.language_v1.types.ClassificationModelOptions): + Model options to use for classification. + Defaults to v1 options if not specified. """ document = proto.Field( @@ -951,6 +1019,11 @@ class ClassifyTextRequest(proto.Message): number=1, message="Document", ) + classification_model_options = proto.Field( + proto.MESSAGE, + number=3, + message="ClassificationModelOptions", + ) class ClassifyTextResponse(proto.Message): @@ -975,9 +1048,9 @@ class AnnotateTextRequest(proto.Message): Attributes: document (google.cloud.language_v1.types.Document): - Input document. + Required. Input document. features (google.cloud.language_v1.types.AnnotateTextRequest.Features): - The enabled features. + Required. The enabled features. encoding_type (google.cloud.language_v1.types.EncodingType): The encoding type used by the API to calculate offsets. @@ -1000,6 +1073,10 @@ class Features(proto.Message): sentiment. classify_text (bool): Classify the full document into categories. + classification_model_options (google.cloud.language_v1.types.ClassificationModelOptions): + The model options to use for classification. Defaults to v1 + options if not specified. Only used if ``classify_text`` is + set to true. """ extract_syntax = proto.Field( @@ -1022,6 +1099,11 @@ class Features(proto.Message): proto.BOOL, number=6, ) + classification_model_options = proto.Field( + proto.MESSAGE, + number=10, + message="ClassificationModelOptions", + ) document = proto.Field( proto.MESSAGE, diff --git a/google/cloud/language_v1beta2/__init__.py b/google/cloud/language_v1beta2/__init__.py index 9e99392d..acafe86d 100644 --- a/google/cloud/language_v1beta2/__init__.py +++ b/google/cloud/language_v1beta2/__init__.py @@ -27,6 +27,7 @@ AnnotateTextRequest, AnnotateTextResponse, ClassificationCategory, + ClassificationModelOptions, ClassifyTextRequest, ClassifyTextResponse, DependencyEdge, @@ -54,6 +55,7 @@ "AnnotateTextRequest", "AnnotateTextResponse", "ClassificationCategory", + "ClassificationModelOptions", "ClassifyTextRequest", "ClassifyTextResponse", "DependencyEdge", diff --git a/google/cloud/language_v1beta2/services/language_service/async_client.py b/google/cloud/language_v1beta2/services/language_service/async_client.py index 9eadd09c..db5180ac 100644 --- a/google/cloud/language_v1beta2/services/language_service/async_client.py +++ b/google/cloud/language_v1beta2/services/language_service/async_client.py @@ -568,7 +568,7 @@ async def analyze_syntax( metadata: Sequence[Tuple[str, str]] = (), ) -> language_service.AnalyzeSyntaxResponse: r"""Analyzes the syntax of the text and provides sentence - boundaries and tokenization along with part-of-speech + boundaries and tokenization along with part of speech tags, dependency trees, and other properties. .. code-block:: python diff --git a/google/cloud/language_v1beta2/services/language_service/client.py b/google/cloud/language_v1beta2/services/language_service/client.py index d6b37867..10e8b064 100644 --- a/google/cloud/language_v1beta2/services/language_service/client.py +++ b/google/cloud/language_v1beta2/services/language_service/client.py @@ -743,7 +743,7 @@ def analyze_syntax( metadata: Sequence[Tuple[str, str]] = (), ) -> language_service.AnalyzeSyntaxResponse: r"""Analyzes the syntax of the text and provides sentence - boundaries and tokenization along with part-of-speech + boundaries and tokenization along with part of speech tags, dependency trees, and other properties. .. code-block:: python diff --git a/google/cloud/language_v1beta2/services/language_service/transports/grpc.py b/google/cloud/language_v1beta2/services/language_service/transports/grpc.py index 42cf6f63..3d1de3e0 100644 --- a/google/cloud/language_v1beta2/services/language_service/transports/grpc.py +++ b/google/cloud/language_v1beta2/services/language_service/transports/grpc.py @@ -331,7 +331,7 @@ def analyze_syntax( r"""Return a callable for the analyze syntax method over gRPC. Analyzes the syntax of the text and provides sentence - boundaries and tokenization along with part-of-speech + boundaries and tokenization along with part of speech tags, dependency trees, and other properties. Returns: diff --git a/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py b/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py index 2ae5171b..72f07a70 100644 --- a/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py +++ b/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py @@ -335,7 +335,7 @@ def analyze_syntax( r"""Return a callable for the analyze syntax method over gRPC. Analyzes the syntax of the text and provides sentence - boundaries and tokenization along with part-of-speech + boundaries and tokenization along with part of speech tags, dependency trees, and other properties. Returns: diff --git a/google/cloud/language_v1beta2/types/__init__.py b/google/cloud/language_v1beta2/types/__init__.py index 0f35f2e3..b4b20c9c 100644 --- a/google/cloud/language_v1beta2/types/__init__.py +++ b/google/cloud/language_v1beta2/types/__init__.py @@ -25,6 +25,7 @@ AnnotateTextRequest, AnnotateTextResponse, ClassificationCategory, + ClassificationModelOptions, ClassifyTextRequest, ClassifyTextResponse, DependencyEdge, @@ -51,6 +52,7 @@ "AnnotateTextRequest", "AnnotateTextResponse", "ClassificationCategory", + "ClassificationModelOptions", "ClassifyTextRequest", "ClassifyTextResponse", "DependencyEdge", diff --git a/google/cloud/language_v1beta2/types/language_service.py b/google/cloud/language_v1beta2/types/language_service.py index b43b62ed..63f87cc8 100644 --- a/google/cloud/language_v1beta2/types/language_service.py +++ b/google/cloud/language_v1beta2/types/language_service.py @@ -29,6 +29,7 @@ "EntityMention", "TextSpan", "ClassificationCategory", + "ClassificationModelOptions", "AnalyzeSentimentRequest", "AnalyzeSentimentResponse", "AnalyzeEntitySentimentRequest", @@ -95,6 +96,16 @@ class Document(proto.Message): the language (either specified by the caller or automatically detected) is not supported by the called API method, an ``INVALID_ARGUMENT`` error is returned. + reference_web_uri (str): + The web URI where the document comes from. + This URI is not used for fetching the content, + but as a hint for analyzing the document. + boilerplate_handling (google.cloud.language_v1beta2.types.Document.BoilerplateHandling): + Indicates how detected boilerplate(e.g. + advertisements, copyright declarations, banners) + should be handled for this document. If not + specified, boilerplate will be treated the same + as content. """ class Type(proto.Enum): @@ -103,6 +114,12 @@ class Type(proto.Enum): PLAIN_TEXT = 1 HTML = 2 + class BoilerplateHandling(proto.Enum): + r"""Ways of handling boilerplate detected in the document""" + BOILERPLATE_HANDLING_UNSPECIFIED = 0 + SKIP_BOILERPLATE = 1 + KEEP_BOILERPLATE = 2 + type_ = proto.Field( proto.ENUM, number=1, @@ -122,6 +139,15 @@ class Type(proto.Enum): proto.STRING, number=4, ) + reference_web_uri = proto.Field( + proto.STRING, + number=5, + ) + boilerplate_handling = proto.Field( + proto.ENUM, + number=6, + enum=BoilerplateHandling, + ) class Sentence(proto.Message): @@ -725,6 +751,70 @@ class ClassificationCategory(proto.Message): ) +class ClassificationModelOptions(proto.Message): + r"""Model options available for classification requests. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + v1_model (google.cloud.language_v1beta2.types.ClassificationModelOptions.V1Model): + Setting this field will use the V1 model and + V1 content categories version. The V1 model is a + legacy model; support for this will be + discontinued in the future. + + This field is a member of `oneof`_ ``model_type``. + v2_model (google.cloud.language_v1beta2.types.ClassificationModelOptions.V2Model): + Setting this field will use the V2 model with + the appropriate content categories version. The + V2 model is a better performing model. + + This field is a member of `oneof`_ ``model_type``. + """ + + class V1Model(proto.Message): + r"""Options for the V1 model.""" + + class V2Model(proto.Message): + r"""Options for the V2 model. + + Attributes: + content_categories_version (google.cloud.language_v1beta2.types.ClassificationModelOptions.V2Model.ContentCategoriesVersion): + The content categories used for + classification. + """ + + class ContentCategoriesVersion(proto.Enum): + r"""The content categories used for classification.""" + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0 + V1 = 1 + V2 = 2 + + content_categories_version = proto.Field( + proto.ENUM, + number=1, + enum="ClassificationModelOptions.V2Model.ContentCategoriesVersion", + ) + + v1_model = proto.Field( + proto.MESSAGE, + number=1, + oneof="model_type", + message=V1Model, + ) + v2_model = proto.Field( + proto.MESSAGE, + number=2, + oneof="model_type", + message=V2Model, + ) + + class AnalyzeSentimentRequest(proto.Message): r"""The sentiment analysis request message. @@ -942,6 +1032,9 @@ class ClassifyTextRequest(proto.Message): Attributes: document (google.cloud.language_v1beta2.types.Document): Required. Input document. + classification_model_options (google.cloud.language_v1beta2.types.ClassificationModelOptions): + Model options to use for classification. + Defaults to v1 options if not specified. """ document = proto.Field( @@ -949,6 +1042,11 @@ class ClassifyTextRequest(proto.Message): number=1, message="Document", ) + classification_model_options = proto.Field( + proto.MESSAGE, + number=3, + message="ClassificationModelOptions", + ) class ClassifyTextResponse(proto.Message): @@ -984,7 +1082,7 @@ class AnnotateTextRequest(proto.Message): class Features(proto.Message): r"""All available features for sentiment, syntax, and semantic analysis. Setting each one to true will enable that specific - analysis for the input. Next ID: 10 + analysis for the input. Next ID: 11 Attributes: extract_syntax (bool): @@ -1001,6 +1099,10 @@ class Features(proto.Message): the API will use the default model which classifies into a `predefined taxonomy `__. + classification_model_options (google.cloud.language_v1beta2.types.ClassificationModelOptions): + The model options to use for classification. Defaults to v1 + options if not specified. Only used if ``classify_text`` is + set to true. """ extract_syntax = proto.Field( @@ -1023,6 +1125,11 @@ class Features(proto.Message): proto.BOOL, number=6, ) + classification_model_options = proto.Field( + proto.MESSAGE, + number=10, + message="ClassificationModelOptions", + ) document = proto.Field( proto.MESSAGE, diff --git a/scripts/fixup_language_v1_keywords.py b/scripts/fixup_language_v1_keywords.py index e4268c0f..fc15df57 100644 --- a/scripts/fixup_language_v1_keywords.py +++ b/scripts/fixup_language_v1_keywords.py @@ -44,7 +44,7 @@ class languageCallTransformer(cst.CSTTransformer): 'analyze_sentiment': ('document', 'encoding_type', ), 'analyze_syntax': ('document', 'encoding_type', ), 'annotate_text': ('document', 'features', 'encoding_type', ), - 'classify_text': ('document', ), + 'classify_text': ('document', 'classification_model_options', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/scripts/fixup_language_v1beta2_keywords.py b/scripts/fixup_language_v1beta2_keywords.py index e4268c0f..fc15df57 100644 --- a/scripts/fixup_language_v1beta2_keywords.py +++ b/scripts/fixup_language_v1beta2_keywords.py @@ -44,7 +44,7 @@ class languageCallTransformer(cst.CSTTransformer): 'analyze_sentiment': ('document', 'encoding_type', ), 'analyze_syntax': ('document', 'encoding_type', ), 'annotate_text': ('document', 'features', 'encoding_type', ), - 'classify_text': ('document', ), + 'classify_text': ('document', 'classification_model_options', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: