@@ -32,24 +32,37 @@ mvn clean compile assembly:single
3232We can then run the assembled JAR file with the ` java ` command. The variable $COMMAND takes
3333three values ` entities ` , ` sentiment ` , or ` syntax ` .
3434
35+ Basic usage:
36+
3537```
36- MAIN_CLASS=com.google.cloud.language.samples.Analyze
37- JAR_FILE=target/language-entities-1.0-jar-with-dependencies.jar
38- java -cp $JAR_FILE $MAIN_CLASS <sentiment|entities|syntax> <text|path>
38+ function run_nl {
39+ local MAIN_CLASS=com.google.cloud.language.samples.Analyze
40+ local JAR_FILE=target/language-entities-1.0-jar-with-dependencies.jar
41+ java -cp ${JAR_FILE} ${MAIN_CLASS} $1 "$2"
42+ }
43+ run_nl entities "The quick fox jumped over the lazy dog."
44+ run_nl sentiment "The quick fox jumped over the lazy dog."
45+ run_nl syntax "The quick fox jumped over the lazy dog."
3946```
4047
41- Example usage:
42-
48+ Additional examples:
4349```
44- QUOTE="Larry Page, Google's co-founder, once described the 'perfect search
45- engine' as something that 'understands exactly what you mean and gives you
46- back exactly what you want.' Since he spoke those words Google has grown to
47- offer products beyond search, but the spirit of what he said remains."
48-
49- java -cp $JAR_FILE $MAIN_CLASS entities "$QUOTE"
50- java -cp $JAR_FILE $MAIN_CLASS entities "gs://bucket/file.txt"
51- java -cp $JAR_FILE $MAIN_CLASS sentiment "$QUOTE"
52- java -cp $JAR_FILE $MAIN_CLASS sentiment "gs://bucket/file.txt"
53- java -cp $JAR_FILE $MAIN_CLASS syntax "$QUOTE"
54- java -cp $JAR_FILE $MAIN_CLASS syntax "gs://bucket/file.txt"
50+ function run_nl_all {
51+ local MAIN_CLASS=com.google.cloud.language.samples.Analyze
52+ local JAR_FILE=target/language-entities-1.0-jar-with-dependencies.jar
53+ local QUOTE="Larry Page, Google's co-founder, once described the 'perfect search
54+ engine' as something that 'understands exactly what you mean and gives you
55+ back exactly what you want.' Since he spoke those words Google has grown to
56+ offer products beyond search, but the spirit of what he said remains."
57+ local GS_PATH="gs://bucket/file"
58+
59+ java -cp ${JAR_FILE} ${MAIN_CLASS} entities "${QUOTE}"
60+ java -cp ${JAR_FILE} ${MAIN_CLASS} entities "${GS_PATH}"
61+ java -cp ${JAR_FILE} ${MAIN_CLASS} sentiment "${QUOTE}"
62+ java -cp ${JAR_FILE} ${MAIN_CLASS} sentiment "${GS_PATH}"
63+ java -cp ${JAR_FILE} ${MAIN_CLASS} syntax "${QUOTE}"
64+ java -cp ${JAR_FILE} ${MAIN_CLASS} syntax "${GS_PATH}"
65+ }
66+
67+ run_nl_all
5568```
0 commit comments