From 84953d8c1bd1b2304190b58c8643b03020631ede Mon Sep 17 00:00:00 2001 From: Gus Class Date: Tue, 10 Jan 2017 12:53:07 -0800 Subject: [PATCH 1/2] Adds note regarding AE standard --- language/analysis/README.md | 2 ++ .../java/com/google/cloud/language/samples/Analyze.java | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/language/analysis/README.md b/language/analysis/README.md index 587999420d3..14836f85f44 100644 --- a/language/analysis/README.md +++ b/language/analysis/README.md @@ -10,6 +10,8 @@ for entity recognition. This sample requires you to have [Java8](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html). +**Note** The Natural Language client is not supported by App Engine Standard. + ## Download Maven This sample uses the [Apache Maven][maven] build system. Before getting started, be diff --git a/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java b/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java index 9b4adfcff96..08b19f82d8e 100644 --- a/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java +++ b/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java @@ -169,6 +169,7 @@ public Analyze(LanguageServiceClient languageApi) { * Gets {@link Entity}s from the string {@code text}. */ public List analyzeEntitiesText(String text) throws IOException { + // Note: This does not work on App Engine standard. Document doc = Document.newBuilder() .setContent(text).setType(Type.PLAIN_TEXT).build(); AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder() @@ -182,6 +183,7 @@ public List analyzeEntitiesText(String text) throws IOException { * Gets {@link Entity}s from the contents of the object at the given GCS {@code path}. */ public List analyzeEntitiesFile(String path) throws IOException { + // Note: This does not work on App Engine standard. Document doc = Document.newBuilder() .setGcsContentUri(path).setType(Type.PLAIN_TEXT).build(); AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder() @@ -195,6 +197,7 @@ public List analyzeEntitiesFile(String path) throws IOException { * Gets {@link Sentiment} from the string {@code text}. */ public Sentiment analyzeSentimentText(String text) throws IOException { + // Note: This does not work on App Engine standard. Document doc = Document.newBuilder() .setContent(text).setType(Type.PLAIN_TEXT).build(); AnalyzeSentimentResponse response = languageApi.analyzeSentiment(doc); @@ -205,6 +208,7 @@ public Sentiment analyzeSentimentText(String text) throws IOException { * Gets {@link Sentiment} from the contents of the object at the given GCS {@code path}. */ public Sentiment analyzeSentimentFile(String path) throws IOException { + // Note: This does not work on App Engine standard. Document doc = Document.newBuilder() .setGcsContentUri(path).setType(Type.PLAIN_TEXT).build(); AnalyzeSentimentResponse response = languageApi.analyzeSentiment(doc); @@ -215,6 +219,7 @@ public Sentiment analyzeSentimentFile(String path) throws IOException { * Gets {@link Token}s from the string {@code text}. */ public List analyzeSyntaxText(String text) throws IOException { + // Note: This does not work on App Engine standard. Document doc = Document.newBuilder() .setContent(text).setType(Type.PLAIN_TEXT).build(); AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder() @@ -228,6 +233,8 @@ public List analyzeSyntaxText(String text) throws IOException { * Gets {@link Token}s from the contents of the object at the given GCS {@code path}. */ public List analyzeSyntaxFile(String path) throws IOException { + // Note: This does not work on App Engine standard. + Document doc = Document.newBuilder() Document doc = Document.newBuilder() .setGcsContentUri(path).setType(Type.PLAIN_TEXT).build(); AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder() From 39eaaf21ab1994478848a1504ecc9ee55bd28a9e Mon Sep 17 00:00:00 2001 From: Gus Class Date: Tue, 10 Jan 2017 15:55:23 -0800 Subject: [PATCH 2/2] Fixes bad copy/paste. --- .../src/main/java/com/google/cloud/language/samples/Analyze.java | 1 - 1 file changed, 1 deletion(-) diff --git a/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java b/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java index 08b19f82d8e..0d6ae43601d 100644 --- a/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java +++ b/language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java @@ -234,7 +234,6 @@ public List analyzeSyntaxText(String text) throws IOException { */ public List analyzeSyntaxFile(String path) throws IOException { // Note: This does not work on App Engine standard. - Document doc = Document.newBuilder() Document doc = Document.newBuilder() .setGcsContentUri(path).setType(Type.PLAIN_TEXT).build(); AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder()