Skip to content

Commit

Permalink
Fix broken language examples. (#3220)
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster authored and lukesneeringer committed Mar 30, 2017
1 parent af37aca commit 0541dc0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/language-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ UTF-8. To over-ride these values:

.. code-block:: python
>>> client = language.Client(language='es',
... encoding=language.Encoding.UTF16)
>>> document = client.document_from_text(
... text_content, language='es', encoding=language.Encoding.UTF16)
The encoding can be one of
:attr:`Encoding.UTF8 <google.cloud.language.document.Encoding.UTF8>`,
Expand Down Expand Up @@ -153,7 +154,7 @@ metadata and other properties.
>>> text_content = ("Michelangelo Caravaggio, Italian painter, is "
... "known for 'The Calling of Saint Matthew'.")
>>> document = client.document(text_content)
>>> document = client.document_from_text(text_content)
>>> entity_response = document.analyze_entities()
>>> for entity in entity_response.entities:
... print('=' * 20)
Expand Down Expand Up @@ -188,7 +189,7 @@ only supports English text.
.. code-block:: python
>>> text_content = "Jogging isn't very fun."
>>> document = client.document(text_content)
>>> document = client.document_from_text(text_content)
>>> sentiment_response = document.analyze_sentiment()
>>> sentiment = sentiment_response.sentiment
>>> print(sentiment.score)
Expand Down Expand Up @@ -229,7 +230,7 @@ the response is :data:`None`.
.. code-block:: python
>>> text_content = 'The cow jumped over the Moon.'
>>> document = client.document(text_content)
>>> document = client.document_from_text(text_content)
>>> annotations = document.annotate_text()
>>> # Sentences present if include_syntax=True
>>> print(annotations.sentences)
Expand Down

0 comments on commit 0541dc0

Please sign in to comment.