Changeset 33397 for gs3-extensions
- Timestamp:
- 2019-08-11T19:30:49+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/maori-lang-detection/src/MaoriTextDetector.java
r33355 r33397 19 19 */ 20 20 21 package org.greenstone.atea; 22 21 23 import java.io.*; 22 24 import opennlp.tools.langdetect.*; … … 29 31 * 30 32 * Then, to compile this program, do the following from the "src" folder (the folder containing this java file): 31 * maori-lang-detection/src$ javac -cp ".:$OPENNLP_HOME/lib/opennlp-tools-1.9.1.jar" MaoriTextDetector.java33 * maori-lang-detection/src$ javac -cp ".:$OPENNLP_HOME/lib/opennlp-tools-1.9.1.jar" org/greenstone/atea/MaoriTextDetector.java 32 34 * 33 35 * To run this program, issue one of the following commands from the "src" folder (the folder containing this java file): 34 36 * 35 * maori-lang-detection/src$ java -cp ".:$OPENNLP_HOME/lib/ *"MaoriTextDetector --help36 * 37 * maori-lang-detection/src$ java -cp ".:$OPENNLP_HOME/lib/ *"MaoriTextDetector --file <full/path/to/textfile>38 * 39 * maori-lang-detection/src$ java -cp ".:$OPENNLP_HOME/lib/ *"MaoriTextDetector -37 * maori-lang-detection/src$ java -cp ".:$OPENNLP_HOME/lib/opennlp-tools-1.9.1.jar" org.greenstone.atea.MaoriTextDetector --help 38 * 39 * maori-lang-detection/src$ java -cp ".:$OPENNLP_HOME/lib/opennlp-tools-1.9.1.jar" org.greenstone.atea.MaoriTextDetector --file <full/path/to/textfile> 40 * 41 * maori-lang-detection/src$ java -cp ".:$OPENNLP_HOME/lib/opennlp-tools-1.9.1.jar" org.greenstone.atea.MaoriTextDetector - 40 42 * Press enter. This variant of the program expects text to stream in from standard input. 41 43 * If entering text manually, then remember to press Ctrl-D to indicate the usual end of StdIn. … … 363 365 } 364 366 365 if(!readFromStdIn && inFile == null) { // at least one input source must be provided 366 doPrintErr(runSilent, "ERROR: must specify source to read text from, either STDIN (-) or input file (--file <file>).\n"); 367 printUsage = true; 368 returnVal = -1; 369 } 370 371 if(readFromStdIn && inFile != null) { // this program can't be asked to read from stdin and from an input file 372 doPrintErr(runSilent, "ERROR: instructed to read from both STDIN and from an input file. Not possible.\n"); 373 printUsage = true; 374 returnVal = -1; 367 if(returnVal != 2) { // returnVal == 2 for help. Only if the user did not request --help/-h, do we continue to make sure the arguments provided are sane 368 if(!readFromStdIn && inFile == null) { // at least one input source must be provided 369 doPrintErr(runSilent, "ERROR: must specify source to read text from, either STDIN (-) or input file (--file <file>).\n"); 370 printUsage = true; 371 returnVal = -1; 372 } 373 374 if(readFromStdIn && inFile != null) { // this program can't be asked to read from stdin and from an input file 375 doPrintErr(runSilent, "ERROR: instructed to read from both STDIN and from an input file. Not possible.\n"); 376 printUsage = true; 377 returnVal = -1; 378 } 375 379 } 376 380
Note:
See TracChangeset
for help on using the changeset viewer.