diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..6ccaa2cd01f919644b2e642819a85f398c546613 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,4 @@ +job: + script: + - mvn clean compile + - mvn test \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index 4541d44cc0909bebe5f27d4eab67ad725c9a4ce3..d0bb0f195f3f8974c6d2bc87273700f584f1b201 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 5.1.12 +Added Windows support (including access to non-Gurobi solver) + Version 5.1.4 Switched entirely to illinois-sl for structured prediction (removed JLIS traces) Using the latest AnnotatorService from illinois-core-utilities for both Curator & pipeline annotation diff --git a/README.md b/README.md index 6882f19ed0e3b3b24fcb6a9546a0b711359c3b61..f5a9b5cd9925a63de6a8055d8e7693e50192fe44 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,21 @@ ### Running You can use the **illinois-srl** system in either *interactive* or *annotator* mode. #### Interactive mode -In *interactive mode* the user can input a single piece of text and get back the feedback from either +In *interactive mode* the user can input a single piece of text and get back the feedback from both the **Nom**inal or **Verb**al SRL systems in plain text. To run the system in *interactive mode* see the class `edu.illinois.cs.cogcomp.srl.SemanticRoleLabeler` -or simply run the script: +or simply execute the `run-interactive` script: +For linux: ``` -scripts/run-interactive.sh <config> <Verb|Nom> +scripts/run-interactive.sh +``` + +For windows: +``` +cd scripts +run-interactive-win.bat ``` #### As an `Annotator` component diff --git a/config/pipeline.properties b/config/pipeline.properties new file mode 100644 index 0000000000000000000000000000000000000000..ca6c09da6a7a3f8e0cb2a8997a42c67d63d69610 --- /dev/null +++ b/config/pipeline.properties @@ -0,0 +1,17 @@ +## Flags for whether to use different annotators +usePos = true +useLemma = true +useShallowParse = true +useNerConll = true +useNerOntonotes = false +useStanfordParse = true +useStanfordDep = true +useSrlVerb = false +useSrlNom = false + +## Flags for the Stanford parser (for pre-processing) +# Max time per sentence (in milliseconds) +stanfordMaxTimePerSentence = 1000 + +# Max sentence lenght (will throw exception if larger) +stanfordParseMaxSentenceLength = 80 \ No newline at end of file diff --git a/config/srl-config.properties b/config/srl-config.properties index 573f406fd806f0efc3ade58209cb210efd021d80..1a052a39df88e234f62659fd1062941bb4076d92 100644 --- a/config/srl-config.properties +++ b/config/srl-config.properties @@ -1,13 +1,12 @@ -############################################# -## -## Illinois SRL Configuration -## -############################################# +## 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 configuration of the Illinois NLP pipeline +PipelineConfig = config/pipeline.properties + # The parser used to extract constituents and syntactic features # Options are: Charniak, Berkeley, Stanford # NB: Only Stanford can be used in standalone mode. @@ -19,6 +18,10 @@ LearnerConfig = config/learner.properties # Num of threads for feat. ext. NumFeatExtThreads = 10 +# The ILP solver to use for the joint inference +# Options are: Gurobi, OJAlgo +ILPSolver = OJAlgo + ### 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/ diff --git a/pom.xml b/pom.xml index 720dff0e4c805c0278570d34892522eb0d998585..9db8d22e2864815bd0159749046b4a9589ff67d0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,15 +5,15 @@ <groupId>edu.illinois.cs.cogcomp</groupId> <artifactId>illinois-srl</artifactId> <packaging>jar</packaging> - <version>5.1.11</version> + <version>5.1.12</version> <url>http://cogcomp.cs.illinois.edu</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <cogcomp-nlp-version>3.0.22</cogcomp-nlp-version> - <cogcomp-nlp-pipeline-version>0.1.17</cogcomp-nlp-pipeline-version> + <cogcomp-nlp-version>3.0.27</cogcomp-nlp-version> + <cogcomp-nlp-pipeline-version>0.1.19</cogcomp-nlp-pipeline-version> </properties> <repositories> @@ -107,7 +107,7 @@ <dependency> <groupId>edu.illinois.cs.cogcomp</groupId> <artifactId>inference</artifactId> - <version>0.4.2</version> + <version>0.5.0</version> </dependency> <dependency> diff --git a/scripts/run-interactive-win.bat b/scripts/run-interactive-win.bat new file mode 100644 index 0000000000000000000000000000000000000000..5d2e45bef756fb7299fe89c1190c8d1698c1c793 --- /dev/null +++ b/scripts/run-interactive-win.bat @@ -0,0 +1,11 @@ +rem Moving to root directory +cd .. + +rem Compiling the source code +call mvn clean compile + +rem Copying dependencies +call mvn -q dependency:copy-dependencies + +rem Starting the SRL system +java -Xmx8g -cp target\classes;target\dependency\* edu.illinois.cs.cogcomp.srl.SemanticRoleLabeler config\srl-config.properties \ No newline at end of file diff --git a/scripts/run-interactive.sh b/scripts/run-interactive.sh index 33c7a6fa6e7cd2fac9d1e71d5deb394d8ac0846b..594e4f3791be090175fbdf8c546f184b37c20f82 100755 --- a/scripts/run-interactive.sh +++ b/scripts/run-interactive.sh @@ -4,10 +4,10 @@ mvn -q dependency:copy-dependencies CP=target/classes:config:target/dependency/* -MEMORY="-Xmx25g" +MEMORY="-Xmx8g" OPTIONS="-ea $MEMORY -cp $CP " MAINCLASS=edu.illinois.cs.cogcomp.srl.SemanticRoleLabeler -time nice java $OPTIONS $MAINCLASS "$@" +time nice java $OPTIONS $MAINCLASS config\srl-config.properties diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/Main.java b/src/main/java/edu/illinois/cs/cogcomp/srl/Main.java index 8a331544e97c2a4b695e9e7bb3f0cbb67fe6a29f..6efc23c7166a223fcec9915677b9ad0bdf029f9c 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/Main.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/Main.java @@ -34,9 +34,9 @@ import edu.illinois.cs.cogcomp.srl.experiment.PruningPreExtractor; import edu.illinois.cs.cogcomp.srl.experiment.TextPreProcessor; import edu.illinois.cs.cogcomp.srl.inference.SRLILPInference; import edu.illinois.cs.cogcomp.srl.inference.SRLMulticlassInference; -import edu.illinois.cs.cogcomp.srl.jlis.SRLFeatureExtractor; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassLabel; +import edu.illinois.cs.cogcomp.srl.learn.SRLFeatureExtractor; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassLabel; import edu.illinois.cs.cogcomp.srl.learn.IdentifierThresholdTuner; import edu.illinois.cs.cogcomp.srl.nom.NomSRLManager; import edu.illinois.cs.cogcomp.srl.utilities.WeightVectorUtils; @@ -459,7 +459,7 @@ public class Main { Dataset testSet = Dataset.PTBTest; - ILPSolverFactory solver = new ILPSolverFactory(ILPSolverFactory.SolverType.CuttingPlaneGurobi); + ILPSolverFactory solver = new ILPSolverFactory(properties.getILPSolverType(true)); String outDir = properties.getOutputDir(); PrintWriter goldWriter = null, predWriter = null; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/SRLProperties.java b/src/main/java/edu/illinois/cs/cogcomp/srl/SRLProperties.java index 052efa99791aadf74f2e8c4583d0f2d6add8bc67..4bc443cbfc2ef5746bc05434202f8effcbfeb007 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/SRLProperties.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/SRLProperties.java @@ -1,22 +1,16 @@ package edu.illinois.cs.cogcomp.srl; -import edu.illinois.cs.cogcomp.core.io.IOUtils; import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager; -import edu.illinois.cs.cogcomp.edison.utilities.WordNetManager; +import edu.illinois.cs.cogcomp.infer.ilp.ILPSolverFactory; import edu.illinois.cs.cogcomp.srl.config.SrlConfigurator; import edu.illinois.cs.cogcomp.srl.core.Models; import edu.illinois.cs.cogcomp.srl.core.SRLType; import edu.illinois.cs.cogcomp.srl.data.Dataset; - import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; import java.io.IOException; -import java.net.URL; -import java.util.List; import java.util.Properties; public class SRLProperties { @@ -24,7 +18,6 @@ public class SRLProperties { private static SRLProperties theInstance; private ResourceManager config; - /** * configFile must have all parameters set, ideally using the SrlConfigurator class. * @param configFile file with configuration parameters @@ -38,12 +31,7 @@ public class SRLProperties { * ResourceManager must have all parameters set, ideally using the SrlConfigurator class. * @param rm */ - private SRLProperties( ResourceManager rm ) - { - if (rm.containsKey("LoadWordNetConfigFromClassPath") - && rm.getBoolean("LoadWordNetConfigFromClassPath")) { - WordNetManager.loadConfigAsClasspathResource(true); - } + private SRLProperties( ResourceManager rm ) { config = rm; } @@ -183,4 +171,23 @@ public class SRLProperties { public String getLearnerConfig() { return this.config.getString("LearnerConfig"); } + + public String getPipelineConfig() { + return this.config.getString("PipelineConfig"); + } + + public ILPSolverFactory.SolverType getILPSolverType(boolean isEvaluating) { + String solver = config.getString("ILPSolver"); + switch (solver) { + case "Gurobi": + if (isEvaluating) + return ILPSolverFactory.SolverType.JLISCuttingPlaneGurobi; + else return ILPSolverFactory.SolverType.Gurobi; + case "OJAlgo": + return ILPSolverFactory.SolverType.OJAlgo; + default: + log.info("Using default ILP Solver: OJAlgo"); + return ILPSolverFactory.SolverType.OJAlgo; + } + } } diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabeler.java b/src/main/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabeler.java index a2df830c332d43641f54898ecfa07b8df3e7e1b8..5d8cab60d07c4e7fbdcba0be030080f3972b3545 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabeler.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabeler.java @@ -3,11 +3,12 @@ package edu.illinois.cs.cogcomp.srl; import edu.illinois.cs.cogcomp.annotation.Annotator; import edu.illinois.cs.cogcomp.annotation.AnnotatorException; import edu.illinois.cs.cogcomp.core.datastructures.ViewNames; -import edu.illinois.cs.cogcomp.core.datastructures.textannotation.*; +import edu.illinois.cs.cogcomp.core.datastructures.textannotation.Constituent; +import edu.illinois.cs.cogcomp.core.datastructures.textannotation.PredicateArgumentView; +import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation; +import edu.illinois.cs.cogcomp.core.datastructures.textannotation.View; import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager; -import edu.illinois.cs.cogcomp.edison.utilities.WordNetManager; import edu.illinois.cs.cogcomp.infer.ilp.ILPSolverFactory; -import edu.illinois.cs.cogcomp.infer.ilp.ILPSolverFactory.SolverType; import edu.illinois.cs.cogcomp.srl.config.SrlConfigurator; import edu.illinois.cs.cogcomp.srl.core.Models; import edu.illinois.cs.cogcomp.srl.core.SRLManager; @@ -51,8 +52,7 @@ public class SemanticRoleLabeler extends Annotator { else { for (SRLType type : SRLType.values()) { srlType = type.name(); - srlLabelers - .add(new SemanticRoleLabeler(rm, srlType, true)); + srlLabelers.add(new SemanticRoleLabeler(rm, srlType, true)); } } } catch (Exception e) { @@ -79,7 +79,8 @@ public class SemanticRoleLabeler extends Annotator { } for (SemanticRoleLabeler srl : srlLabelers) { - System.out.println(srl.getSRLCuratorName()); + if (srlLabelers.size() > 1) + System.out.println(srl.getViewName()); PredicateArgumentView p; try { @@ -102,15 +103,12 @@ public class SemanticRoleLabeler extends Annotator { } public SemanticRoleLabeler(ResourceManager rm, String srlType) throws Exception { - this(rm, srlType, false); } public SemanticRoleLabeler(ResourceManager rm, String srlType, boolean initialize) throws Exception { super( getViewNameForType(srlType), TextPreProcessor.requiredViews ); - WordNetManager.loadConfigAsClasspathResource(true); - log.info("Initializing config"); SRLProperties.initialize(rm); properties = SRLProperties.getInstance(); @@ -167,7 +165,7 @@ public class SemanticRoleLabeler extends Annotator { if (predicates.isEmpty()) return null; - ILPSolverFactory s = new ILPSolverFactory(SolverType.Gurobi); + ILPSolverFactory s = new ILPSolverFactory(properties.getILPSolverType(false)); SRLILPInference inference = new SRLILPInference(s, manager, predicates); return inference.getOutputView(); @@ -181,7 +179,6 @@ public class SemanticRoleLabeler extends Annotator { throw new AnnotatorException("Missing required view: " + view); } } - try { View srlView = getSRL(ta); ta.addView( getViewName(), srlView); diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/caches/FeatureVectorCacheFile.java b/src/main/java/edu/illinois/cs/cogcomp/srl/caches/FeatureVectorCacheFile.java index b8978d2f37742ca1a75c3b6c0a7ac29b7e331854..45e92247cc55197d44a3264c0a23110a44925215 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/caches/FeatureVectorCacheFile.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/caches/FeatureVectorCacheFile.java @@ -5,8 +5,8 @@ import edu.illinois.cs.cogcomp.sl.core.SLProblem; import edu.illinois.cs.cogcomp.sl.util.IFeatureVector; import edu.illinois.cs.cogcomp.srl.core.Models; import edu.illinois.cs.cogcomp.srl.core.SRLManager; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassLabel; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassLabel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/config/SrlConfigurator.java b/src/main/java/edu/illinois/cs/cogcomp/srl/config/SrlConfigurator.java index 5eab0f789ea0c37030fb895a8ca763c5b02adf6a..6420e647a4d245497f57a07efcada02ab364d15a 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/config/SrlConfigurator.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/config/SrlConfigurator.java @@ -4,10 +4,6 @@ import edu.illinois.cs.cogcomp.core.utilities.configuration.Configurator; import edu.illinois.cs.cogcomp.core.utilities.configuration.Property; import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager; -import java.io.IOException; -import java.net.URL; -import java.util.Properties; - /** * A configuration helper to allow centralization of config options in dependencies with * clear default settings (only values that override defaults need to be specified). @@ -19,8 +15,6 @@ import java.util.Properties; * Created by mssammon on 12/21/15. */ public class SrlConfigurator extends Configurator { - - public static final Property USE_CURATOR = new Property("UseCurator", FALSE); public static final Property DEFAULT_PARSER = new Property("DefaultParser", "Stanford" ); @@ -30,9 +24,13 @@ public class SrlConfigurator extends Configurator { public static final Property NUM_FEX_THREADS = new Property("NumFeatExtThreads", "10" ); /** - * Training corpora directories + * The ILP solver to use for the joint inference + * Options are: Gurobi, OJAlgo + */ + public static final Property ILP_SOLVER = new Property("ILPSolver", "OJAlgo"); + /** + * Training corpora directories */ - //This is the directory of the merged (mrg) WSJ files public static final Property PENNTB_HOME = new Property("PennTreebankHome", "/shared/corpora/corporaWeb/treebanks/eng/pennTreebank/treebank-3/parsed/mrg/wsj/" ); public static final Property PROPBANK_PARSER = new Property( "PropbankHome", "/shared/corpora/corporaWeb/treebanks/eng/propbank_1/data" ); @@ -43,27 +41,21 @@ public class SrlConfigurator extends Configurator { * The directory of the sentence and pre-extracted features database (~5G of space required) * Not used during test/working with pre-trained models */ - public static final Property CACHE_DIR = new Property( "CacheDirectory", "cache"); public static final Property MODEL_DIR = new Property( "ModelsDirectory", "models"); -/** - * Directory to output gold and predicted files for manual comparison - */ + /** + * Directory to output gold and predicted files for manual comparison + */ public static final Property OUTPUT_DIR = new Property( "OutputDirectory", "srl-out"); -// public SrlConfigurator(URL url) throws IOException { -// getConfig( new ResourceManager( url.getFile() ) ); -// } - @Override public ResourceManager getDefaultConfig() { - Property[] properties = {USE_CURATOR, DEFAULT_PARSER, NUM_FEX_THREADS, PENNTB_HOME, PROPBANK_PARSER, - NOMBANK_HOME, CACHE_DIR, MODEL_DIR }; + NOMBANK_HOME, CACHE_DIR, MODEL_DIR, OUTPUT_DIR, ILP_SOLVER}; return (new LearnerConfigurator().getConfig(new ResourceManager(generateProperties(properties))) ); } } diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/core/ArgumentIdentifier.java b/src/main/java/edu/illinois/cs/cogcomp/srl/core/ArgumentIdentifier.java index 1f460b1dd6d94a7d37866e5dc4fc466af45ff92b..4f6ed85a1efb4f4a135ba9ce84709b9c6a07d698 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/core/ArgumentIdentifier.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/core/ArgumentIdentifier.java @@ -2,8 +2,8 @@ package edu.illinois.cs.cogcomp.srl.core; import edu.illinois.cs.cogcomp.core.transformers.Predicate; import edu.illinois.cs.cogcomp.sl.util.WeightVector; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassLabel; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassLabel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/core/LearnedPredicateDetector.java b/src/main/java/edu/illinois/cs/cogcomp/srl/core/LearnedPredicateDetector.java index a5d3065baacca32d92f2895197fb654397785be6..fd1c3c87f8ed0d0c215aba405fb790cbe702a90d 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/core/LearnedPredicateDetector.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/core/LearnedPredicateDetector.java @@ -7,8 +7,8 @@ import edu.illinois.cs.cogcomp.core.datastructures.textannotation.View; import edu.illinois.cs.cogcomp.edison.features.Feature; import edu.illinois.cs.cogcomp.nlp.corpusreaders.CoNLLColumnFormatReader; import edu.illinois.cs.cogcomp.sl.util.WeightVector; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassLabel; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassLabel; import java.util.List; import java.util.Set; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/core/ModelInfo.java b/src/main/java/edu/illinois/cs/cogcomp/srl/core/ModelInfo.java index 4986e469badfa86e43ee14c0ccf53dd977508986..7f409931e88d3c49cb084522722e799cf69d04aa 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/core/ModelInfo.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/core/ModelInfo.java @@ -56,7 +56,7 @@ public class ModelInfo { public void loadWeightVector() { if (w != null) { - log.info("Weight vector already loaded!"); + log.debug("Weight vector already loaded!"); return; } diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLExampleGenerator.java b/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLExampleGenerator.java index 293efcbfe92fc7ccc28e101c1941762caaa42277..695b056b593ee071e4bc252940821321c735e2c1 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLExampleGenerator.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLExampleGenerator.java @@ -7,7 +7,7 @@ import edu.illinois.cs.cogcomp.core.datastructures.textannotation.PredicateArgum import edu.illinois.cs.cogcomp.core.datastructures.textannotation.Relation; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation; import edu.illinois.cs.cogcomp.nlp.corpusreaders.CoNLLColumnFormatReader; -import edu.illinois.cs.cogcomp.srl.jlis.*; +import edu.illinois.cs.cogcomp.srl.learn.*; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLManager.java b/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLManager.java index 651caee86fd8a9353671b996d9425bd13290bbd5..4d9f49e212b83f491cfe951db07bc5e6afb35bc6 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLManager.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/core/SRLManager.java @@ -16,7 +16,7 @@ import edu.illinois.cs.cogcomp.srl.features.FeatureGenerators; import edu.illinois.cs.cogcomp.srl.features.ProjectedPath; import edu.illinois.cs.cogcomp.srl.inference.SRLConstraints; import edu.illinois.cs.cogcomp.srl.inference.SRLILPInference; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PreExtractor.java b/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PreExtractor.java index 16c8e594d3a0737c3a7fea4ac0a8bc324fa33bfa..dd920df3021c0668ee00cecbb270bce167643549 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PreExtractor.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PreExtractor.java @@ -15,7 +15,7 @@ import edu.illinois.cs.cogcomp.sl.util.FeatureVectorBuffer; import edu.illinois.cs.cogcomp.sl.util.IFeatureVector; import edu.illinois.cs.cogcomp.srl.caches.FeatureVectorCacheFile; import edu.illinois.cs.cogcomp.srl.core.*; -import edu.illinois.cs.cogcomp.srl.jlis.*; +import edu.illinois.cs.cogcomp.srl.learn.*; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PruningPreExtractor.java b/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PruningPreExtractor.java index 1ae57ce12292ddc1ee306aaf94e8a99c7175a2a9..2bfc572c7a67b29d9193826cd332824c8e5b31de 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PruningPreExtractor.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/PruningPreExtractor.java @@ -8,8 +8,8 @@ import edu.illinois.cs.cogcomp.srl.caches.FeatureVectorCacheFile; import edu.illinois.cs.cogcomp.srl.core.ModelInfo; import edu.illinois.cs.cogcomp.srl.core.Models; import edu.illinois.cs.cogcomp.srl.core.SRLManager; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassLabel; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassLabel; import org.slf4j.Logger; import java.util.ArrayList; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/TextPreProcessor.java b/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/TextPreProcessor.java index f22fd16d8bfa955e99d579e3a00686426017ba1b..4af27f738f5e7cf5f361d00cb4777f554c60f348 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/TextPreProcessor.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/experiment/TextPreProcessor.java @@ -40,7 +40,7 @@ public class TextPreProcessor { + "Please change the 'DefaultParser' parameter in the configuration file."); System.exit(-1); } - annotator = IllinoisPipelineFactory.buildPipeline(); + annotator = IllinoisPipelineFactory.buildPipeline(new ResourceManager(config.getPipelineConfig())); } } diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/ILPOutput.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/ILPOutput.java index fd554179694cd5f70c8e3a5337ffada261df7f33..a2cb8b969e9728c2cb050afafcbff1b34aba756f 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/ILPOutput.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/ILPOutput.java @@ -5,7 +5,7 @@ import edu.illinois.cs.cogcomp.infer.ilp.ILPSolver; import edu.illinois.cs.cogcomp.infer.ilp.InferenceVariableLexManager; import edu.illinois.cs.cogcomp.sl.core.IInstance; import edu.illinois.cs.cogcomp.srl.core.SRLManager; -import edu.illinois.cs.cogcomp.srl.jlis.*; +import edu.illinois.cs.cogcomp.srl.learn.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,7 +23,7 @@ public class ILPOutput implements ILPOutputGenerator { } public SRLSentenceStructure getOutput(ILPSolver xmp, - InferenceVariableLexManager variableManager, IInstance ins) { + InferenceVariableLexManager variableManager, IInstance ins) { SRLSentenceInstance instance = (SRLSentenceInstance) ins; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLILPInference.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLILPInference.java index f4eda42f9fd743ed7e12ea8ef052ff846bda5079..1f5609140c1c23efbf41f8674b26c22cc2983595 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLILPInference.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLILPInference.java @@ -8,10 +8,10 @@ import edu.illinois.cs.cogcomp.infer.ilp.ILPSolverFactory.SolverType; import edu.illinois.cs.cogcomp.nlp.corpusreaders.CoNLLColumnFormatReader; import edu.illinois.cs.cogcomp.srl.core.Models; import edu.illinois.cs.cogcomp.srl.core.SRLManager; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceStructure; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,8 +25,7 @@ final public class SRLILPInference extends AbstractILPInference<SRLSentenceStruc final static boolean DEBUG = false; - private final static Logger log = LoggerFactory - .getLogger(SRLILPInference.class); + private final static Logger log = LoggerFactory.getLogger(SRLILPInference.class); public final SRLSentenceInstance instance; @@ -71,8 +70,7 @@ final public class SRLILPInference extends AbstractILPInference<SRLSentenceStruc } @Override - protected void initializeSolver(ILPSolver xmp, - InferenceVariableLexManager variableManager) { + protected void initializeSolver(ILPSolver xmp, InferenceVariableLexManager variableManager) { if (this.solverFactory.type == SolverType.JLISCuttingPlaneGurobi) { JLISCuttingPlaneILPSolverGurobi s = (JLISCuttingPlaneILPSolverGurobi) xmp; s.setInput(instance); @@ -87,8 +85,7 @@ final public class SRLILPInference extends AbstractILPInference<SRLSentenceStruc return outputGenerator.getOutput(xmp, variableManager, this.instance); } - protected void addConstraints(ILPSolver xmp, - List<ILPConstraint> constraints, String debugMessage) { + protected void addConstraints(ILPSolver xmp, List<ILPConstraint> constraints, String debugMessage) { log.debug(debugMessage); for (ILPConstraint c : constraints) { @@ -114,12 +111,7 @@ final public class SRLILPInference extends AbstractILPInference<SRLSentenceStruc ((JLISCuttingPlaneILPSolverGurobi) xmp).addCuttingPlaneConstraintGenerator(c); } else { List<ILPConstraint> cs = c.getILPConstraints(instance, variableManager); - - if (c.isDelayedConstraint() && xmp instanceof CuttingPlaneILPHook) { - ((CuttingPlaneILPHook) xmp).addCuttingPlaneConstraintCollection(cs); - } else { - addConstraints(xmp, cs, c.name); - } + addConstraints(xmp, cs, c.name); } } } diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLMulticlassInference.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLMulticlassInference.java index 14e5ad1e906e8c026e79ef40fc5bca2e3b22eb2e..38c787f5e75f011d0849a71b61140e7b8b06a634 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLMulticlassInference.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/SRLMulticlassInference.java @@ -6,8 +6,8 @@ import edu.illinois.cs.cogcomp.sl.core.AbstractInferenceSolver; import edu.illinois.cs.cogcomp.sl.util.WeightVector; import edu.illinois.cs.cogcomp.srl.core.Models; import edu.illinois.cs.cogcomp.srl.core.SRLManager; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassLabel; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassLabel; @SuppressWarnings("serial") public class SRLMulticlassInference extends AbstractInferenceSolver { diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/AtLeastOneCoreArgument.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/AtLeastOneCoreArgument.java index 29df3e7010f08f2e86315b88ac097cecbf89fce3..ffa217c346378df48913b7bd29570ce47924410f 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/AtLeastOneCoreArgument.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/AtLeastOneCoreArgument.java @@ -8,10 +8,10 @@ import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.inference.SRLConstraints; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateStructure; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceStructure; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/BeVerbConstraints.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/BeVerbConstraints.java index a8b853f3c52fab6e19e324801b52b9cf125a78d0..240b9a14ae542e46c01887081e8c04b854a88bf5 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/BeVerbConstraints.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/BeVerbConstraints.java @@ -10,7 +10,7 @@ import edu.illinois.cs.cogcomp.sl.core.IInstance; import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.*; +import edu.illinois.cs.cogcomp.srl.learn.*; import java.util.*; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CArgConstraints.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CArgConstraints.java index 4e9c7afbf916af9403c83b6f507cce5bf39dadbc..bd58ebfd9a468a69981f28d441541501cc843f34 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CArgConstraints.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CArgConstraints.java @@ -9,7 +9,7 @@ import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.core.SRLType; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.*; +import edu.illinois.cs.cogcomp.srl.learn.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentExclusiveOverlap.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentExclusiveOverlap.java index ac6be29facdb9961ab8a2dd8bae6eb263e8b683f..469421ae55f9dbab58c056860f8b33db9c02b14a 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentExclusiveOverlap.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentExclusiveOverlap.java @@ -9,10 +9,10 @@ import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.inference.SRLConstraints; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateStructure; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLMulticlassInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceStructure; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentRetainedModifiers.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentRetainedModifiers.java index 33d559376a1265ffbfe9c6860ac32dbadbd62e46..5218be2e1cad2aa1acbda7ec73b68cc6c2dbb4e0 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentRetainedModifiers.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/CrossArgumentRetainedModifiers.java @@ -12,8 +12,8 @@ import edu.illinois.cs.cogcomp.srl.core.SRLType; import edu.illinois.cs.cogcomp.srl.data.LegalArguments; import edu.illinois.cs.cogcomp.srl.inference.SRLConstraints; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.*; +import edu.illinois.cs.cogcomp.srl.learn.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoDuplicateCoreConstraint.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoDuplicateCoreConstraint.java index 98fdd97f2d20f5735d2f62e970899fc6adebaff6..62858a447ad509fb2ebde21adf9c0277c9705ed5 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoDuplicateCoreConstraint.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoDuplicateCoreConstraint.java @@ -8,10 +8,10 @@ import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.core.SRLType; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateStructure; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceStructure; import java.util.ArrayList; import java.util.HashSet; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoOverlapConstraint.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoOverlapConstraint.java index db043ff314f734365ff2edc256c7813851085ebd..41af3b835966e16ebdbe22f47bd2ed1deea18945 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoOverlapConstraint.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/NoOverlapConstraint.java @@ -8,7 +8,7 @@ import edu.illinois.cs.cogcomp.sl.core.IInstance; import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.*; +import edu.illinois.cs.cogcomp.srl.learn.*; import java.util.*; @@ -27,8 +27,8 @@ public class NoOverlapConstraint extends SRLILPConstraintGenerator { } private List<ILPConstraint> getNoOverlapConstraint(SRLManager manager, - InferenceVariableLexManager variables, int predicateId, - SRLPredicateInstance x, SRLPredicateStructure y) { + InferenceVariableLexManager variables, int predicateId, + SRLPredicateInstance x, SRLPredicateStructure y) { String type = manager.getPredictedViewName(); diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/PredicateSenseConstraints.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/PredicateSenseConstraints.java index 25b26f736eb40cc8d9c52a382daacc03aa4339ef..9304e4ff1584dbc8f560298a4c1d95a1c9d97503 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/PredicateSenseConstraints.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/PredicateSenseConstraints.java @@ -9,10 +9,10 @@ import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.core.SRLType; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; import edu.illinois.cs.cogcomp.srl.inference.SRLILPInference; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateStructure; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceStructure; import java.util.*; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/RArgConstraints.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/RArgConstraints.java index 8ddce6631ad4df8f9ead5d4247bc0b738dd23fc9..433b2f03fd1de5b0150bdeab94773fd59c7e9f66 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/RArgConstraints.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/RArgConstraints.java @@ -7,10 +7,10 @@ import edu.illinois.cs.cogcomp.sl.core.IInstance; import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateStructure; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateStructure; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceStructure; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/SupportVerbConstraint.java b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/SupportVerbConstraint.java index 84c681d1c2539afe1b0bfff5a0137ccecc8b87fd..b29ba3027a3c9b42db4c973b297196a25384d8ab 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/SupportVerbConstraint.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/inference/constraints/SupportVerbConstraint.java @@ -9,8 +9,8 @@ import edu.illinois.cs.cogcomp.sl.core.IInstance; import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.SRLManager; import edu.illinois.cs.cogcomp.srl.inference.SRLILPConstraintGenerator; -import edu.illinois.cs.cogcomp.srl.jlis.SRLPredicateInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLSentenceInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLPredicateInstance; +import edu.illinois.cs.cogcomp.srl.learn.SRLSentenceInstance; import java.util.ArrayList; import java.util.HashSet; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/learn/IdentifierThresholdTuner.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/IdentifierThresholdTuner.java index feb3f8293aa2fa9600745caa602cfe767b895c0e..44216dc9e8db82546b37a99e1d8a79e5995a117b 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/learn/IdentifierThresholdTuner.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/IdentifierThresholdTuner.java @@ -7,8 +7,6 @@ import edu.illinois.cs.cogcomp.core.utilities.StringUtils; import edu.illinois.cs.cogcomp.sl.core.SLProblem; import edu.illinois.cs.cogcomp.srl.core.ArgumentIdentifier; import edu.illinois.cs.cogcomp.srl.core.SRLManager; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassInstance; -import edu.illinois.cs.cogcomp.srl.jlis.SRLMulticlassLabel; import java.util.*; import java.util.Map.Entry; @@ -16,7 +14,7 @@ import java.util.concurrent.*; public class IdentifierThresholdTuner { - protected final double n_F; + private final double n_F; private final int nThreads; private final SRLManager manager; private final SLProblem problem; @@ -31,7 +29,7 @@ public class IdentifierThresholdTuner { } - protected double fN(double precision, double recall, double n) { + private double fN(double precision, double recall, double n) { double denom = n * n * precision + recall; double num = (n * n + 1) * precision * recall; @@ -140,8 +138,8 @@ public class IdentifierThresholdTuner { } @SuppressWarnings("unchecked") - public Map<Pair<Double, Double>, IntPair> getPerformance(List<Double> A, - List<Double> B, final List<Pair<Double, Boolean>> scores) + private Map<Pair<Double, Double>, IntPair> getPerformance(List<Double> A, + List<Double> B, final List<Pair<Double, Boolean>> scores) throws InterruptedException, ExecutionException { ExecutorService executor = Executors.newFixedThreadPool(nThreads); diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLFeatureExtractor.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLFeatureExtractor.java similarity index 97% rename from src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLFeatureExtractor.java rename to src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLFeatureExtractor.java index f50bfb56c698bbddffbe9f47d4efa1017ca7a16d..cc50ef509e6af2f0621eca14694ec68b30a74635 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLFeatureExtractor.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLFeatureExtractor.java @@ -1,4 +1,4 @@ -package edu.illinois.cs.cogcomp.srl.jlis; +package edu.illinois.cs.cogcomp.srl.learn; import edu.illinois.cs.cogcomp.sl.core.AbstractFeatureGenerator; import edu.illinois.cs.cogcomp.sl.core.IInstance; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLMulticlassInstance.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLMulticlassInstance.java similarity index 98% rename from src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLMulticlassInstance.java rename to src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLMulticlassInstance.java index 74412dec2fd20c99a41093b1264287e31347d0a5..00d2842e3dde34ee7cb248ddc02ccb4310c21129 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLMulticlassInstance.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLMulticlassInstance.java @@ -1,4 +1,4 @@ -package edu.illinois.cs.cogcomp.srl.jlis; +package edu.illinois.cs.cogcomp.srl.learn; import edu.illinois.cs.cogcomp.core.datastructures.IntPair; import edu.illinois.cs.cogcomp.core.datastructures.Pair; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLMulticlassLabel.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLMulticlassLabel.java similarity index 92% rename from src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLMulticlassLabel.java rename to src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLMulticlassLabel.java index a37d36e2e649b75abc5747f36a6ab99851f22930..e49d72c03ecd346bc623ea23073983fdb43913d4 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLMulticlassLabel.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLMulticlassLabel.java @@ -1,4 +1,4 @@ -package edu.illinois.cs.cogcomp.srl.jlis; +package edu.illinois.cs.cogcomp.srl.learn; import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.Models; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLPredicateInstance.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLPredicateInstance.java similarity index 99% rename from src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLPredicateInstance.java rename to src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLPredicateInstance.java index e0902f24e56e388c4abab92783d8ac60256e6e39..4bd0e15e56ec3f1d338b1ffb2990e1d2d71158ef 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLPredicateInstance.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLPredicateInstance.java @@ -1,4 +1,4 @@ -package edu.illinois.cs.cogcomp.srl.jlis; +package edu.illinois.cs.cogcomp.srl.learn; import edu.illinois.cs.cogcomp.core.datastructures.Pair; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.Constituent; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLPredicateStructure.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLPredicateStructure.java similarity index 97% rename from src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLPredicateStructure.java rename to src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLPredicateStructure.java index a5257407b90f97b705f6daaa69370f21ef21aa36..7c716f05bb59aacb2938875d49eb4ca11a684e3a 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLPredicateStructure.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLPredicateStructure.java @@ -1,4 +1,4 @@ -package edu.illinois.cs.cogcomp.srl.jlis; +package edu.illinois.cs.cogcomp.srl.learn; import edu.illinois.cs.cogcomp.sl.core.IStructure; import edu.illinois.cs.cogcomp.srl.core.Models; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLSentenceInstance.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLSentenceInstance.java similarity index 92% rename from src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLSentenceInstance.java rename to src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLSentenceInstance.java index a17450db9c9d2f19417de2d5d998d095232c6f27..57b0d1384f64bc8e298aaca01c3fbde3e7007637 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLSentenceInstance.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLSentenceInstance.java @@ -1,4 +1,4 @@ -package edu.illinois.cs.cogcomp.srl.jlis; +package edu.illinois.cs.cogcomp.srl.learn; import edu.illinois.cs.cogcomp.sl.core.IInstance; diff --git a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLSentenceStructure.java b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLSentenceStructure.java similarity index 98% rename from src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLSentenceStructure.java rename to src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLSentenceStructure.java index 184521382cb8c4b79beb18e307caca6ea26bc390..f4c9f8f989b67caf22e142bbf13334d92e56e1cb 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/srl/jlis/SRLSentenceStructure.java +++ b/src/main/java/edu/illinois/cs/cogcomp/srl/learn/SRLSentenceStructure.java @@ -1,4 +1,4 @@ -package edu.illinois.cs.cogcomp.srl.jlis; +package edu.illinois.cs.cogcomp.srl.learn; import edu.illinois.cs.cogcomp.core.datastructures.IntPair; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.Constituent; diff --git a/src/test/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabelerTest.java b/src/test/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabelerTest.java index 25ccd354c86b02af1e1d87bb278e324d1b0e682f..a59f70df195dbe9f0890a4f0b3f898a7556503eb 100644 --- a/src/test/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabelerTest.java +++ b/src/test/java/edu/illinois/cs/cogcomp/srl/SemanticRoleLabelerTest.java @@ -18,40 +18,6 @@ public class SemanticRoleLabelerTest extends TestCase { public void setUp() throws Exception { super.setUp(); - - /** - * the commented code below helps debug problems when gurobi libraries are not found. - * the first section dumps the classpath, to check for Gurobi jar. - * The second checks LD_LIBRARY_PATH, which is where the JVM looks for the JNI library. - */ -// System.err.println( "## CLASSPATH: " ); -// ClassLoader cl = ClassLoader.getSystemClassLoader(); -// URL[] urls = ((URLClassLoader)cl).getURLs(); -// -// for(URL url: urls){ -// System.out.println(url.getFile()); -// } -// -// String pathToAdd = "/home/mssammon/lib/gurobi650/linux64/lib"; -// final Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); -// usrPathsField.setAccessible(true); -// -// //get array of paths -// final String[] paths = (String[])usrPathsField.get(null); -// -// //check if the path to add is already present -// for(String path : paths) { -// System.err.println( "## found usr path: " + path ); -// if(path.equals(pathToAdd)) { -// break; -// } -// } -// -// //add the new path -// final String[] newPaths = Arrays.copyOf(paths, paths.length + 1); -// newPaths[newPaths.length-1] = pathToAdd; -// usrPathsField.set(null, newPaths); - rm = new ResourceManager( CONFIG ); } diff --git a/src/test/resources/srl-config.properties b/src/test/resources/srl-config.properties index b043e3bbf2fea13bb12159f54e82e8b868dcb29c..1a052a39df88e234f62659fd1062941bb4076d92 100644 --- a/src/test/resources/srl-config.properties +++ b/src/test/resources/srl-config.properties @@ -1,27 +1,27 @@ -############################################# -## -## Illinois SRL Configuration -## -############################################# +## 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 = true +UseCurator = false + +# The configuration of the Illinois NLP pipeline +PipelineConfig = config/pipeline.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 = Stanford -WordNetConfig = jwnl_properties.xml - # The configuration for the Structured learner LearnerConfig = config/learner.properties # Num of threads for feat. ext. - NumFeatExtThreads = 10 +# The ILP solver to use for the joint inference +# Options are: Gurobi, OJAlgo +ILPSolver = OJAlgo + ### 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/ @@ -36,4 +36,4 @@ ModelsDirectory = models # Directory to output gold and predicted files for manual comparison # Comment out for no output -OutputDirectory = srl-out +OutputDirectory = srl-out \ No newline at end of file