Skip to content
Snippets Groups Projects
Commit 53c4ee1a authored by Christos Christodoulopoulos's avatar Christos Christodoulopoulos
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 797 additions and 0 deletions
### Maven
target/
pom.xml
### Eclipse
local.properties
.settings/
.loadpath
### JetBrains
*.iml
.idea/
\ No newline at end of file
Version 5.0
TODO (standalone + plus cleanup + ready to add Prep)
Version 4.1.1
Switched to edison-0.7.1 and LBJava-1.0
Added dependency to illinois-common-resources
Version 4.1
Various bugfixes
Version 4.0.2
Updated inference dependency to latest version and modified inference
code accordingly.
Version 4.0.1
Removed duplicate code from JLIS-core and moved to IllinoisSL. Minor edits.
Version 4.0
A complete rewrite of the SRL. Includes predicate and sense detectors,
new constraints and a memory footprint of only 3GB.
Version 3.0.3
Minor bugfixes. Uses edison v0.2.9
Version 3.0.2
Added an option to trim leading prepositions from arguments.
Revamped the training mechanism to train using LBJ's BatchTrainer in
the code. This allows manual lexicon handling, which reduces the
memory requirements by nearly 40 percent.
Version 3.0.1
Minor bugfix
Version 3.0
A complete Java based re-implementation of the Illinois SRL from
Punyakanok 2008. This version uses LBJ to train classifiers and
for performing inference with a home-brewed beam search.
#!/bin/bash -e
VERSION=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v 'INFO'`
tmpdir=tmp-Srl-verb-$RANDOM
rm -rdf $tmpdir
mkdir -p $tmpdir/models
cp ./models/Verb* $tmpdir/models
cp ./models/lexicon.Verb.* $tmpdir/models
cd $tmpdir
rm -rdf ../target/illinoisSRL-verb-models-$VERSION.jar
jar cf ../target/illinoisSRL-verb-models-$VERSION.jar models
cd ..
rm -rdf $tmpdir
tmpdir=tmp-Srl-nom-$RANDOM
rm -rdf $tmpdir
mkdir -p $tmpdir/models
cp ./models/Nom* $tmpdir/models
cp ./models/lexicon.Nom.* $tmpdir/models
cd $tmpdir
rm -rdf ../target/illinoisSRL-nom-models-$VERSION.jar
jar cf ../target/illinoisSRL-nom-models-$VERSION.jar models
cd ..
rm -rdf $tmpdir
# Conll config file
# Required fields
configFilename finalSystemBILOU
pathToModelFile data/Models/CoNLL
taggingEncodingScheme BILOU
tokenizationScheme DualTokenizationScheme
# Optional fields
beamSize 5
forceNewSentenceOnLineBreaks true
labelTypes PER ORG LOC MISC
logging false
# debuggingLogPath irrelevant
inferenceMethod GREEDY
normalizeTitleText false
pathToTokenNormalizationData brown-clusters/brown-english-wikitext.case-intact.txt-c1000-freq10-v3.txt
predictionConfidenceThreshold -1
sortLexicallyFilesInFolders true
thresholdPrediction false
treatAllFilesInFolderAsOneBigDocument true
debug true
# Features
Forms 1
Capitalization 1
WordTypeInformation 1
Affixes 1
PreviousTag1 1
PreviousTag2 1
PreviousTagPatternLevel1 1
PreviousTagPatternLevel2 1
AggregateContext 0
AggregateGazetteerMatches 0
PrevTagsForContext 1
PredictionsLevel1 1
# Feature groups
BrownClusterPaths 1
isLowercaseBrownClusters false false false
pathsToBrownClusters brown-clusters/brown-english-wikitext.case-intact.txt-c1000-freq10-v3.txt brown-clusters/brownBllipClusters brown-clusters/brown-rcv1.clean.tokenized-CoNLL03.txt-c1000-freq1.txt
minWordAppThresholdsForBrownClusters 5 5 5
GazetteersFeatures 1
pathToGazetteersLists ner-ext/KnownLists
WordEmbeddings 0
# pathsToWordEmbeddings WordEmbedding/model-2280000000.LEARNING_RATE=1e-08.EMBEDDING_LEARNING_RATE=1e-07.EMBEDDING_SIZE=50.gz
# embeddingDimensionalities 50
# minWordAppThresholdsForEmbeddings 0
# normalizationConstantsForEmbeddings 1.0
# normalizationMethodsForEmbeddings OVERALL
# isLowercaseWordEmbeddings false
usePos true
useChunker true
useLemmatizer true
useNer true
useStanfordParse true
lemmaCacheFile data/lemmaCache.txt
updateLemmaCacheFile false
maxLemmaCacheEntries 10000
wordnetPath data/WordNet
nerConfigFile config/ner-conll-config.properties
#############################################
##
## Illinois SRL Configuration
##
#############################################
# Whether to use the Illinois Curator to get the required annotations for training/testing
# If set to false, Illinois NLP pipeline will be used
UseCurator = false
# The URL and host of Curator. If UseCurator is false, make sure you have pipeline config file set
CuratorHost = trollope.cs.illinois.edu
CuratorPort = 9010
# The file containing the configuration for the Illinois NLP pipeline
PipelineConfigFile = pipeline-congig.properties
# The parser used to extract constituents and syntactic features
# Options are: Charniak, Berkeley, Stanford
# NB: Only Stanford can be used in standalone mode.
DefaultParser = Charniak
WordNetConfig = jwnl_properties.xml
### Training corpora directories ###
# This is the directory of the merged (mrg) WSJ files
PennTreebankHome = /shared/corpora/corporaWeb/treebanks/eng/pennTreebank/treebank-3/parsed/mrg/wsj/
PropbankHome = /shared/corpora/corporaWeb/treebanks/eng/propbank_1/data
NombankHome = /shared/corpora/corporaWeb/treebanks/eng/nombank/
# The directory of the sentence and pre-extracted features database (~5G of space required)
# Not used during test/working with pre-trained models
# TODO Change this when done
CacheDirectory = /scratch/illinoisSRL-prep/cache2
ModelsDirectory = models
# Directory to output gold and predicted files for manual comparison
# Comment out for no output
OutputDirectory = srl-out
1. Run prepare-curator-release.sh in the root directory
2. Run 'ant dist' in both the verb and nom directories here.
3. Copy all the jars from the lib directory into the lib directory
within $CURATOR_HOME/dist.
4. Copy illinois-verb-srl/dist/illinois-verb-srl-server.jar and
illinois-nom-srl/dist/illinois-nom-srl-server.jar into
$CURATOR_HOME/dist/components.
5. Copy config/srl-config.properties into
$CURATOR_HOME/dist/configs.
6. Copy illinois-verb-srl/illinois-verb-srl-server.sh and
illinois-nom-srl/illinois-nom-srl-server.sh to the bin directory
within $CURATOR_HOME/dist/bin
Now the SRL servers are ready to be launched.
<?xml version="1.0" encoding="UTF-8"?>
<jwnl_properties language="en">
<version publisher="Princeton" number="3.0" language="en"/>
<dictionary class="net.didion.jwnl.dictionary.FileBackedDictionary">
<param name="morphological_processor" value="net.didion.jwnl.dictionary.morph.DefaultMorphologicalProcessor">
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
<param value="net.didion.jwnl.dictionary.morph.TokenizerOperation">
<param name="delimiters">
<param value=" "/>
<param value="-"/>
</param>
<param name="token_operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
</param>
</param>
</param>
</param>
<param name="dictionary_element_factory" value="net.didion.jwnl.princeton.data.PrincetonWN17FileDictionaryElementFactory"/>
<param name="file_manager" value="net.didion.jwnl.dictionary.file_manager.FileManagerImpl">
<param name="file_type" value="net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile"></param>
<param name="dictionary_path" value="/shared/grandpa/opt/dict"/>
</param>
</dictionary>
<resource class="JWNLResource"></resource>
</jwnl_properties>
# For a description of the arguments, see the documents
DefaultParser = Charniak
WordNetConfig=jwnl_properties.xml
StandardIdentifierClassifierPipeline = true
Illinois Nominal SRL Server
======================
Description
-----------
This package wraps the Illinois Nominal Semantic Role Labeler as a
Thrift server using the Curator's Parser interface. It is designed to
be integrated into the Curator system. Parsers return a forests; in
this case, consisting of one tree per predicate, with the predicate as
the root and its arguments as the children.
Semantics
----------
Semantic Roles are represented using a forest consisting of two level
trees. Each predicate in the input is associated with a tree whose
root corresponds to the predicate. The children of this node denote
the labeled arguments of the predicate.
Usage
-----
> $ bin/illinois-verb-srl-server.sh --help
> usage: java edu.illinois.cs.cogcomp.annotation.server.IllinoisNomSRLServer
> [-c <CONFIG>] [-h] [-p <PORT>] [-t <THREADS>]
> -c,--config <CONFIG> configuration file
> -h,--help print this message
> -p,--port <PORT> port to open server on
> -t,--threads <THREADS> number of threads to run
Installation
------------
The Illinois Nominal SRL Server depends on:
* Java >= 1.5
* The Illinois SRL system
* Illinois SRL model jar
* Curator interfaces (`curator-interfaces.jar`)
Configuration
-------------
See the documentation for the Illinois SRL system for configuration
options.
\ No newline at end of file
<project name="illinois-nom-srl-server" default="compile" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="curator.dir" location="/shared/trollope/curator" />
<property name="curator.lib" location="${curator.dir}/lib" />
<property name="srl.lib" location="../lib" />
<property name="src" location="src" />
<property name="build" location="bin" />
<property name="dist" location="dist" />
<property name="src.test" location="test" />
<property name="build.test" location="${build}/test" />
<property name="class.main" value="edu.illinois.cs.cogcomp.annotation.server.IllinoisNomSRLServer"/>
<property name="class.test" value="edu.illinois.cs.cogcomp.annotation.handler.IllinoisNomSRLHandlerTest"/>
<property name="memory" value="1000m" />
<target name="resolve" description="retrieve dependencies with ivy" depends="init-ivy">
<ivy:resolve file="ivy.xml" />
<ivy:retrieve pattern="${curator.lib}/[artifact]-[revision].[ext]" />
<ivy:cachepath pathid="dependencies.classpath" useOrigin="true"/>
</target>
<path id="project.classpath">
<pathelement location="${curator.dir}/curator-interfaces/dist/curator-interfaces.jar"/>
<pathelement location="${curator.lib}/libthrift.jar" />
<pathelement location="${srl.lib}/illinoisSRL-4.0.jar" />
<pathelement location="${srl.lib}/edison-0.5.jar" />
<pathelement location="${curator.dir}/curator-annotators/illinois-abstract/dist/illinois-abstract-server.jar" />
<path refid="dependencies.classpath" />
<pathelement location="${build}" />
</path>
<path id="test.classpath">
<path refid="project.classpath" />
<pathelement location="${build.test}" />
</path>
<target name="compile" description="compile the java files" depends="resolve">
<mkdir dir="${build}" />
<javac srcdir="${src}" destdir="${build}" debug="true" classpathref="project.classpath" />
</target>
<target name="compile-test" description="compile test cases" depends="compile">
<mkdir dir="${build.test}" />
<javac srcdir="${src.test}" destdir="${build.test}" debug="true" classpathref="test.classpath" />
</target>
<target name="clean" description="removes all java compiled files">
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
<target name="build" depends="compile" description="alias for compile" />
<target name="print" description="print command line to run the server" depends="compile">
<property name="thecp" refid="project.classpath" />
<echo>java -Xmx${memory} -classpath ${thecp} ${class.main}</echo>
</target>
<target name="dist" description="creates a jar for the server in dist/" depends="clean, compile">
<mkdir dir="${dist}" />
<jar destfile="${dist}/${ant.project.name}.jar" basedir="${build}" />
</target>
<target name="test" description="run the unit tests" depends="compile-test">
<junit fork="yes" dir="${basedir}" printsummary="yes" maxmemory="${memory}" failureproperty="tests.failed">
<test name="${class.test}"/>
<formatter type="plain" usefile="true" />
<classpath refid="test.classpath"/>
</junit>
<fail if="tests.failed">Tests failed! Check output!</fail>
</target>
<property name="ivy.install.version" value="2.1.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}" />
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<jwnl_properties language="en">
<version publisher="Princeton" number="3.0" language="en"/>
<dictionary class="net.didion.jwnl.dictionary.FileBackedDictionary">
<param name="morphological_processor" value="net.didion.jwnl.dictionary.morph.DefaultMorphologicalProcessor">
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
<param value="net.didion.jwnl.dictionary.morph.TokenizerOperation">
<param name="delimiters">
<param value=" "/>
<param value="-"/>
</param>
<param name="token_operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
</param>
</param>
</param>
</param>
<param name="dictionary_element_factory" value="net.didion.jwnl.princeton.data.PrincetonWN17FileDictionaryElementFactory"/>
<param name="file_manager" value="net.didion.jwnl.dictionary.file_manager.FileManagerImpl">
<param name="file_type" value="net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile"></param>
<param name="dictionary_path" value="/shared/grandpa/opt/dict"/>
</param>
</dictionary>
<resource class="JWNLResource"></resource>
</jwnl_properties>
# For a description of the arguments, see the documents
DefaultParser = Charniak
WordNetConfig=jwnl_properties.xml
StandardIdentifierClassifierPipeline = true
#!/bin/sh
START=$PWD
DIRNAME=`dirname "$0"`
SCRIPTS_HOME=`cd "$DIRNAME" > /dev/null && pwd`
CURATOR_BASE=$SCRIPTS_HOME/..
CURATOR_BASE=`cd "$CURATOR_BASE" > /dev/null && pwd`
LIBDIR=$CURATOR_BASE/lib
COMPONENTDIR=$CURATOR_BASE/components
CONFIGDIR=$CURATOR_BASE/configs
MODEL_JAR=illinoisSRL-nom-models-4.0.jar
BIN_JAR=illinoisSRL-4.0.jar
COMPONENT_CLASSPATH=$COMPONENTDIR/illinois-nom-srl-server.jar:$CURATOR_BASE:$COMPONENTDIR/illinois-abstract-server.jar:$COMPONENTDIR/curator-interfaces.jar
MODEL_CLASSPATH=$LIBDIR/$MODEL_JAR
LIB_CLASSPATH=$CURATOR_BASE:$LIBDIR/$BIN_JAR:$LIBDIR/commons-cli-1.2.jar:$LIBDIR/JLIS-core-0.5.jar:$LIBDIR/JLIS-multiclass-0.5.jar:$LIBDIR/LBJ-2.8.2.jar:$LIBDIR/LBJLibrary-2.8.2.jar:$LIBDIR/brown-clusters-1.0.jar:$LIBDIR/commons-codec-1.8.jar:$LIBDIR/commons-collections-3.2.1.jar:$LIBDIR/commons-configuration-1.6.jar:$LIBDIR/commons-lang-2.5.jar:$LIBDIR/commons-logging-1.1.1.jar:$LIBDIR/coreUtilities-0.1.8.jar:$LIBDIR/curator-interfaces-0.7.jar:$LIBDIR/edison-0.5.jar:$LIBDIR/gson-2.2.4.jar:$LIBDIR/httpclient-4.1.2.jar:$LIBDIR/httpcore-4.1.3.jar::$LIBDIR/inference-0.3.jar:$LIBDIR/jgrapht-0.8.3.jar:$LIBDIR/jwnl-1.4_rc3.jar:$LIBDIR/libthrift-0.8.0.jar:$LIBDIR/logback-classic-0.9.28.jar:$LIBDIR/logback-core-0.9.28.jar:$LIBDIR/slf4j-api-1.6.1.jar:$LIBDIR/snowball-1.0.jar:$LIBDIR/trove4j-3.0.3.jar:$LIBDIR/verb-nom-data-1.0.jar
CLASSPATH=$COMPONENT_CLASSPATH:$LIB_CLASSPATH:$MODEL_CLASSPATH:$CONFIGDIR
cd $CURATOR_BASE
echo "LIBDIR: $LIBDIR"
CMD="java -cp $CLASSPATH -Dhome=$CURATOR_BASE -Xmx4G edu.illinois.cs.cogcomp.annotation.server.IllinoisNomSRLServer -c $CONFIGDIR/srl-config.properties $@"
echo $CMD
exec $CMD
cd $START
<ivy-module version="2.0">
<info organisation="edu.illinois.cs.cogcomp" module="illinois-nom-srl-server"/>
<dependencies>
<dependency org="commons-lang" name="commons-lang" rev="2.5" transitive="false" conf="* -> *,!sources,!javadoc"/>
<dependency org="commons-cli" name="commons-cli" rev="1.2" transitive="false" conf="* -> *,!sources,!javadoc"/>
<dependency org="ch.qos.logback" name="logback-core" rev="0.9.17" transitive="false" conf="* -> *,!sources,!javadoc"/>
<dependency org="ch.qos.logback" name="logback-classic" rev="0.9.17" transitive="false" conf="* -> *,!sources,!javadoc"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.5.8" transitive="false" conf="* -> *,!sources,!javadoc"/>
<dependency org="junit" name="junit" rev="4.4" conf="* -> *,!sources,!javadoc"/>
</dependencies>
</ivy-module>
\ No newline at end of file
package edu.illinois.cs.cogcomp.annotation.handler;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException;
import edu.illinois.cs.cogcomp.thrift.base.Forest;
import edu.illinois.cs.cogcomp.thrift.base.Span;
import edu.illinois.cs.cogcomp.thrift.curator.Record;
import edu.illinois.cs.cogcomp.thrift.parser.Parser;
import edu.illinois.cs.cogcomp.srl.SemanticRoleLabeler;
/**
* Wraps the Illinois nom SRL in a Parser.Iface.
* @author Mark Sammons
*
*/
public class IllinoisNomSRLHandler extends IllinoisAbstractHandler implements Parser.Iface {
protected static final String DEFAULT_CONFIG = "configs/srl-config.properties";
private final Logger logger = LoggerFactory.getLogger(IllinoisNomSRLHandler.class);
private SemanticRoleLabeler srlSystem;
public IllinoisNomSRLHandler() {
this( DEFAULT_CONFIG );
}
public IllinoisNomSRLHandler(String configFileName) {
super("Illinois Nom Semantic Role Labeler" );
logger.info("Nom SRL ready");
if (configFileName.trim().equals("")) {
configFileName = DEFAULT_CONFIG;
}
// initialize the system
try {
this.srlSystem = new SemanticRoleLabeler(configFileName, "Nom");
} catch(Exception e) {
logger.error("Error initializing Nom SRL", e);
throw new RuntimeException(e);
}
super.setVersion( srlSystem.getVersion() );
super.setName( srlSystem.getSRLCuratorName() );
super.setIdentifier( srlSystem.getSRLCuratorName() );
logger.info("set name to '" + srlSystem.getSRLCuratorName() + "'." );
logger.info("set version to '" + srlSystem.getVersion() + "'." );
}
@Override
public Forest parseRecord(Record record) throws AnnotationFailedException,
TException {
try {
return srlSystem.getSRLForest(record);
} catch(Exception e) {
logger.error("Error annotating record", e);
throw new AnnotationFailedException(e.getMessage());
}
}
}
package edu.illinois.cs.cogcomp.annotation.server;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import edu.illinois.cs.cogcomp.thrift.parser.Parser;
import edu.illinois.cs.cogcomp.annotation.handler.IllinoisNomSRLHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class IllinoisNomSRLServer extends IllinoisAbstractServer{
public IllinoisNomSRLServer( Class c ){
super( c );
}
public IllinoisNomSRLServer( Class c, int threads, int port, String configFile){
super(c, threads, port, configFile);
}
public static void main(String[] args) {
IllinoisNomSRLServer s = new IllinoisNomSRLServer(IllinoisNomSRLServer.class );
Options options = createOptions();
s.parseCommandLine(options, args, "9390", "2", "");
Parser.Iface handler = new IllinoisNomSRLHandler( s.configFile );
Parser.Processor processor = new Parser.Processor(handler);
s.runServer( processor );
}
}
\ No newline at end of file
package edu.illinois.cs.cogcomp.annotation.handler;
import junit.framework.TestCase;
public class IllinoisNomSRLHandlerTest extends TestCase {
public void testHandler() {
}
}
\ No newline at end of file
Illinois Verb SRL Server
======================
Description
-----------
This package wraps the Illinois Verb Semantic Role Labeler as a Thrift
server using the Curator's Parser interface. It is designed to be
integrated into the Curator system. Parsers return a forests; in this
case, consisting of one tree per predicate, with the predicate as the
root and its arguments as the children.
Semantics
----------
Semantic Roles are represented using a forest consisting of two level
trees. Each predicate in the input is associated with a tree whose
root corresponds to the predicate. The children of this node denote
the labeled arguments of the predicate.
Usage
-----
> $ bin/illinois-verb-srl-server.sh --help
> usage: java edu.illinois.cs.cogcomp.annotation.server.IllinoisVerbSRLServer
> [-c <CONFIG>] [-h] [-p <PORT>] [-t <THREADS>]
> -c,--config <CONFIG> configuration file
> -h,--help print this message
> -p,--port <PORT> port to open server on
> -t,--threads <THREADS> number of threads to run
Installation
------------
The Illinois Verb SRL Server depends on:
* Java >= 1.5
* The Illinois SRL system
* Illinois SRL model jar
* Curator interfaces (`curator-interfaces.jar`)
Configuration
-------------
See the documentation for the Illinois SRL system for configuration
options.
\ No newline at end of file
<project name="illinois-verb-srl-server" default="compile" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="curator.dir" location="/shared/trollope/curator" />
<property name="curator.lib" location="${curator.dir}/lib" />
<property name="srl.lib" location="../lib" />
<property name="src" location="src" />
<property name="build" location="bin" />
<property name="dist" location="dist" />
<property name="src.test" location="test" />
<property name="build.test" location="${build}/test" />
<property name="class.main" value="edu.illinois.cs.cogcomp.annotation.server.IllinoisVerbSRLServer"/>
<property name="class.test" value="edu.illinois.cs.cogcomp.annotation.handler.IllinoisVerbSRLHandlerTest"/>
<property name="memory" value="1000m" />
<target name="resolve" description="retrieve dependencies with ivy" depends="init-ivy">
<ivy:resolve file="ivy.xml" />
<ivy:retrieve pattern="${curator.lib}/[artifact]-[revision].[ext]" />
<ivy:cachepath pathid="dependencies.classpath" useOrigin="true"/>
</target>
<path id="project.classpath">
<pathelement location="${curator.dir}/curator-interfaces/dist/curator-interfaces.jar"/>
<pathelement location="${curator.lib}/libthrift.jar" />
<pathelement location="${srl.lib}/illinoisSRL-4.0.jar" />
<pathelement location="${srl.lib}/edison-0.5.jar" />
<pathelement location="${curator.dir}/curator-annotators/illinois-abstract/dist/illinois-abstract-server.jar" />
<path refid="dependencies.classpath" />
<pathelement location="${build}" />
</path>
<path id="test.classpath">
<path refid="project.classpath" />
<pathelement location="${build.test}" />
</path>
<target name="compile" description="compile the java files" depends="resolve">
<mkdir dir="${build}" />
<javac srcdir="${src}" destdir="${build}" debug="true" classpathref="project.classpath" />
</target>
<target name="compile-test" description="compile test cases" depends="compile">
<mkdir dir="${build.test}" />
<javac srcdir="${src.test}" destdir="${build.test}" debug="true" classpathref="test.classpath" />
</target>
<target name="clean" description="removes all java compiled files">
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
<target name="build" depends="compile" description="alias for compile" />
<target name="print" description="print command line to run the server" depends="compile">
<property name="thecp" refid="project.classpath" />
<echo>java -Xmx${memory} -classpath ${thecp} ${class.main}</echo>
</target>
<target name="dist" description="creates a jar for the server in dist/" depends="clean, compile">
<mkdir dir="${dist}" />
<jar destfile="${dist}/${ant.project.name}.jar" basedir="${build}" />
</target>
<target name="test" description="run the unit tests" depends="compile-test">
<junit fork="yes" dir="${basedir}" printsummary="yes" maxmemory="${memory}" failureproperty="tests.failed">
<test name="${class.test}"/>
<formatter type="plain" usefile="true" />
<classpath refid="test.classpath"/>
</junit>
<fail if="tests.failed">Tests failed! Check output!</fail>
</target>
<property name="ivy.install.version" value="2.1.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}" />
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
</target>
</project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment