La vaca saltó sobre la luna.
- ... - ... - ... """ - >>> document = language.types.Document( - ... content=html_content, - ... language='es', - ... type='HTML', - ... ) - -The ``language`` argument can be either ISO-639-1 or BCP-47 language -codes. The API reference page contains the full list of `supported languages`_. - -.. _supported languages: https://cloud.google.com/natural-language/docs/languages - - -In addition to supplying the text / HTML content, a document can refer -to content stored in `Google Cloud Storage`_. - - .. code-block:: python - - >>> document = language.types.Document( - ... gcs_content_uri='gs://my-text-bucket/sentiment-me.txt', - ... type=language.enums.HTML, - ... ) - -.. _analyzeEntities: https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/analyzeEntities -.. _analyzeSentiment: https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/analyzeSentiment -.. _analyzeEntitySentiment: https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/analyzeEntitySentiment -.. _annotateText: https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/annotateText -.. _classifyText: https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/classifyText -.. _Google Cloud Storage: https://cloud.google.com/storage/ - -Analyze Entities -**************** - -The :meth:`~.language_v1.LanguageServiceClient.analyze_entities` -method finds named entities (i.e. proper names) in the text. This method -returns a :class:`~.language_v1.types.AnalyzeEntitiesResponse`. - - .. code-block:: python - - >>> document = language.types.Document( - ... content='Michelangelo Caravaggio, Italian painter, is ' - ... 'known for "The Calling of Saint Matthew".', - ... type=language.enums.Document.Type.PLAIN_TEXT, - ... ) - >>> response = client.analyze_entities( - ... document=document, - ... encoding_type='UTF32', - ... ) - >>> for entity in response.entities: - ... print('=' * 20) - ... print(' name: {0}'.format(entity.name)) - ... print(' type: {0}'.format(entity.type)) - ... print(' metadata: {0}'.format(entity.metadata)) - ... print(' salience: {0}'.format(entity.salience)) - ==================== - name: Michelangelo Caravaggio - type: PERSON - metadata: {'wikipedia_url': 'https://en.wikipedia.org/wiki/Caravaggio'} - salience: 0.7615959 - ==================== - name: Italian - type: LOCATION - metadata: {'wikipedia_url': 'https://en.wikipedia.org/wiki/Italy'} - salience: 0.19960518 - ==================== - name: The Calling of Saint Matthew - type: EVENT - metadata: {'wikipedia_url': 'https://en.wikipedia.org/wiki/The_Calling_of_St_Matthew_(Caravaggio)'} - salience: 0.038798928 - -.. note:: - - It is recommended to send an ``encoding_type`` argument to Natural - Language methods, so they provide useful offsets for the data they return. - While the correct value varies by environment, in Python you *usually* - want ``UTF32``. - - -Analyze Sentiment -***************** - -The :meth:`~.language_v1.LanguageServiceClient.analyze_sentiment` method -analyzes the sentiment of the provided text. This method returns a -:class:`~.language_v1.types.AnalyzeSentimentResponse`. - - .. code-block:: python - - >>> document = language.types.Document( - ... content='Jogging is not very fun.', - ... type='PLAIN_TEXT', - ... ) - >>> response = client.analyze_sentiment( - ... document=document, - ... encoding_type='UTF32', - ... ) - >>> sentiment = response.document_sentiment - >>> print(sentiment.score) - -1 - >>> print(sentiment.magnitude) - 0.8 - -.. note:: - - It is recommended to send an ``encoding_type`` argument to Natural - Language methods, so they provide useful offsets for the data they return. - While the correct value varies by environment, in Python you *usually* - want ``UTF32``. - - -Analyze Entity Sentiment -************************ - -The :meth:`~.language_v1.LanguageServiceClient.analyze_entity_sentiment` -method is effectively the amalgamation of -:meth:`~.language_v1.LanguageServiceClient.analyze_entities` and -:meth:`~.language_v1.LanguageServiceClient.analyze_sentiment`. -This method returns a -:class:`~.language_v1.types.AnalyzeEntitySentimentResponse`. - -.. code-block:: python - - >>> document = language.types.Document( - ... content='Mona said that jogging is very fun.', - ... type='PLAIN_TEXT', - ... ) - >>> response = client.analyze_entity_sentiment( - ... document=document, - ... encoding_type='UTF32', - ... ) - >>> entities = response.entities - >>> entities[0].name - 'Mona' - >>> entities[1].name - 'jogging' - >>> entities[1].sentiment.magnitude - 0.8 - >>> entities[1].sentiment.score - 0.8 - -.. note:: - - It is recommended to send an ``encoding_type`` argument to Natural - Language methods, so they provide useful offsets for the data they return. - While the correct value varies by environment, in Python you *usually* - want ``UTF32``. - - -Annotate Text -************* - -The :meth:`~.language_v1.LanguageServiceClient.annotate_text` method -analyzes a document and is intended for users who are familiar with -machine learning and need in-depth text features to build upon. This method -returns a :class:`~.language_v1.types.AnnotateTextResponse`. diff --git a/google/__init__.py b/google/__init__.py deleted file mode 100644 index 0e1bc513..00000000 --- a/google/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2016 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - - __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/google/cloud/__init__.py b/google/cloud/__init__.py deleted file mode 100644 index 0e1bc513..00000000 --- a/google/cloud/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2016 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - - __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/google/cloud/language.py b/google/cloud/language.py deleted file mode 100644 index 624bd119..00000000 --- a/google/cloud/language.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2017, Google LLC All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import absolute_import - -from google.cloud.language_v1 import LanguageServiceClient -from google.cloud.language_v1 import enums -from google.cloud.language_v1 import types - -__all__ = ("enums", "types", "LanguageServiceClient") diff --git a/google/cloud/language_v1/__init__.py b/google/cloud/language_v1/__init__.py deleted file mode 100644 index a44fe4c9..00000000 --- a/google/cloud/language_v1/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2017, Google LLC All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import absolute_import - -from google.cloud.language_v1 import types -from google.cloud.language_v1.gapic import enums -from google.cloud.language_v1.gapic import language_service_client - - -class LanguageServiceClient(language_service_client.LanguageServiceClient): - __doc__ = language_service_client.LanguageServiceClient.__doc__ - enums = enums - - -__all__ = ("enums", "types", "LanguageServiceClient") diff --git a/google/cloud/language_v1/gapic/__init__.py b/google/cloud/language_v1/gapic/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/google/cloud/language_v1/gapic/enums.py b/google/cloud/language_v1/gapic/enums.py deleted file mode 100644 index 28fefea5..00000000 --- a/google/cloud/language_v1/gapic/enums.py +++ /dev/null @@ -1,593 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Wrappers for protocol buffer enum types.""" - -import enum - - -class EncodingType(enum.IntEnum): - """ - Represents the text encoding that the caller uses to process the - output. Providing an ``EncodingType`` is recommended because the API - provides the beginning offsets for various outputs, such as tokens and - mentions, and languages that natively use different text encodings may - access offsets differently. - - Attributes: - NONE (int): If ``EncodingType`` is not specified, encoding-dependent information - (such as ``begin_offset``) will be set at ``-1``. - UTF8 (int): Encoding-dependent information (such as ``begin_offset``) is - calculated based on the UTF-8 encoding of the input. C++ and Go are - examples of languages that use this encoding natively. - UTF16 (int): Encoding-dependent information (such as ``begin_offset``) is - calculated based on the UTF-16 encoding of the input. Java and - JavaScript are examples of languages that use this encoding natively. - UTF32 (int): Encoding-dependent information (such as ``begin_offset``) is - calculated based on the UTF-32 encoding of the input. Python is an - example of a language that uses this encoding natively. - """ - - NONE = 0 - UTF8 = 1 - UTF16 = 2 - UTF32 = 3 - - -class DependencyEdge(object): - class Label(enum.IntEnum): - """ - The parse label enum for the token. - - Attributes: - UNKNOWN (int): Unknown - ABBREV (int): Abbreviation modifier - ACOMP (int): Adjectival complement - ADVCL (int): Adverbial clause modifier - ADVMOD (int): Adverbial modifier - AMOD (int): Adjectival modifier of an NP - APPOS (int): Appositional modifier of an NP - ATTR (int): Attribute dependent of a copular verb - AUX (int): Auxiliary (non-main) verb - AUXPASS (int): Passive auxiliary - CC (int): Coordinating conjunction - CCOMP (int): Clausal complement of a verb or adjective - CONJ (int): Conjunct - CSUBJ (int): Clausal subject - CSUBJPASS (int): Clausal passive subject - DEP (int): Dependency (unable to determine) - DET (int): Determiner - DISCOURSE (int): Discourse - DOBJ (int): Direct object - EXPL (int): Expletive - GOESWITH (int): Goes with (part of a word in a text not well edited) - IOBJ (int): Indirect object - MARK (int): Marker (word introducing a subordinate clause) - MWE (int): Multi-word expression - MWV (int): Multi-word verbal expression - NEG (int): Negation modifier - NN (int): Noun compound modifier - NPADVMOD (int): Noun phrase used as an adverbial modifier - NSUBJ (int): Nominal subject - NSUBJPASS (int): Passive nominal subject - NUM (int): Numeric modifier of a noun - NUMBER (int): Element of compound number - P (int): Punctuation mark - PARATAXIS (int): Parataxis relation - PARTMOD (int): Participial modifier - PCOMP (int): The complement of a preposition is a clause - POBJ (int): Object of a preposition - POSS (int): Possession modifier - POSTNEG (int): Postverbal negative particle - PRECOMP (int): Predicate complement - PRECONJ (int): Preconjunt - PREDET (int): Predeterminer - PREF (int): Prefix - PREP (int): Prepositional modifier - PRONL (int): The relationship between a verb and verbal morpheme - PRT (int): Particle - PS (int): Associative or possessive marker - QUANTMOD (int): Quantifier phrase modifier - RCMOD (int): Relative clause modifier - RCMODREL (int): Complementizer in relative clause - RDROP (int): Ellipsis without a preceding predicate - REF (int): Referent - REMNANT (int): Remnant - REPARANDUM (int): Reparandum - ROOT (int): Root - SNUM (int): Suffix specifying a unit of number - SUFF (int): Suffix - TMOD (int): Temporal modifier - TOPIC (int): Topic marker - VMOD (int): Clause headed by an infinite form of the verb that modifies a noun - VOCATIVE (int): Vocative - XCOMP (int): Open clausal complement - SUFFIX (int): Name suffix - TITLE (int): Name title - ADVPHMOD (int): Adverbial phrase modifier - AUXCAUS (int): Causative auxiliary - AUXVV (int): Helper auxiliary - DTMOD (int): Rentaishi (Prenominal modifier) - FOREIGN (int): Foreign words - KW (int): Keyword - LIST (int): List for chains of comparable items - NOMC (int): Nominalized clause - NOMCSUBJ (int): Nominalized clausal subject - NOMCSUBJPASS (int): Nominalized clausal passive - NUMC (int): Compound of numeric modifier - COP (int): Copula - DISLOCATED (int): Dislocated relation (for fronted/topicalized elements) - ASP (int): Aspect marker - GMOD (int): Genitive modifier - GOBJ (int): Genitive object - INFMOD (int): Infinitival modifier - MES (int): Measure - NCOMP (int): Nominal complement of a noun - """ - - UNKNOWN = 0 - ABBREV = 1 - ACOMP = 2 - ADVCL = 3 - ADVMOD = 4 - AMOD = 5 - APPOS = 6 - ATTR = 7 - AUX = 8 - AUXPASS = 9 - CC = 10 - CCOMP = 11 - CONJ = 12 - CSUBJ = 13 - CSUBJPASS = 14 - DEP = 15 - DET = 16 - DISCOURSE = 17 - DOBJ = 18 - EXPL = 19 - GOESWITH = 20 - IOBJ = 21 - MARK = 22 - MWE = 23 - MWV = 24 - NEG = 25 - NN = 26 - NPADVMOD = 27 - NSUBJ = 28 - NSUBJPASS = 29 - NUM = 30 - NUMBER = 31 - P = 32 - PARATAXIS = 33 - PARTMOD = 34 - PCOMP = 35 - POBJ = 36 - POSS = 37 - POSTNEG = 38 - PRECOMP = 39 - PRECONJ = 40 - PREDET = 41 - PREF = 42 - PREP = 43 - PRONL = 44 - PRT = 45 - PS = 46 - QUANTMOD = 47 - RCMOD = 48 - RCMODREL = 49 - RDROP = 50 - REF = 51 - REMNANT = 52 - REPARANDUM = 53 - ROOT = 54 - SNUM = 55 - SUFF = 56 - TMOD = 57 - TOPIC = 58 - VMOD = 59 - VOCATIVE = 60 - XCOMP = 61 - SUFFIX = 62 - TITLE = 63 - ADVPHMOD = 64 - AUXCAUS = 65 - AUXVV = 66 - DTMOD = 67 - FOREIGN = 68 - KW = 69 - LIST = 70 - NOMC = 71 - NOMCSUBJ = 72 - NOMCSUBJPASS = 73 - NUMC = 74 - COP = 75 - DISLOCATED = 76 - ASP = 77 - GMOD = 78 - GOBJ = 79 - INFMOD = 80 - MES = 81 - NCOMP = 82 - - -class Document(object): - class Type(enum.IntEnum): - """ - The document types enum. - - Attributes: - TYPE_UNSPECIFIED (int): The content type is not specified. - PLAIN_TEXT (int): Plain text - HTML (int): HTML - """ - - TYPE_UNSPECIFIED = 0 - PLAIN_TEXT = 1 - HTML = 2 - - -class Entity(object): - class Type(enum.IntEnum): - """ - The type of the entity. For most entity types, the associated - metadata is a Wikipedia URL (``wikipedia_url``) and Knowledge Graph MID - (``mid``). The table below lists the associated fields for entities that - have different metadata. - - Attributes: - UNKNOWN (int): Unknown - PERSON (int): Person - LOCATION (int): Location - ORGANIZATION (int): Organization - EVENT (int): Event - WORK_OF_ART (int): Artwork - CONSUMER_GOOD (int): Consumer product - OTHER (int): Other types of entities - PHONE_NUMBER (int): Phone number The metadata lists the phone number, formatted - according to local convention, plus whichever additional elements appear - in the text: - - .. raw:: html - -number – the actual number, broken down into
- sections as per local conventionnational_prefix
- – country code, if detectedarea_code –
- region or area code, if detectedextension –
- phone extension (to be dialed after connection), if detectedstreet_number – street numberlocality – city or townstreet_name – street/route name, if detectedpostal_code – postal code, if detectedcountry – country, if detectedbroad_region – administrative area, such as the
- state, if detectednarrow_region – smaller
- administrative area, such as county, if detectedsublocality – used in Asian addresses to demark a
- district within a city, if detectedyear – four digit year, if detectedmonth – two digit month number, if detectedday – two digit day number, if detectedvalue and currency.
- """
-
- UNKNOWN = 0
- PERSON = 1
- LOCATION = 2
- ORGANIZATION = 3
- EVENT = 4
- WORK_OF_ART = 5
- CONSUMER_GOOD = 6
- OTHER = 7
- PHONE_NUMBER = 9
- ADDRESS = 10
- DATE = 11
- NUMBER = 12
- PRICE = 13
-
-
-class EntityMention(object):
- class Type(enum.IntEnum):
- """
- The supported types of mentions.
-
- Attributes:
- TYPE_UNKNOWN (int): Unknown
- PROPER (int): Proper name
- COMMON (int): Common noun (or noun compound)
- """
-
- TYPE_UNKNOWN = 0
- PROPER = 1
- COMMON = 2
-
-
-class PartOfSpeech(object):
- class Aspect(enum.IntEnum):
- """
- The characteristic of a verb that expresses time flow during an event.
-
- Attributes:
- ASPECT_UNKNOWN (int): Aspect is not applicable in the analyzed language or is not predicted.
- PERFECTIVE (int): Perfective
- IMPERFECTIVE (int): Imperfective
- PROGRESSIVE (int): Progressive
- """
-
- ASPECT_UNKNOWN = 0
- PERFECTIVE = 1
- IMPERFECTIVE = 2
- PROGRESSIVE = 3
-
- class Case(enum.IntEnum):
- """
- The grammatical function performed by a noun or pronoun in a phrase,
- clause, or sentence. In some languages, other parts of speech, such as
- adjective and determiner, take case inflection in agreement with the noun.
-
- Attributes:
- CASE_UNKNOWN (int): Case is not applicable in the analyzed language or is not predicted.
- ACCUSATIVE (int): Accusative
- ADVERBIAL (int): Adverbial
- COMPLEMENTIVE (int): Complementive
- DATIVE (int): Dative
- GENITIVE (int): Genitive
- INSTRUMENTAL (int): Instrumental
- LOCATIVE (int): Locative
- NOMINATIVE (int): Nominative
- OBLIQUE (int): Oblique
- PARTITIVE (int): Partitive
- PREPOSITIONAL (int): Prepositional
- REFLEXIVE_CASE (int): Reflexive
- RELATIVE_CASE (int): Relative
- VOCATIVE (int): Vocative
- """
-
- CASE_UNKNOWN = 0
- ACCUSATIVE = 1
- ADVERBIAL = 2
- COMPLEMENTIVE = 3
- DATIVE = 4
- GENITIVE = 5
- INSTRUMENTAL = 6
- LOCATIVE = 7
- NOMINATIVE = 8
- OBLIQUE = 9
- PARTITIVE = 10
- PREPOSITIONAL = 11
- REFLEXIVE_CASE = 12
- RELATIVE_CASE = 13
- VOCATIVE = 14
-
- class Form(enum.IntEnum):
- """
- Depending on the language, Form can be categorizing different forms of
- verbs, adjectives, adverbs, etc. For example, categorizing inflected
- endings of verbs and adjectives or distinguishing between short and long
- forms of adjectives and participles
-
- Attributes:
- FORM_UNKNOWN (int): Form is not applicable in the analyzed language or is not predicted.
- ADNOMIAL (int): Adnomial
- AUXILIARY (int): Auxiliary
- COMPLEMENTIZER (int): Complementizer
- FINAL_ENDING (int): Final ending
- GERUND (int): Gerund
- REALIS (int): Realis
- IRREALIS (int): Irrealis
- SHORT (int): Short form
- LONG (int): Long form
- ORDER (int): Order form
- SPECIFIC (int): Specific form
- """
-
- FORM_UNKNOWN = 0
- ADNOMIAL = 1
- AUXILIARY = 2
- COMPLEMENTIZER = 3
- FINAL_ENDING = 4
- GERUND = 5
- REALIS = 6
- IRREALIS = 7
- SHORT = 8
- LONG = 9
- ORDER = 10
- SPECIFIC = 11
-
- class Gender(enum.IntEnum):
- """
- Gender classes of nouns reflected in the behaviour of associated words.
-
- Attributes:
- GENDER_UNKNOWN (int): Gender is not applicable in the analyzed language or is not predicted.
- FEMININE (int): Feminine
- MASCULINE (int): Masculine
- NEUTER (int): Neuter
- """
-
- GENDER_UNKNOWN = 0
- FEMININE = 1
- MASCULINE = 2
- NEUTER = 3
-
- class Mood(enum.IntEnum):
- """
- The grammatical feature of verbs, used for showing modality and attitude.
-
- Attributes:
- MOOD_UNKNOWN (int): Mood is not applicable in the analyzed language or is not predicted.
- CONDITIONAL_MOOD (int): Conditional
- IMPERATIVE (int): Imperative
- INDICATIVE (int): Indicative
- INTERROGATIVE (int): Interrogative
- JUSSIVE (int): Jussive
- SUBJUNCTIVE (int): Subjunctive
- """
-
- MOOD_UNKNOWN = 0
- CONDITIONAL_MOOD = 1
- IMPERATIVE = 2
- INDICATIVE = 3
- INTERROGATIVE = 4
- JUSSIVE = 5
- SUBJUNCTIVE = 6
-
- class Number(enum.IntEnum):
- """
- Count distinctions.
-
- Attributes:
- NUMBER_UNKNOWN (int): Number is not applicable in the analyzed language or is not predicted.
- SINGULAR (int): Singular
- PLURAL (int): Plural
- DUAL (int): Dual
- """
-
- NUMBER_UNKNOWN = 0
- SINGULAR = 1
- PLURAL = 2
- DUAL = 3
-
- class Person(enum.IntEnum):
- """
- The distinction between the speaker, second person, third person, etc.
-
- Attributes:
- PERSON_UNKNOWN (int): Person is not applicable in the analyzed language or is not predicted.
- FIRST (int): First
- SECOND (int): Second
- THIRD (int): Third
- REFLEXIVE_PERSON (int): Reflexive
- """
-
- PERSON_UNKNOWN = 0
- FIRST = 1
- SECOND = 2
- THIRD = 3
- REFLEXIVE_PERSON = 4
-
- class Proper(enum.IntEnum):
- """
- This category shows if the token is part of a proper name.
-
- Attributes:
- PROPER_UNKNOWN (int): Proper is not applicable in the analyzed language or is not predicted.
- PROPER (int): Proper
- NOT_PROPER (int): Not proper
- """
-
- PROPER_UNKNOWN = 0
- PROPER = 1
- NOT_PROPER = 2
-
- class Reciprocity(enum.IntEnum):
- """
- Reciprocal features of a pronoun.
-
- Attributes:
- RECIPROCITY_UNKNOWN (int): Reciprocity is not applicable in the analyzed language or is not
- predicted.
- RECIPROCAL (int): Reciprocal
- NON_RECIPROCAL (int): Non-reciprocal
- """
-
- RECIPROCITY_UNKNOWN = 0
- RECIPROCAL = 1
- NON_RECIPROCAL = 2
-
- class Tag(enum.IntEnum):
- """
- The part of speech tags enum.
-
- Attributes:
- UNKNOWN (int): Unknown
- ADJ (int): Adjective
- ADP (int): Adposition (preposition and postposition)
- ADV (int): Adverb
- CONJ (int): Conjunction
- DET (int): Determiner
- NOUN (int): Noun (common and proper)
- NUM (int): Cardinal number
- PRON (int): Pronoun
- PRT (int): Particle or other function word
- PUNCT (int): Punctuation
- VERB (int): Verb (all tenses and modes)
- X (int): Other: foreign words, typos, abbreviations
- AFFIX (int): Affix
- """
-
- UNKNOWN = 0
- ADJ = 1
- ADP = 2
- ADV = 3
- CONJ = 4
- DET = 5
- NOUN = 6
- NUM = 7
- PRON = 8
- PRT = 9
- PUNCT = 10
- VERB = 11
- X = 12
- AFFIX = 13
-
- class Tense(enum.IntEnum):
- """
- Time reference.
-
- Attributes:
- TENSE_UNKNOWN (int): Tense is not applicable in the analyzed language or is not predicted.
- CONDITIONAL_TENSE (int): Conditional
- FUTURE (int): Future
- PAST (int): Past
- PRESENT (int): Present
- IMPERFECT (int): Imperfect
- PLUPERFECT (int): Pluperfect
- """
-
- TENSE_UNKNOWN = 0
- CONDITIONAL_TENSE = 1
- FUTURE = 2
- PAST = 3
- PRESENT = 4
- IMPERFECT = 5
- PLUPERFECT = 6
-
- class Voice(enum.IntEnum):
- """
- The relationship between the action that a verb expresses and the
- participants identified by its arguments.
-
- Attributes:
- VOICE_UNKNOWN (int): Voice is not applicable in the analyzed language or is not predicted.
- ACTIVE (int): Active
- CAUSATIVE (int): Causative
- PASSIVE (int): Passive
- """
-
- VOICE_UNKNOWN = 0
- ACTIVE = 1
- CAUSATIVE = 2
- PASSIVE = 3
diff --git a/google/cloud/language_v1/gapic/language_service_client.py b/google/cloud/language_v1/gapic/language_service_client.py
deleted file mode 100644
index 4dba1b05..00000000
--- a/google/cloud/language_v1/gapic/language_service_client.py
+++ /dev/null
@@ -1,578 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Accesses the google.cloud.language.v1 LanguageService API."""
-
-import pkg_resources
-import warnings
-
-from google.oauth2 import service_account
-import google.api_core.client_options
-import google.api_core.gapic_v1.client_info
-import google.api_core.gapic_v1.config
-import google.api_core.gapic_v1.method
-import google.api_core.grpc_helpers
-import grpc
-
-from google.cloud.language_v1.gapic import enums
-from google.cloud.language_v1.gapic import language_service_client_config
-from google.cloud.language_v1.gapic.transports import language_service_grpc_transport
-from google.cloud.language_v1.proto import language_service_pb2
-from google.cloud.language_v1.proto import language_service_pb2_grpc
-
-
-_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-language").version
-
-
-class LanguageServiceClient(object):
- """
- Provides text analysis operations such as sentiment analysis and entity
- recognition.
- """
-
- SERVICE_ADDRESS = "language.googleapis.com:443"
- """The default address of the service."""
-
- # The name of the interface for this client. This is the key used to
- # find the method configuration in the client_config dictionary.
- _INTERFACE_NAME = "google.cloud.language.v1.LanguageService"
-
- @classmethod
- def from_service_account_file(cls, filename, *args, **kwargs):
- """Creates an instance of this client using the provided credentials
- file.
-
- Args:
- filename (str): The path to the service account private key json
- file.
- args: Additional arguments to pass to the constructor.
- kwargs: Additional arguments to pass to the constructor.
-
- Returns:
- LanguageServiceClient: The constructed client.
- """
- credentials = service_account.Credentials.from_service_account_file(filename)
- kwargs["credentials"] = credentials
- return cls(*args, **kwargs)
-
- from_service_account_json = from_service_account_file
-
- def __init__(
- self,
- transport=None,
- channel=None,
- credentials=None,
- client_config=None,
- client_info=None,
- client_options=None,
- ):
- """Constructor.
-
- Args:
- transport (Union[~.LanguageServiceGrpcTransport,
- Callable[[~.Credentials, type], ~.LanguageServiceGrpcTransport]): A transport
- instance, responsible for actually making the API calls.
- The default transport uses the gRPC protocol.
- This argument may also be a callable which returns a
- transport instance. Callables will be sent the credentials
- as the first argument and the default transport class as
- the second argument.
- channel (grpc.Channel): DEPRECATED. A ``Channel`` instance
- through which to make calls. This argument is mutually exclusive
- with ``credentials``; providing both will raise an exception.
- credentials (google.auth.credentials.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If none
- are specified, the client will attempt to ascertain the
- credentials from the environment.
- This argument is mutually exclusive with providing a
- transport instance to ``transport``; doing so will raise
- an exception.
- client_config (dict): DEPRECATED. A dictionary of call options for
- each method. If not specified, the default configuration is used.
- client_info (google.api_core.gapic_v1.client_info.ClientInfo):
- The client info used to send a user-agent string along with
- API requests. If ``None``, then default info will be used.
- Generally, you only need to set this if you're developing
- your own client library.
- client_options (Union[dict, google.api_core.client_options.ClientOptions]):
- Client options used to set user options on the client. API Endpoint
- should be set through client_options.
- """
- # Raise deprecation warnings for things we want to go away.
- if client_config is not None:
- warnings.warn(
- "The `client_config` argument is deprecated.",
- PendingDeprecationWarning,
- stacklevel=2,
- )
- else:
- client_config = language_service_client_config.config
-
- if channel:
- warnings.warn(
- "The `channel` argument is deprecated; use " "`transport` instead.",
- PendingDeprecationWarning,
- stacklevel=2,
- )
-
- api_endpoint = self.SERVICE_ADDRESS
- if client_options:
- if type(client_options) == dict:
- client_options = google.api_core.client_options.from_dict(
- client_options
- )
- if client_options.api_endpoint:
- api_endpoint = client_options.api_endpoint
-
- # Instantiate the transport.
- # The transport is responsible for handling serialization and
- # deserialization and actually sending data to the service.
- if transport:
- if callable(transport):
- self.transport = transport(
- credentials=credentials,
- default_class=language_service_grpc_transport.LanguageServiceGrpcTransport,
- address=api_endpoint,
- )
- else:
- if credentials:
- raise ValueError(
- "Received both a transport instance and "
- "credentials; these are mutually exclusive."
- )
- self.transport = transport
- else:
- self.transport = language_service_grpc_transport.LanguageServiceGrpcTransport(
- address=api_endpoint, channel=channel, credentials=credentials
- )
-
- if client_info is None:
- client_info = google.api_core.gapic_v1.client_info.ClientInfo(
- gapic_version=_GAPIC_LIBRARY_VERSION
- )
- else:
- client_info.gapic_version = _GAPIC_LIBRARY_VERSION
- self._client_info = client_info
-
- # Parse out the default settings for retry and timeout for each RPC
- # from the client configuration.
- # (Ordinarily, these are the defaults specified in the `*_config.py`
- # file next to this one.)
- self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
- client_config["interfaces"][self._INTERFACE_NAME]
- )
-
- # Save a dictionary of cached API call functions.
- # These are the actual callables which invoke the proper
- # transport methods, wrapped with `wrap_method` to add retry,
- # timeout, and the like.
- self._inner_api_calls = {}
-
- # Service calls
- def analyze_sentiment(
- self,
- document,
- encoding_type=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Analyzes the sentiment of the provided text.
-
- Example:
- >>> from google.cloud import language_v1
- >>>
- >>> client = language_v1.LanguageServiceClient()
- >>>
- >>> # TODO: Initialize `document`:
- >>> document = {}
- >>>
- >>> response = client.analyze_sentiment(document)
-
- Args:
- document (Union[dict, ~google.cloud.language_v1.types.Document]): Input document.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.language_v1.types.Document`
- encoding_type (~google.cloud.language_v1.enums.EncodingType): The encoding type used by the API to calculate sentence offsets.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.language_v1.types.AnalyzeSentimentResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "analyze_sentiment" not in self._inner_api_calls:
- self._inner_api_calls[
- "analyze_sentiment"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.analyze_sentiment,
- default_retry=self._method_configs["AnalyzeSentiment"].retry,
- default_timeout=self._method_configs["AnalyzeSentiment"].timeout,
- client_info=self._client_info,
- )
-
- request = language_service_pb2.AnalyzeSentimentRequest(
- document=document, encoding_type=encoding_type
- )
- return self._inner_api_calls["analyze_sentiment"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def analyze_entities(
- self,
- document,
- encoding_type=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Finds named entities (currently proper names and common nouns) in the text
- along with entity types, salience, mentions for each entity, and
- other properties.
-
- Example:
- >>> from google.cloud import language_v1
- >>>
- >>> client = language_v1.LanguageServiceClient()
- >>>
- >>> # TODO: Initialize `document`:
- >>> document = {}
- >>>
- >>> response = client.analyze_entities(document)
-
- Args:
- document (Union[dict, ~google.cloud.language_v1.types.Document]): Input document.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.language_v1.types.Document`
- encoding_type (~google.cloud.language_v1.enums.EncodingType): The encoding type used by the API to calculate offsets.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.language_v1.types.AnalyzeEntitiesResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "analyze_entities" not in self._inner_api_calls:
- self._inner_api_calls[
- "analyze_entities"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.analyze_entities,
- default_retry=self._method_configs["AnalyzeEntities"].retry,
- default_timeout=self._method_configs["AnalyzeEntities"].timeout,
- client_info=self._client_info,
- )
-
- request = language_service_pb2.AnalyzeEntitiesRequest(
- document=document, encoding_type=encoding_type
- )
- return self._inner_api_calls["analyze_entities"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def analyze_entity_sentiment(
- self,
- document,
- encoding_type=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Finds entities, similar to ``AnalyzeEntities`` in the text and
- analyzes sentiment associated with each entity and its mentions.
-
- Example:
- >>> from google.cloud import language_v1
- >>>
- >>> client = language_v1.LanguageServiceClient()
- >>>
- >>> # TODO: Initialize `document`:
- >>> document = {}
- >>>
- >>> response = client.analyze_entity_sentiment(document)
-
- Args:
- document (Union[dict, ~google.cloud.language_v1.types.Document]): Input document.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.language_v1.types.Document`
- encoding_type (~google.cloud.language_v1.enums.EncodingType): The encoding type used by the API to calculate offsets.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.language_v1.types.AnalyzeEntitySentimentResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "analyze_entity_sentiment" not in self._inner_api_calls:
- self._inner_api_calls[
- "analyze_entity_sentiment"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.analyze_entity_sentiment,
- default_retry=self._method_configs["AnalyzeEntitySentiment"].retry,
- default_timeout=self._method_configs["AnalyzeEntitySentiment"].timeout,
- client_info=self._client_info,
- )
-
- request = language_service_pb2.AnalyzeEntitySentimentRequest(
- document=document, encoding_type=encoding_type
- )
- return self._inner_api_calls["analyze_entity_sentiment"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def analyze_syntax(
- self,
- document,
- encoding_type=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Analyzes the syntax of the text and provides sentence boundaries and
- tokenization along with part of speech tags, dependency trees, and other
- properties.
-
- Example:
- >>> from google.cloud import language_v1
- >>>
- >>> client = language_v1.LanguageServiceClient()
- >>>
- >>> # TODO: Initialize `document`:
- >>> document = {}
- >>>
- >>> response = client.analyze_syntax(document)
-
- Args:
- document (Union[dict, ~google.cloud.language_v1.types.Document]): Input document.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.language_v1.types.Document`
- encoding_type (~google.cloud.language_v1.enums.EncodingType): The encoding type used by the API to calculate offsets.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.language_v1.types.AnalyzeSyntaxResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "analyze_syntax" not in self._inner_api_calls:
- self._inner_api_calls[
- "analyze_syntax"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.analyze_syntax,
- default_retry=self._method_configs["AnalyzeSyntax"].retry,
- default_timeout=self._method_configs["AnalyzeSyntax"].timeout,
- client_info=self._client_info,
- )
-
- request = language_service_pb2.AnalyzeSyntaxRequest(
- document=document, encoding_type=encoding_type
- )
- return self._inner_api_calls["analyze_syntax"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def classify_text(
- self,
- document,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Classifies a document into categories.
-
- Example:
- >>> from google.cloud import language_v1
- >>>
- >>> client = language_v1.LanguageServiceClient()
- >>>
- >>> # TODO: Initialize `document`:
- >>> document = {}
- >>>
- >>> response = client.classify_text(document)
-
- Args:
- document (Union[dict, ~google.cloud.language_v1.types.Document]): Input document.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.language_v1.types.Document`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.language_v1.types.ClassifyTextResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "classify_text" not in self._inner_api_calls:
- self._inner_api_calls[
- "classify_text"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.classify_text,
- default_retry=self._method_configs["ClassifyText"].retry,
- default_timeout=self._method_configs["ClassifyText"].timeout,
- client_info=self._client_info,
- )
-
- request = language_service_pb2.ClassifyTextRequest(document=document)
- return self._inner_api_calls["classify_text"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def annotate_text(
- self,
- document,
- features,
- encoding_type=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- A convenience method that provides all the features that analyzeSentiment,
- analyzeEntities, and analyzeSyntax provide in one call.
-
- Example:
- >>> from google.cloud import language_v1
- >>>
- >>> client = language_v1.LanguageServiceClient()
- >>>
- >>> # TODO: Initialize `document`:
- >>> document = {}
- >>>
- >>> # TODO: Initialize `features`:
- >>> features = {}
- >>>
- >>> response = client.annotate_text(document, features)
-
- Args:
- document (Union[dict, ~google.cloud.language_v1.types.Document]): Input document.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.language_v1.types.Document`
- features (Union[dict, ~google.cloud.language_v1.types.Features]): The enabled features.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.language_v1.types.Features`
- encoding_type (~google.cloud.language_v1.enums.EncodingType): The encoding type used by the API to calculate offsets.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.language_v1.types.AnnotateTextResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "annotate_text" not in self._inner_api_calls:
- self._inner_api_calls[
- "annotate_text"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.annotate_text,
- default_retry=self._method_configs["AnnotateText"].retry,
- default_timeout=self._method_configs["AnnotateText"].timeout,
- client_info=self._client_info,
- )
-
- request = language_service_pb2.AnnotateTextRequest(
- document=document, features=features, encoding_type=encoding_type
- )
- return self._inner_api_calls["annotate_text"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
diff --git a/google/cloud/language_v1/gapic/language_service_client_config.py b/google/cloud/language_v1/gapic/language_service_client_config.py
deleted file mode 100644
index 061d053e..00000000
--- a/google/cloud/language_v1/gapic/language_service_client_config.py
+++ /dev/null
@@ -1,53 +0,0 @@
-config = {
- "interfaces": {
- "google.cloud.language.v1.LanguageService": {
- "retry_codes": {
- "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
- "non_idempotent": [],
- },
- "retry_params": {
- "default": {
- "initial_retry_delay_millis": 100,
- "retry_delay_multiplier": 1.3,
- "max_retry_delay_millis": 60000,
- "initial_rpc_timeout_millis": 20000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 20000,
- "total_timeout_millis": 600000,
- }
- },
- "methods": {
- "AnalyzeSentiment": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "default",
- },
- "AnalyzeEntities": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "default",
- },
- "AnalyzeEntitySentiment": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "default",
- },
- "AnalyzeSyntax": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "default",
- },
- "ClassifyText": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "default",
- },
- "AnnotateText": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "default",
- },
- },
- }
- }
-}
diff --git a/google/cloud/language_v1/gapic/transports/__init__.py b/google/cloud/language_v1/gapic/transports/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/google/cloud/language_v1/gapic/transports/language_service_grpc_transport.py b/google/cloud/language_v1/gapic/transports/language_service_grpc_transport.py
deleted file mode 100644
index 5784072c..00000000
--- a/google/cloud/language_v1/gapic/transports/language_service_grpc_transport.py
+++ /dev/null
@@ -1,197 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import google.api_core.grpc_helpers
-
-from google.cloud.language_v1.proto import language_service_pb2_grpc
-
-
-class LanguageServiceGrpcTransport(object):
- """gRPC transport class providing stubs for
- google.cloud.language.v1 LanguageService API.
-
- The transport provides access to the raw gRPC stubs,
- which can be used to take advantage of advanced
- features of gRPC.
- """
-
- # The scopes needed to make gRPC calls to all of the methods defined
- # in this service.
- _OAUTH_SCOPES = (
- "https://www.googleapis.com/auth/cloud-language",
- "https://www.googleapis.com/auth/cloud-platform",
- )
-
- def __init__(
- self, channel=None, credentials=None, address="language.googleapis.com:443"
- ):
- """Instantiate the transport class.
-
- Args:
- channel (grpc.Channel): A ``Channel`` instance through
- which to make calls. This argument is mutually exclusive
- with ``credentials``; providing both will raise an exception.
- credentials (google.auth.credentials.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If none
- are specified, the client will attempt to ascertain the
- credentials from the environment.
- address (str): The address where the service is hosted.
- """
- # If both `channel` and `credentials` are specified, raise an
- # exception (channels come with credentials baked in already).
- if channel is not None and credentials is not None:
- raise ValueError(
- "The `channel` and `credentials` arguments are mutually " "exclusive."
- )
-
- # Create the channel.
- if channel is None:
- channel = self.create_channel(
- address=address,
- credentials=credentials,
- options={
- "grpc.max_send_message_length": -1,
- "grpc.max_receive_message_length": -1,
- }.items(),
- )
-
- self._channel = channel
-
- # gRPC uses objects called "stubs" that are bound to the
- # channel and provide a basic method for each RPC.
- self._stubs = {
- "language_service_stub": language_service_pb2_grpc.LanguageServiceStub(
- channel
- )
- }
-
- @classmethod
- def create_channel(
- cls, address="language.googleapis.com:443", credentials=None, **kwargs
- ):
- """Create and return a gRPC channel object.
-
- Args:
- address (str): The host for the channel to use.
- credentials (~.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If
- none are specified, the client will attempt to ascertain
- the credentials from the environment.
- kwargs (dict): Keyword arguments, which are passed to the
- channel creation.
-
- Returns:
- grpc.Channel: A gRPC channel object.
- """
- return google.api_core.grpc_helpers.create_channel(
- address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
- )
-
- @property
- def channel(self):
- """The gRPC channel used by the transport.
-
- Returns:
- grpc.Channel: A gRPC channel object.
- """
- return self._channel
-
- @property
- def analyze_sentiment(self):
- """Return the gRPC stub for :meth:`LanguageServiceClient.analyze_sentiment`.
-
- Analyzes the sentiment of the provided text.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["language_service_stub"].AnalyzeSentiment
-
- @property
- def analyze_entities(self):
- """Return the gRPC stub for :meth:`LanguageServiceClient.analyze_entities`.
-
- Finds named entities (currently proper names and common nouns) in the text
- along with entity types, salience, mentions for each entity, and
- other properties.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["language_service_stub"].AnalyzeEntities
-
- @property
- def analyze_entity_sentiment(self):
- """Return the gRPC stub for :meth:`LanguageServiceClient.analyze_entity_sentiment`.
-
- Finds entities, similar to ``AnalyzeEntities`` in the text and
- analyzes sentiment associated with each entity and its mentions.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["language_service_stub"].AnalyzeEntitySentiment
-
- @property
- def analyze_syntax(self):
- """Return the gRPC stub for :meth:`LanguageServiceClient.analyze_syntax`.
-
- Analyzes the syntax of the text and provides sentence boundaries and
- tokenization along with part of speech tags, dependency trees, and other
- properties.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["language_service_stub"].AnalyzeSyntax
-
- @property
- def classify_text(self):
- """Return the gRPC stub for :meth:`LanguageServiceClient.classify_text`.
-
- Classifies a document into categories.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["language_service_stub"].ClassifyText
-
- @property
- def annotate_text(self):
- """Return the gRPC stub for :meth:`LanguageServiceClient.annotate_text`.
-
- A convenience method that provides all the features that analyzeSentiment,
- analyzeEntities, and analyzeSyntax provide in one call.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["language_service_stub"].AnnotateText
diff --git a/google/cloud/language_v1/proto/__init__.py b/google/cloud/language_v1/proto/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/google/cloud/language_v1/proto/language_service.proto b/google/cloud/language_v1/proto/language_service.proto
deleted file mode 100644
index e8e4fd8d..00000000
--- a/google/cloud/language_v1/proto/language_service.proto
+++ /dev/null
@@ -1,1122 +0,0 @@
-// Copyright 2019 Google LLC.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-syntax = "proto3";
-
-package google.cloud.language.v1;
-
-import "google/api/annotations.proto";
-import "google/api/client.proto";
-import "google/api/field_behavior.proto";
-
-option go_package = "google.golang.org/genproto/googleapis/cloud/language/v1;language";
-option java_multiple_files = true;
-option java_outer_classname = "LanguageServiceProto";
-option java_package = "com.google.cloud.language.v1";
-
-
-// Provides text analysis operations such as sentiment analysis and entity
-// recognition.
-service LanguageService {
- option (google.api.default_host) = "language.googleapis.com";
- option (google.api.oauth_scopes) =
- "https://www.googleapis.com/auth/cloud-language,"
- "https://www.googleapis.com/auth/cloud-platform";
- // Analyzes the sentiment of the provided text.
- rpc AnalyzeSentiment(AnalyzeSentimentRequest) returns (AnalyzeSentimentResponse) {
- option (google.api.http) = {
- post: "/v1/documents:analyzeSentiment"
- body: "*"
- };
- option (google.api.method_signature) = "document,encoding_type";
- option (google.api.method_signature) = "document";
- }
-
- // Finds named entities (currently proper names and common nouns) in the text
- // along with entity types, salience, mentions for each entity, and
- // other properties.
- rpc AnalyzeEntities(AnalyzeEntitiesRequest) returns (AnalyzeEntitiesResponse) {
- option (google.api.http) = {
- post: "/v1/documents:analyzeEntities"
- body: "*"
- };
- option (google.api.method_signature) = "document,encoding_type";
- option (google.api.method_signature) = "document";
- }
-
- // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
- // sentiment associated with each entity and its mentions.
- rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) returns (AnalyzeEntitySentimentResponse) {
- option (google.api.http) = {
- post: "/v1/documents:analyzeEntitySentiment"
- body: "*"
- };
- option (google.api.method_signature) = "document,encoding_type";
- option (google.api.method_signature) = "document";
- }
-
- // Analyzes the syntax of the text and provides sentence boundaries and
- // tokenization along with part of speech tags, dependency trees, and other
- // properties.
- rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) {
- option (google.api.http) = {
- post: "/v1/documents:analyzeSyntax"
- body: "*"
- };
- option (google.api.method_signature) = "document,encoding_type";
- option (google.api.method_signature) = "document";
- }
-
- // Classifies a document into categories.
- rpc ClassifyText(ClassifyTextRequest) returns (ClassifyTextResponse) {
- option (google.api.http) = {
- post: "/v1/documents:classifyText"
- body: "*"
- };
- option (google.api.method_signature) = "document";
- }
-
- // A convenience method that provides all the features that analyzeSentiment,
- // analyzeEntities, and analyzeSyntax provide in one call.
- rpc AnnotateText(AnnotateTextRequest) returns (AnnotateTextResponse) {
- option (google.api.http) = {
- post: "/v1/documents:annotateText"
- body: "*"
- };
- option (google.api.method_signature) = "document,features,encoding_type";
- option (google.api.method_signature) = "document,features";
- }
-}
-
-// ################################################################ #
-//
-// Represents the input to API methods.
-message Document {
- // The document types enum.
- enum Type {
- // The content type is not specified.
- TYPE_UNSPECIFIED = 0;
-
- // Plain text
- PLAIN_TEXT = 1;
-
- // HTML
- HTML = 2;
- }
-
- // Required. If the type is not set or is `TYPE_UNSPECIFIED`,
- // returns an `INVALID_ARGUMENT` error.
- Type type = 1;
-
- // The source of the document: a string containing the content or a
- // Google Cloud Storage URI.
- oneof source {
- // The content of the input in string format.
- // Cloud audit logging exempt since it is based on user data.
- string content = 2;
-
- // The Google Cloud Storage URI where the file content is located.
- // This URI must be of the form: gs://bucket_name/object_name. For more
- // details, see https://cloud.google.com/storage/docs/reference-uris.
- // NOTE: Cloud Storage object versioning is not supported.
- string gcs_content_uri = 3;
- }
-
- // The language of the document (if not specified, the language is
- // automatically detected). Both ISO and BCP-47 language codes are
- // accepted.number – the actual number, broken down into
- // sections as per local conventionnational_prefix
- // – country code, if detectedarea_code –
- // region or area code, if detectedextension –
- // phone extension (to be dialed after connection), if detectedstreet_number – street numberlocality – city or townstreet_name – street/route name, if detectedpostal_code – postal code, if detectedcountry – country, if detectedbroad_region – administrative area, such as the
- // state, if detectednarrow_region – smaller
- // administrative area, such as county, if detectedsublocality – used in Asian addresses to demark a
- // district within a city, if detectedyear – four digit year, if detectedmonth – two digit month number, if detectedday – two digit day number, if detectedvalue and currency.
- PRICE = 13;
- }
-
- // The representative name for the entity.
- string name = 1;
-
- // The entity type.
- Type type = 2;
-
- // Metadata associated with the entity.
- //
- // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
- // and Knowledge Graph MID (`mid`), if they are available. For the metadata
- // associated with other entity types, see the Type table below.
- map