Skip to content

Commit

Permalink
Working example script
Browse files Browse the repository at this point in the history
  • Loading branch information
gangeli committed May 16, 2013
1 parent dba6ab3 commit c9b88b5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
Binary file modified dist/time-release.jar
Binary file not shown.
Binary file modified dist/time.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion run
Expand Up @@ -25,7 +25,7 @@ env!(

run(
# -- RUN MODE --
# o('runInterpretModel'),
o('runInterpretModel'),
selo(0,'interpretModel', 'dist/interpretModel.ser.gz', 'dist/toyModel.ser.gz'),
selo(1, 'mode',
'detect',
Expand Down
14 changes: 14 additions & 0 deletions src/time/JavaExample.java
Expand Up @@ -3,9 +3,23 @@
import java.io.File;
import edu.stanford.nlp.io.IOUtils;

/**
* A simple example of how to use run the system on an arbitrary String expression.
*
* The command to run this example, from the root of the git tree, is the following:
*
* javac -d bin -cp dist/time-release.jar src/time/JavaExample.java && java -mx4g -cp bin:dist/time-release.jar:/u/nlp/data/StanfordCoreNLPModels/stanford-corenlp-2012-04-09-models.jar time.JavaExample
*
* Note that the models must be from 2012-04-09 (version 1.3.1 @ http://www-nlp.stanford.edu/software/stanford-corenlp-2012-04-09.tgz)
*
*/
class JavaExample {
public static void main(String[] args) {
System.out.println("Hello World!");
TreeTime model = IOUtils.readObjectFromFileNoExceptions(new File("dist/interpretModel.ser.gz"));

System.out.println("Last week was " + model.parseTimex("last week", System.currentTimeMillis()));
System.out.println("Next week will be " + model.parseTimex("next week", System.currentTimeMillis()));
System.out.println("Last quarter was " + model.parseTimex("last quarter", System.currentTimeMillis()));
}
}

0 comments on commit c9b88b5

Please sign in to comment.