diff --git a/docs/language-usage.rst b/docs/language-usage.rst index da8de49054e4..bb443f89054c 100644 --- a/docs/language-usage.rst +++ b/docs/language-usage.rst @@ -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>`, @@ -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) @@ -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) @@ -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)