Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken language examples. #3220

Merged
merged 2 commits into from
Mar 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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