@@ -32,56 +32,49 @@ mvn clean compile assembly:single
32
32
We can then run the assembled JAR file with the ` java ` command. The variable $COMMAND takes
33
33
three values ` entities ` , ` sentiment ` , or ` syntax ` .
34
34
35
- Basic usage:
35
+ ## Basic usage:
36
36
37
37
```
38
- #######################################
39
- # Performs a language operation on the given text or GCS object.
40
- # Globals:
41
- # None
42
- # Arguments:
43
- # $1 The operation to perform, either entities, sentiment, or syntax.
44
- # $2 The text or GCS object to operate on.
45
- # Returns:
46
- # None
47
- #######################################
48
- function run_nl() {
49
- local main_class=com.google.cloud.language.samples.Analyze
50
- local jar_file=target/language-entities-1.0-jar-with-dependencies.jar
51
- java -cp ${jar_file} ${main_class} $1 "$2"
52
- }
53
- run_nl entities "The quick brown fox jumped over the lazy dog."
54
- run_nl sentiment "The quick brown fox jumped over the lazy dog."
55
- run_nl syntax "The quick brown fox jumped over the lazy dog."
38
+ java -cp target/language-entities-1.0-jar-with-dependencies.jar \
39
+ com.google.cloud.language.samples.Analyze \
40
+ <entities | sentiment | syntax> \
41
+ <text | GCS path>
56
42
```
57
43
58
- Additional examples:
44
+ ### Usage Examples
45
+ Analyze entities
59
46
```
60
- #######################################
61
- # Exercises the sample code on various example text and GCS objects.
62
- # Globals:
63
- # None
64
- # Arguments:
65
- # None
66
- # Returns:
67
- # None
68
- #######################################
69
- function run_nl_all() {
70
- local main_class=com.google.cloud.language.samples.Analyze
71
- local jar_file=target/language-entities-1.0-jar-with-dependencies.jar
72
- local quote="Larry Page, Google's co-founder, once described the 'perfect search
73
- engine' as something that 'understands exactly what you mean and gives you
74
- back exactly what you want.' Since he spoke those words Google has grown to
75
- offer products beyond search, but the spirit of what he said remains."
76
- local gs_path="gs://bucket/file"
77
-
78
- java -cp ${jar_file} ${main_class} entities "${quote}"
79
- java -cp ${jar_file} ${main_class} entities "${gs_path}"
80
- java -cp ${jar_file} ${main_class} sentiment "${quote}"
81
- java -cp ${jar_file} ${main_class} sentiment "${gs_path}"
82
- java -cp ${jar_file} ${main_class} syntax "${quote}"
83
- java -cp ${jar_file} ${main_class} syntax "${gs_path}"
84
- }
85
-
86
- run_nl_all
47
+ java -cp target/language-entities-1.0-jar-with-dependencies.jar \
48
+ com.google.cloud.language.samples.Analyze \
49
+ entities \
50
+ "The quick brown fox jumped over the lazy dog."
51
+ ```
52
+
53
+ Analyze sentiment
54
+ ```
55
+ java -cp target/language-entities-1.0-jar-with-dependencies.jar \
56
+ com.google.cloud.language.samples.Analyze \
57
+ sentiment \
58
+ "The quick brown fox jumped over the lazy dog."
59
+ ```
60
+
61
+ Analyze syntax
62
+ ```
63
+ java -cp target/language-entities-1.0-jar-with-dependencies.jar \
64
+ com.google.cloud.language.samples.Analyze \
65
+ syntax \
66
+ "The quick brown fox jumped over the lazy dog."
67
+ ```
68
+
69
+ Included with the sample are ` demo.sh ` and ` demo.bat ` which show additional
70
+ examples of usage.
71
+
72
+ Run demo from * nix or OSX
73
+ ```
74
+ demo.sh
75
+ ```
76
+
77
+ Run demo from Windows
78
+ ```
79
+ demo
87
80
```
0 commit comments