Untar and gunzip it, giving you a "grok" directory. cd to "grok".
Then try "sh ./build.sh". You might be told that you need to set your
$JAVA_HOME environment variable to where Java is located on your
machine. Once you've done that, you'll have the file grok-0.5.6.jar
built in the grok/output directory, as well as a grok/output/classes
directory with the compiled Java classes.
Assuming that $GROK_HOME is where the grok code is located (for me it
is /home/jmb/devel/grok), do the following for your classpath (this is
for bash):
These instructions will not work. You also need the opennlp jar in your classpath, and some gnu package I am not familiar with. Here is the error message:
java -classpath /cs-dstudent/jnolan/Grok/output/grok-0.5.6.jar:$HOME/Grok/output/opennlp-0.8.2.jar opennlp.grok.Grokling simple.gram
Loading grammar at URL: file:/cs-dstudent/jnolan/Grok/samples/grammar/simple.gram
Loading Lex... Exception in thread "main" java.lang.NoClassDefFoundError: gnu/trove/THashMap
at opennlp.grok.Grokling.<init>(Grokling.java:77)
at opennlp.grok.Grokling.main(Grokling.java:205)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is what the "export JARS" part of the instructions should take care of. All of the supporting jars needed to run grok are in the Grok/lib directory. The "export JARS" line builds up a list of all jar files contained in that directory, and then they are added to the classpath in the next line. Otherwise, you are free to add all of them explicitly in your classpath, such as in your case, $HOME/Grok/lib/trove.jar, etc.
Let me know if that works for you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wrote the following to explicitly lay out some of the steps in running some Grok stuff, and thought it would be useful to post here.
First, download the latest release for Grok:
http://prdownloads.sourceforge.net/grok/grok-0.5.6-src.tgz
Untar and gunzip it, giving you a "grok" directory. cd to "grok".
Then try "sh ./build.sh". You might be told that you need to set your
$JAVA_HOME environment variable to where Java is located on your
machine. Once you've done that, you'll have the file grok-0.5.6.jar
built in the grok/output directory, as well as a grok/output/classes
directory with the compiled Java classes.
Assuming that $GROK_HOME is where the grok code is located (for me it
is /home/jmb/devel/grok), do the following for your classpath (this is
for bash):
export JARS=`echo ${GROK_HOME}/*.jar | tr ' ' ':'`
export CLASSPATH=.:${JARS}:${GROK_HOME}/output/classes
You can then cd to grok/samples/grammar and type:
java opennlp.grok.Grokling simple.gram
There are some example sentences in the README, but have a look at
morph.xml and flat_morph_db to see the lexical items that you can
use.
0.5.6 is still pretty limited, and the grammar is quite small, so
don't expect too much just yet. :)
Jason
These instructions will not work. You also need the opennlp jar in your classpath, and some gnu package I am not familiar with. Here is the error message:
java -classpath /cs-dstudent/jnolan/Grok/output/grok-0.5.6.jar:$HOME/Grok/output/opennlp-0.8.2.jar opennlp.grok.Grokling simple.gram
Loading grammar at URL: file:/cs-dstudent/jnolan/Grok/samples/grammar/simple.gram
Loading Lex... Exception in thread "main" java.lang.NoClassDefFoundError: gnu/trove/THashMap
at opennlp.grok.Grokling.<init>(Grokling.java:77)
at opennlp.grok.Grokling.main(Grokling.java:205)
That is what the "export JARS" part of the instructions should take care of. All of the supporting jars needed to run grok are in the Grok/lib directory. The "export JARS" line builds up a list of all jar files contained in that directory, and then they are added to the classpath in the next line. Otherwise, you are free to add all of them explicitly in your classpath, such as in your case, $HOME/Grok/lib/trove.jar, etc.
Let me know if that works for you.
In order to get grok to run on simple.gram, I had to change:
export JARS=`echo ${GROK_HOME}/*.jar | tr ' ' ':'`
to:
export JARS=`echo ${GROK_HOME}/lib/*.jar | tr ' ' ':'`