@@ -90,8 +90,6 @@ def __init__(self,
9090 client library metrics. Ultimately serializes to a string
9191 (e.g. 'foo/1.2.3 bar/3.14.1'). This argument should be
9292 considered private.
93-
94- Returns: LanguageServiceClient
9593 """
9694 # Unless the calling application specifically requested
9795 # OAuth scopes, request everything.
@@ -139,6 +137,9 @@ def __init__(self,
139137 self ._analyze_entities = api_callable .create_api_call (
140138 self .language_service_stub .AnalyzeEntities ,
141139 settings = defaults ['analyze_entities' ])
140+ self ._analyze_entity_sentiment = api_callable .create_api_call (
141+ self .language_service_stub .AnalyzeEntitySentiment ,
142+ settings = defaults ['analyze_entity_sentiment' ])
142143 self ._analyze_syntax = api_callable .create_api_call (
143144 self .language_service_stub .AnalyzeSyntax ,
144145 settings = defaults ['analyze_syntax' ])
@@ -213,6 +214,42 @@ def analyze_entities(self, document, encoding_type=None, options=None):
213214 document = document , encoding_type = encoding_type )
214215 return self ._analyze_entities (request , options )
215216
217+ def analyze_entity_sentiment (self ,
218+ document ,
219+ encoding_type = None ,
220+ options = None ):
221+ """
222+ Finds entities, similar to ``AnalyzeEntities`` in the text and analyzes
223+ sentiment associated with each entity and its mentions.
224+
225+ Example:
226+ >>> from google.cloud import language_v1
227+ >>>
228+ >>> client = language_v1.LanguageServiceClient()
229+ >>>
230+ >>> document = {}
231+ >>>
232+ >>> response = client.analyze_entity_sentiment(document)
233+
234+ Args:
235+ document (Union[dict, ~google.cloud.language_v1.types.Document]): Input document.
236+ If a dict is provided, it must be of the same form as the protobuf
237+ message :class:`~google.cloud.language_v1.types.Document`
238+ encoding_type (~google.cloud.language_v1.types.EncodingType): The encoding type used by the API to calculate offsets.
239+ options (~google.gax.CallOptions): Overrides the default
240+ settings for this call, e.g, timeout, retries etc.
241+
242+ Returns:
243+ A :class:`~google.cloud.language_v1.types.AnalyzeEntitySentimentResponse` instance.
244+
245+ Raises:
246+ :exc:`google.gax.errors.GaxError` if the RPC is aborted.
247+ :exc:`ValueError` if the parameters are invalid.
248+ """
249+ request = language_service_pb2 .AnalyzeEntitySentimentRequest (
250+ document = document , encoding_type = encoding_type )
251+ return self ._analyze_entity_sentiment (request , options )
252+
216253 def analyze_syntax (self , document , encoding_type = None , options = None ):
217254 """
218255 Analyzes the syntax of the text and provides sentence boundaries and
0 commit comments