Skip to content

Commit

Permalink
Language samples (#845)
Browse files Browse the repository at this point in the history
* Language samples

* Updates to recently published libraries.

* Updates to latest client library version.

* Moves new production features to v1, updates tests, updates docs.
  • Loading branch information
jabubake authored Sep 19, 2017
1 parent bd89eb9 commit 2ec36ec
Show file tree
Hide file tree
Showing 10 changed files with 476 additions and 525 deletions.
24 changes: 19 additions & 5 deletions language/analysis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ mvn clean compile assembly:single
```

We can then run the assembled JAR file with the `java` command. The variable $COMMAND takes
three values `entities`, `sentiment`, or `syntax`.
three values `entities`, `entities-sentiment`, `sentiment`, or `syntax`.

## Basic usage:

```
java -cp target/language-entities-1.0-jar-with-dependencies.jar \
com.google.cloud.language.samples.Analyze \
<entities | sentiment | syntax> \
<entities | entities-sentiment | sentiment | syntax> \
<text | GCS path>
```

Expand All @@ -61,6 +61,13 @@ java -cp target/language-entities-1.0-jar-with-dependencies.jar \
"The quick brown fox jumped over the lazy dog."
```

Analyze entity sentiment
```
java -cp target/language-entities-1.0-jar-with-dependencies.jar \
com.google.cloud.language.samples.Analyze entities-sentiment \
"There's nothing better than searching for ice cream on Google."
```

Analyze syntax
```
java -cp target/language-entities-1.0-jar-with-dependencies.jar \
Expand Down Expand Up @@ -92,11 +99,18 @@ java -cp target/language-entities-1.0-jar-with-dependencies.jar \
"Der schnelle braune Fuchs sprang über den faulen Hund."
```

Analyze entity sentiment Beta
Analyze categories in text Beta
```
java -cp target/language-entities-1.0-jar-with-dependencies.jar \
com.google.cloud.language.samples.AnalyzeBeta entities-sentiment \
"There's nothing better than searching for ice cream on Google."
com.google.cloud.language.samples.AnalyzeBeta classify \
"Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets."
```

Analyze categories in GCS file Beta
```
java -cp target/language-entities-1.0-jar-with-dependencies.jar \
com.google.cloud.language.samples.AnalyzeBeta classify \
"gs://cloud-samples-tests/natural-language/android-text.txt"
```

Run beta demo from *nix or OSX
Expand Down
9 changes: 1 addition & 8 deletions language/analysis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ limitations under the License.
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-language</artifactId>
<version>0.21.1-beta</version>
<version>0.24.0-beta</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand All @@ -41,13 +41,6 @@ limitations under the License.
</dependency>
<!-- [END dependencies] -->

<!-- FIXME: remove after client fixes depenency issue -->
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>0.7.1</version>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
Expand Down
Loading

0 comments on commit 2ec36ec

Please sign in to comment.