From daa66759cef5f1e2b3d90a0efa425b242ebddba1 Mon Sep 17 00:00:00 2001 From: khashab2 Date: Sun, 29 Oct 2017 20:47:50 -0400 Subject: [PATCH 01/11] adding transliteration models. --- .../core/datastructures/ViewNames.java | 1 + .../pipeline/main/PipelineFactory.java | 7 +- .../cogcomp/pipeline/server/MainServer.java | 28 ++-- transliteration/pom.xml | 20 +-- .../annotation/TransliterationAnnotator.java | 137 +++++++++++++++++- .../TransliterationConfigurator.java | 6 +- .../TransliterationAnnotatorTest.java | 8 +- 7 files changed, 161 insertions(+), 46 deletions(-) diff --git a/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java b/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java index 3b8bca274..14a9f4219 100644 --- a/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java +++ b/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java @@ -31,6 +31,7 @@ public class ViewNames { public static final String POS = "POS"; public static final String MENTION = "MENTION"; + public static final String RELATION = "RELATION"; /** the tree gazetteer produced by the SimpleGazetteerAnnotator. */ public static final String TREE_GAZETTEER = "TREE_GAZETTEER"; diff --git a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java index 8d65b75ba..731932e2f 100644 --- a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java +++ b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java @@ -10,6 +10,7 @@ import edu.illinois.cs.cogcomp.annotation.*; import edu.illinois.cs.cogcomp.chunker.main.ChunkerAnnotator; import edu.illinois.cs.cogcomp.comma.CommaLabeler; +import edu.illinois.cs.cogcomp.core.constants.Language; import edu.illinois.cs.cogcomp.core.datastructures.ViewNames; import edu.illinois.cs.cogcomp.core.utilities.configuration.Configurator; import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager; @@ -351,8 +352,10 @@ private static Map buildAnnotators(ResourceManager nonDefault } if (rm.getBoolean(PipelineConfigurator.USE_TRANSLITERATION)) { - TransliterationAnnotator transliterationAnnotator = new TransliterationAnnotator(); - viewGenerators.put(ViewNames.TRANSLITERATION, transliterationAnnotator); + for(Language lang : TransliterationAnnotator.supportedLanguages) { + TransliterationAnnotator transliterationAnnotator = new TransliterationAnnotator(true, lang); + viewGenerators.put(ViewNames.TRANSLITERATION + "_" + lang.getCode(), transliterationAnnotator); + } } if (rm.getBoolean(PipelineConfigurator.USE_SRL_PREP)) { diff --git a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java index 360f1e53d..3f833e57c 100644 --- a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java +++ b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java @@ -98,28 +98,27 @@ public static void startServer(String[] args, Logger logger) { // create a hashmap to keep track of client ip addresses and their int rate = parseResults.getInt("rate"); - if( rate > 0) { + if (rate > 0) { clients = new HashMap(); } AnnotatorService finalPipeline = pipeline; - get("/annotate", "application/json", (request, response)->{ + get("/annotate", "application/json", (request, response) -> { logger.info("GET request . . . "); boolean canServe = true; - if(rate > 0) { + if (rate > 0) { resetServer(); String ip = request.ip(); int callsSofar = (Integer) clients.getOrDefault(ip, 0); - if( callsSofar > rate ) canServe = false; + if (callsSofar > rate) canServe = false; clients.put(ip, callsSofar + 1); } - if(canServe) { + if (canServe) { logger.info("request.body(): " + request.body()); String text = request.queryParams("text"); String views = request.queryParams("views"); return annotateText(finalPipeline, text, views, logger); - } - else { + } else { response.status(429); return "You have reached your maximum daily query limit :-/ "; } @@ -129,22 +128,21 @@ public static void startServer(String[] args, Logger logger) { { logger.info("POST request . . . "); boolean canServe = true; - if(rate > 0) { + if (rate > 0) { resetServer(); String ip = request.ip(); int callsSofar = (Integer) clients.getOrDefault(ip, 0); - if( callsSofar > rate ) canServe = false; + if (callsSofar > rate) canServe = false; clients.put(ip, callsSofar + 1); } - if(canServe) { - logger.info( "request.body(): " + request.body()); + if (canServe) { + logger.info("request.body(): " + request.body()); Map map = splitQuery(request.body()); System.out.println("POST body parameters parsed: " + map); String text = map.get("text"); String views = map.get("views"); return annotateText(finalPipeline, text, views, logger); - } - else { + } else { response.status(429); return "You have reached your maximum daily query limit :-/ "; } @@ -153,7 +151,7 @@ public static void startServer(String[] args, Logger logger) { // api to get name of the available views String viewsString = ""; - for(String view : pipeline.getAvailableViews()) { + for (String view : pipeline.getAvailableViews()) { viewsString += ", " + view; } String finalViewsString = viewsString; @@ -175,7 +173,7 @@ public static void main(String[] args) { } private static String annotateText(AnnotatorService finalPipeline, String text, String views, - Logger logger) throws AnnotatorException { + Logger logger) throws AnnotatorException { if (views == null || text == null) { return "The parameters 'text' and/or 'views' are not specified. Here is a sample input: \n ?text=\"This is a sample sentence. I'm happy.\"&views=POS,NER"; } else { diff --git a/transliteration/pom.xml b/transliteration/pom.xml index e74895580..2ee64ec96 100644 --- a/transliteration/pom.xml +++ b/transliteration/pom.xml @@ -31,13 +31,16 @@ http://www.w3.org/2001/XMLSchema-instance "> 3.8.1 test - edu.illinois.cs.cogcomp illinois-core-utilities 3.1.34 - + + edu.illinois.cs.cogcomp + illinois-edison + 3.1.34 + org.apache.commons commons-lang3 @@ -49,25 +52,21 @@ http://www.w3.org/2001/XMLSchema-instance "> 4.12 test - com.belerweb pinyin4j 2.5.0 - org.slf4j slf4j-log4j12 1.7.13 - com.ibm.icu icu4j 56.1 - edu.illinois.cs.cogcomp illinois-abstract-server @@ -78,7 +77,6 @@ http://www.w3.org/2001/XMLSchema-instance "> curator-interfaces 0.7 - org.apache.thrift libthrift @@ -89,7 +87,6 @@ http://www.w3.org/2001/XMLSchema-instance "> curator-utils 0.0.4-SNAPSHOT - @@ -122,13 +119,6 @@ http://www.w3.org/2001/XMLSchema-instance "> src/main/resources - - - org.apache.maven.wagon - wagon-ssh - 2.4 - - diff --git a/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationAnnotator.java b/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationAnnotator.java index 37f8831b6..be8faa5ce 100644 --- a/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationAnnotator.java +++ b/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationAnnotator.java @@ -7,37 +7,162 @@ */ package edu.illinois.cs.cogcomp.annotation; +import edu.illinois.cs.cogcomp.core.constants.Language; import edu.illinois.cs.cogcomp.core.datastructures.Pair; import edu.illinois.cs.cogcomp.core.datastructures.ViewNames; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.Constituent; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TokenLabelView; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.View; +import edu.illinois.cs.cogcomp.core.resources.ResourceConfigurator; import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager; import edu.illinois.cs.cogcomp.transliteration.SPModel; import edu.illinois.cs.cogcomp.utils.TopList; -import jdk.nashorn.internal.parser.Token; +import io.minio.errors.InvalidEndpointException; +import io.minio.errors.InvalidPortException; +import org.cogcomp.Datastore; +import org.cogcomp.DatastoreException; +import org.slf4j.LoggerFactory; +import java.io.File; import java.io.IOException; public class TransliterationAnnotator extends Annotator { - SPModel model; + Language lang; + + private org.slf4j.Logger logger = LoggerFactory.getLogger(TransliterationAnnotator.class); public TransliterationAnnotator() { - super(ViewNames.TRANSLITERATION, new String[0]); + this(true, Language.Arabic); } public TransliterationAnnotator(boolean lazilyInitialize) { + this(lazilyInitialize, Language.Arabic); + } + + public TransliterationAnnotator(boolean lazilyInitialize, Language lang) { super(ViewNames.TRANSLITERATION, new String[0], lazilyInitialize); + this.lang = lang; + } + + public static Language[] supportedLanguages = { + Language.Abkhazian, + Language.Afrikaans, + Language.Arabic, + Language.Aragonese, + Language.Egyptian_Arabic, + Language.Asturian, + Language.Azerbaijani, + Language.Bashkir, + Language.Belarusian, + Language.Bengali, + Language.Bosnian, + Language.Breton, + Language.Bulgarian, + Language.Valencian, + Language.Czech, + Language.Chechen, + Language.Chuvash, + Language.Sorani, + Language.Danish, + Language.Greek, + Language.Esperanto, + Language.Estonian, + Language.Basque, + Language.Persian, + Language.Finnish, + Language.French, + Language.Western_Frisian, + Language.Galician, + Language.Gujarati, + Language.Haitian, + Language.Hebrew, + Language.Croatian, + Language.Upper_Sorbian, + Language.Hungarian, + Language.Armenian, + Language.Interlingua, + Language.Indonesian, + Language.Icelandic, + Language.Javanese, + Language.Georgian, + Language.Kazakh, + Language.Kabardian, + Language.Kirghiz, + Language.Kurdish, + Language.Latin, + Language.Latvian, + Language.Limburgish, + Language.Lithuanian, + Language.Luxembourgish, + Language.Maithili, + Language.Marathi, + Language.Macedonian, + Language.Malagasy, + Language.Mongolian, + Language.Malay, + Language.Mazandarani, + Language.Nahuatl, + Language.Nepali, + Language.Norwegian_Nynorsk, + Language.Occitan, + Language.Oriya, + Language.Ossetian, + Language.Punjabi, + Language.Polish, + Language.Portuguese, + Language.Quechua, + Language.Romansh, + Language.Romanian, + Language.Russian, + Language.Sicilian, + Language.Scots, + Language.Slovak, + Language.Slovenian, + Language.Somali, + Language.Castilian, + Language.Albanian, + Language.Serbian, + Language.Sundanese, + Language.Swahili, + Language.Swedish, + Language.Tamil, + Language.Telugu, + Language.Tajik, + Language.Tagalog, + Language.Turkmen, + Language.Turkish, + Language.Ukrainian, + Language.Urdu, + Language.Uzbek, + Language.Vietnamese, + Language.Waray, + Language.Walloon, + Language.Yiddish, + Language.Zazaki + }; + + public void setLanguage(Language lang) { + this.lang = lang; + initialize(null); // load the new model } @Override public void initialize(ResourceManager rm) { try { - model = new SPModel(rm.getString(TransliterationConfigurator.MODEL_PATH.key)); - model.setMaxCandidates(1); - } catch (IOException e) { + Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig()); + File f = dsNoCredentials.getDirectory("org.cogcomp.transliteration", "transliteration-models", 1.3, false); + String modelPath = f.getAbsolutePath() + File.separator + "transliteration-models-oct-2017" + File.separator + "probs-" + lang.getCode() + ".txt"; + if(new File(modelPath).exists()) { + logger.info("Loading transliteration models for language: " + lang + " from " + modelPath); + model = new SPModel(modelPath); + model.setMaxCandidates(1); + } + else { + logger.error("Model for language: " + lang + " don't exist: " + modelPath); + } + } catch (IOException | InvalidEndpointException | DatastoreException | InvalidPortException e) { e.printStackTrace(); } } diff --git a/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationConfigurator.java b/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationConfigurator.java index 367e82f27..917bd9151 100644 --- a/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationConfigurator.java +++ b/transliteration/src/main/java/edu/illinois/cs/cogcomp/annotation/TransliterationConfigurator.java @@ -13,13 +13,11 @@ public class TransliterationConfigurator extends Configurator { - public static final Property LANGUAGE = new Property("usePos", FALSE); - - public static final Property MODEL_PATH = new Property("transliterationModelPath", ""); // todo: fix this + // nothing here for now; use it in future @Override public ResourceManager getDefaultConfig() { - Property[] properties = { MODEL_PATH, LANGUAGE }; + Property[] properties = { }; return (new TransliterationConfigurator().getConfig(new ResourceManager(generateProperties(properties)))); } diff --git a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java index 85469f545..d52cbd523 100644 --- a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java +++ b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java @@ -9,6 +9,7 @@ import edu.illinois.cs.cogcomp.annotation.AnnotatorException; import edu.illinois.cs.cogcomp.annotation.TransliterationAnnotator; +import edu.illinois.cs.cogcomp.core.constants.Language; import edu.illinois.cs.cogcomp.core.datastructures.ViewNames; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation; import edu.illinois.cs.cogcomp.core.utilities.DummyTextAnnotationGenerator; @@ -22,14 +23,13 @@ public class TransliterationAnnotatorTest { TransliterationAnnotator annotator = null; @Before public void setUp() throws Exception { - this.annotator = new TransliterationAnnotator(); + this.annotator = new TransliterationAnnotator(true, Language.Persian); } -/* @Test + @Test public void testCleanText() throws AnnotatorException { TextAnnotation ta = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(false, 3); annotator.getView(ta); assertEquals(true, ta.hasView(ViewNames.TRANSLITERATION)); - System.out.println(ta.getView(ViewNames.TRANSLITERATION)); - }*/ + } } From cfdd8d0f6bcdd01a71fe7af7b0dce103ccd72117 Mon Sep 17 00:00:00 2001 From: khashab2 Date: Sun, 29 Oct 2017 20:50:55 -0400 Subject: [PATCH 02/11] change relation view name. --- .../edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java index 731932e2f..1d854855e 100644 --- a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java +++ b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java @@ -378,7 +378,7 @@ private static Map buildAnnotators(ResourceManager nonDefault } if (rm.getBoolean(PipelineConfigurator.USE_RELATION)){ RelationAnnotator relationAnnotator = new RelationAnnotator(); - viewGenerators.put(ViewNames.MENTION, relationAnnotator); + viewGenerators.put(ViewNames.RELATION, relationAnnotator); } if (rm.getBoolean(PipelineConfigurator.USE_TIMEX3)){ Properties rmProps = new TemporalChunkerConfigurator().getDefaultConfig().getProperties(); From 60b45aadcd689fbe5fc6e0af66ca0aa585c0cff7 Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 14:49:17 -0400 Subject: [PATCH 03/11] adding option to the relation annotato to load the semeval models. --- .../pipeline/main/PipelineFactory.java | 4 +- .../org/cogcomp/re/RelationAnnotator.java | 74 +++++++++++-------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java index 1d854855e..fecf185fd 100644 --- a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java +++ b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java @@ -377,8 +377,8 @@ private static Map buildAnnotators(ResourceManager nonDefault viewGenerators.put(ViewNames.MENTION, mentionAnnotator); } if (rm.getBoolean(PipelineConfigurator.USE_RELATION)){ - RelationAnnotator relationAnnotator = new RelationAnnotator(); - viewGenerators.put(ViewNames.RELATION, relationAnnotator); + viewGenerators.put(ViewNames.RELATION + "_ACE", new RelationAnnotator(true, "ACE")); + viewGenerators.put(ViewNames.RELATION + "_SEMEVAL", new RelationAnnotator(true, "SEMEVAL")); } if (rm.getBoolean(PipelineConfigurator.USE_TIMEX3)){ Properties rmProps = new TemporalChunkerConfigurator().getDefaultConfig().getProperties(); diff --git a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java index 5c1382f1f..fd3e091bb 100644 --- a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java +++ b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java @@ -33,25 +33,36 @@ public class RelationAnnotator extends Annotator { private ACERelationConstrainedClassifier constrainedClassifier; private Gazetteers gazetteers; private WordNetManager wordNet; - private MentionAnnotator mentionAnnotator; + private String type = "ACE"; // default relation type public RelationAnnotator() { this(true); } - public RelationAnnotator(boolean lazilyInitialize) { - super(ViewNames.MENTION, new String[]{ViewNames.POS, ViewNames.DEPENDENCY_STANFORD, ViewNames.SHALLOW_PARSE}, lazilyInitialize); + this(lazilyInitialize, "ACE"); + } + + public RelationAnnotator(boolean lazilyInitialize, String type) { + super(ViewNames.RELATION, new String[]{ViewNames.MENTION, ViewNames.POS, ViewNames.DEPENDENCY_STANFORD, ViewNames.SHALLOW_PARSE}, lazilyInitialize); + this.type = (type.contains("ACE")) ? "ACE" : "SEMEVAL"; } @Override public void initialize(ResourceManager rm) { try { - mentionAnnotator = new MentionAnnotator("ACE_TYPE"); Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig()); - File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false); - String modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc"; - String lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex"; + String modelFile; + String lexFile; + if (type.equals("ACE")) { + File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false); + modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc"; + lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex"; + } else { + File modelDir = ds.getDirectory("org.cogcomp.re", "SEMEVAL", 1.1, false); + modelFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lc"; + lexFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lex"; + } relationClassifier = new relation_classifier(); relationClassifier.readModel(modelFile); relationClassifier.readLexicon(lexFile); @@ -61,32 +72,35 @@ public void initialize(ResourceManager rm) { WordNetManager.loadConfigAsClasspathResource(true); wordNet = WordNetManager.getInstance(); gazetteers = GazetteersFactory.get(); - } - catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } } @Override public void addView(TextAnnotation record) throws AnnotatorException { - if (!isInitialized()){ + if (!isInitialized()) { doInitialize(); } - if (!record.hasView(ViewNames.POS) ){ + if (!record.hasView(ViewNames.POS)) { throw new AnnotatorException("Missing required view POS"); } - if (!record.hasView(ViewNames.DEPENDENCY_STANFORD)){ + if (!record.hasView(ViewNames.DEPENDENCY_STANFORD)) { throw new AnnotatorException("Missing required view DEPENDENCY_STANFORD"); } - if (!record.hasView(ViewNames.SHALLOW_PARSE)){ + if (!record.hasView(ViewNames.SHALLOW_PARSE)) { throw new AnnotatorException("Missing required view SHALLOW_PARSE"); } - mentionAnnotator.addView(record); + if (!record.hasView(ViewNames.MENTION)) { + // TODO: show error messages if the mentions are not typed. + throw new AnnotatorException("Missing required view MENTION"); + } + View mentionView = record.getView(ViewNames.MENTION); View annotatedTokenView = new SpanLabelView("RE_ANNOTATED", record); - for (Constituent co : record.getView(ViewNames.TOKENS).getConstituents()){ + for (Constituent co : record.getView(ViewNames.TOKENS).getConstituents()) { Constituent c = co.cloneForNewView("RE_ANNOTATED"); - for (String s : co.getAttributeKeys()){ + for (String s : co.getAttributeKeys()) { c.addAttribute(s, co.getAttribute(s)); } c.addAttribute("WORDNETTAG", BIOFeatureExtractor.getWordNetTags(wordNet, c)); @@ -94,28 +108,28 @@ public void addView(TextAnnotation record) throws AnnotatorException { annotatedTokenView.addConstituent(c); } record.addView("RE_ANNOTATED", annotatedTokenView); - for (int i = 0; i < record.getNumberOfSentences(); i++){ + for (int i = 0; i < record.getNumberOfSentences(); i++) { Sentence curSentence = record.getSentence(i); List cins = mentionView.getConstituentsCoveringSpan(curSentence.getStartSpan(), curSentence.getEndSpan()); - for (int j = 0; j < cins.size(); j++){ - for (int k = j + 1; k < cins.size(); k++){ + for (int j = 0; j < cins.size(); j++) { + for (int k = j + 1; k < cins.size(); k++) { if (k == j) continue; Constituent source = cins.get(j); Constituent target = cins.get(k); Constituent sourceHead = MentionAnnotator.getHeadConstituent(source, ""); Constituent targetHead = MentionAnnotator.getHeadConstituent(target, ""); source.addAttribute("GAZ", ((FlatGazetteers) gazetteers).annotatePhrase(sourceHead)); - target.addAttribute("GAZ", ((FlatGazetteers)gazetteers).annotatePhrase(targetHead)); + target.addAttribute("GAZ", ((FlatGazetteers) gazetteers).annotatePhrase(targetHead)); Relation for_test_forward = new Relation("PredictedRE", source, target, 1.0f); Relation for_test_backward = new Relation("PredictedRE", target, source, 1.0f); String tag_forward = constrainedClassifier.discreteValue(for_test_forward); String tag_backward = constrainedClassifier.discreteValue(for_test_backward); - if (tag_forward.equals(ACEMentionReader.getOppoName(tag_backward)) && !tag_forward.equals("NOT_RELATED")){ + if (tag_forward.equals(ACEMentionReader.getOppoName(tag_backward)) && !tag_forward.equals("NOT_RELATED")) { String tag = tag_forward; Constituent first = source; Constituent second = target; - if (tag_forward.length() > tag_backward.length()){ + if (tag_forward.length() > tag_backward.length()) { tag = tag_backward; first = target; second = source; @@ -127,32 +141,32 @@ public void addView(TextAnnotation record) throws AnnotatorException { mentionView.addRelation(r); } if (!tag_forward.equals(ACEMentionReader.getOppoName(tag_backward)) && - (!tag_forward.equals("NOT_RELATED") || !tag_backward.equals("NOT_RELATED"))){ + (!tag_forward.equals("NOT_RELATED") || !tag_backward.equals("NOT_RELATED"))) { double forward_score = 0.0; double backward_score = 0.0; ScoreSet scores = relationClassifier.scores(for_test_forward); Score[] scoresArray = scores.toArray(); - for (Score s : scoresArray){ - if (s.value.equals(tag_forward)){ + for (Score s : scoresArray) { + if (s.value.equals(tag_forward)) { forward_score = s.score; } } scores = relationClassifier.scores(for_test_backward); scoresArray = scores.toArray(); - for (Score s : scoresArray){ - if (s.value.equals(tag_forward)){ + for (Score s : scoresArray) { + if (s.value.equals(tag_forward)) { backward_score = s.score; } } String tag = tag_forward; Constituent first = source; Constituent second = target; - if (forward_score < backward_score && backward_score - forward_score > 0.005){ + if (forward_score < backward_score && backward_score - forward_score > 0.005) { tag = tag_backward; first = target; second = source; } - if (!tag.equals("NOT_RELATED")){ + if (!tag.equals("NOT_RELATED")) { String coarseType = ACERelationTester.getCoarseType(tag); Relation r = new Relation(coarseType, first, second, 1.0f); r.addAttribute("RelationType", coarseType); @@ -163,7 +177,7 @@ public void addView(TextAnnotation record) throws AnnotatorException { } } } - record.addView(ViewNames.MENTION, mentionView); + record.addView(ViewNames.RELATION, mentionView); } } \ No newline at end of file From e21c71528bfe95b06ddf500214692d9757bfb55f Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 15:28:58 -0400 Subject: [PATCH 04/11] minor fixes. --- .../cs/cogcomp/core/datastructures/ViewNames.java | 1 + .../cs/cogcomp/pipeline/main/PipelineFactory.java | 3 +++ .../cs/cogcomp/pipeline/server/MainServer.java | 8 ++++---- .../transliteration/TransliterationAnnotatorTest.java | 11 +++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java b/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java index 14a9f4219..102e16796 100644 --- a/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java +++ b/core-utilities/src/main/java/edu/illinois/cs/cogcomp/core/datastructures/ViewNames.java @@ -141,6 +141,7 @@ public static ViewTypes getViewType(String viewName) { case SENTENCE: case PARAGRAPH: case MENTION: + case RELATION: case MENTION_ACE: case MENTION_ERE: case NER_CONLL: diff --git a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java index fecf185fd..f90690e2d 100644 --- a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java +++ b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java @@ -131,6 +131,9 @@ public static BasicAnnotatorService buildPipeline(Boolean disableCache, String.. Configurator.TRUE); break; case ViewNames.MENTION: + nonDefaultValues.put(PipelineConfigurator.USE_MENTION.key, + Configurator.TRUE); + case ViewNames.RELATION: nonDefaultValues.put(PipelineConfigurator.USE_RELATION.key, Configurator.TRUE); break; diff --git a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java index 3f833e57c..79b329e4a 100644 --- a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java +++ b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/server/MainServer.java @@ -58,7 +58,7 @@ public static void setAnnotatorService(AnnotatorService service) { pipeline = service; } - public static void setPipeline(Logger logger) { + public static void setPipeline() { try { logger.info("Starting to load the pipeline . . . "); printMemoryDetails(logger); @@ -82,7 +82,7 @@ public static void resetServer() { } } - public static void startServer(String[] args, Logger logger) { + public static void startServer(String[] args) { Namespace parseResults; try { @@ -168,8 +168,8 @@ public static double getHour() { } public static void main(String[] args) { - setPipeline(logger); - startServer(args, logger); + setPipeline(); + startServer(args); } private static String annotateText(AnnotatorService finalPipeline, String text, String views, diff --git a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java index d52cbd523..270f2eb14 100644 --- a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java +++ b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java @@ -11,16 +11,21 @@ import edu.illinois.cs.cogcomp.annotation.TransliterationAnnotator; import edu.illinois.cs.cogcomp.core.constants.Language; import edu.illinois.cs.cogcomp.core.datastructures.ViewNames; +import edu.illinois.cs.cogcomp.core.datastructures.textannotation.Constituent; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation; import edu.illinois.cs.cogcomp.core.utilities.DummyTextAnnotationGenerator; import org.junit.Before; import org.junit.Test; +import java.util.List; + import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class TransliterationAnnotatorTest { TransliterationAnnotator annotator = null; + @Before public void setUp() throws Exception { this.annotator = new TransliterationAnnotator(true, Language.Persian); @@ -31,5 +36,11 @@ public void testCleanText() throws AnnotatorException { TextAnnotation ta = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(false, 3); annotator.getView(ta); assertEquals(true, ta.hasView(ViewNames.TRANSLITERATION)); + List consList = ta.getView(ViewNames.TRANSLITERATION).getConstituents(); + boolean hasJohn = false; + for (Constituent c : consList) { + if (c.getLabel().contains("جان")) hasJohn = true; + } + assertTrue(hasJohn); } } From 523df0690ca5b49968a9408186156ab3601a1fc5 Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 15:34:29 -0400 Subject: [PATCH 05/11] error messages when there is no type. --- .../main/java/org/cogcomp/re/RelationAnnotator.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java index fd3e091bb..ffb89204e 100644 --- a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java +++ b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java @@ -23,12 +23,16 @@ import org.cogcomp.md.BIOFeatureExtractor; import org.cogcomp.md.MentionAnnotator; import org.cogcomp.re.LbjGen.relation_classifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.util.List; public class RelationAnnotator extends Annotator { + private static Logger logger = LoggerFactory.getLogger(RelationAnnotator.class); + private relation_classifier relationClassifier; private ACERelationConstrainedClassifier constrainedClassifier; private Gazetteers gazetteers; @@ -92,9 +96,11 @@ public void addView(TextAnnotation record) throws AnnotatorException { throw new AnnotatorException("Missing required view SHALLOW_PARSE"); } if (!record.hasView(ViewNames.MENTION)) { - // TODO: show error messages if the mentions are not typed. throw new AnnotatorException("Missing required view MENTION"); } + if (record.getView(ViewNames.MENTION).getConstituents().get(0).getAttribute("EntityType").equals("MENTION")){ + logger.error("The mentions don't have types; this will cause poor performance in predictions.. . "); + } View mentionView = record.getView(ViewNames.MENTION); View annotatedTokenView = new SpanLabelView("RE_ANNOTATED", record); @@ -177,7 +183,7 @@ public void addView(TextAnnotation record) throws AnnotatorException { } } } - record.addView(ViewNames.RELATION, mentionView); + record.addView(ViewNames.RELATION + "_" + type, mentionView); } } \ No newline at end of file From 8bfdd739f767067bfeabf50aee2b95a13b9b21ba Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 16:00:26 -0400 Subject: [PATCH 06/11] minor changes to re annotator. --- .../main/java/org/cogcomp/re/RelationAnnotator.java | 13 +++++++++---- .../TransliterationAnnotatorTest.java | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java index ffb89204e..094653901 100644 --- a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java +++ b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java @@ -23,6 +23,7 @@ import org.cogcomp.md.BIOFeatureExtractor; import org.cogcomp.md.MentionAnnotator; import org.cogcomp.re.LbjGen.relation_classifier; +import org.cogcomp.re.LbjGen.semeval_relation_classifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,6 +35,7 @@ public class RelationAnnotator extends Annotator { private static Logger logger = LoggerFactory.getLogger(RelationAnnotator.class); private relation_classifier relationClassifier; + private semeval_relation_classifier semeval_relation_classifier; private ACERelationConstrainedClassifier constrainedClassifier; private Gazetteers gazetteers; private WordNetManager wordNet; @@ -62,15 +64,18 @@ public void initialize(ResourceManager rm) { File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false); modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc"; lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex"; + relationClassifier = new relation_classifier(); + relationClassifier.readModel(modelFile); + relationClassifier.readLexicon(lexFile); + constrainedClassifier = new ACERelationConstrainedClassifier(relationClassifier); } else { File modelDir = ds.getDirectory("org.cogcomp.re", "SEMEVAL", 1.1, false); modelFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lc"; lexFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lex"; + semeval_relation_classifier = new semeval_relation_classifier(); + semeval_relation_classifier.readLexicon(lexFile); + semeval_relation_classifier.readModel(modelFile); } - relationClassifier = new relation_classifier(); - relationClassifier.readModel(modelFile); - relationClassifier.readLexicon(lexFile); - constrainedClassifier = new ACERelationConstrainedClassifier(relationClassifier); File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.6, false); GazetteersFactory.init(5, gazetteersResource.getPath() + File.separator + "gazetteers", true); WordNetManager.loadConfigAsClasspathResource(true); diff --git a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java index 270f2eb14..3b0444292 100644 --- a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java +++ b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java @@ -32,7 +32,7 @@ public void setUp() throws Exception { } @Test - public void testCleanText() throws AnnotatorException { + public void testTransliterationWorks() throws AnnotatorException { TextAnnotation ta = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(false, 3); annotator.getView(ta); assertEquals(true, ta.hasView(ViewNames.TRANSLITERATION)); From 9d11be06ff752f1c43408cc41d56cfc0b9588812 Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 16:37:23 -0400 Subject: [PATCH 07/11] revert back some changes to REAnnotator. --- .../org/cogcomp/re/RelationAnnotator.java | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java index 094653901..f0fdb8afb 100644 --- a/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java +++ b/relation-extraction/src/main/java/org/cogcomp/re/RelationAnnotator.java @@ -23,7 +23,6 @@ import org.cogcomp.md.BIOFeatureExtractor; import org.cogcomp.md.MentionAnnotator; import org.cogcomp.re.LbjGen.relation_classifier; -import org.cogcomp.re.LbjGen.semeval_relation_classifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,47 +34,29 @@ public class RelationAnnotator extends Annotator { private static Logger logger = LoggerFactory.getLogger(RelationAnnotator.class); private relation_classifier relationClassifier; - private semeval_relation_classifier semeval_relation_classifier; private ACERelationConstrainedClassifier constrainedClassifier; private Gazetteers gazetteers; private WordNetManager wordNet; - private String type = "ACE"; // default relation type public RelationAnnotator() { this(true); } public RelationAnnotator(boolean lazilyInitialize) { - this(lazilyInitialize, "ACE"); - } - - public RelationAnnotator(boolean lazilyInitialize, String type) { super(ViewNames.RELATION, new String[]{ViewNames.MENTION, ViewNames.POS, ViewNames.DEPENDENCY_STANFORD, ViewNames.SHALLOW_PARSE}, lazilyInitialize); - this.type = (type.contains("ACE")) ? "ACE" : "SEMEVAL"; } @Override public void initialize(ResourceManager rm) { try { Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig()); - String modelFile; - String lexFile; - if (type.equals("ACE")) { - File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false); - modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc"; - lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex"; - relationClassifier = new relation_classifier(); - relationClassifier.readModel(modelFile); - relationClassifier.readLexicon(lexFile); - constrainedClassifier = new ACERelationConstrainedClassifier(relationClassifier); - } else { - File modelDir = ds.getDirectory("org.cogcomp.re", "SEMEVAL", 1.1, false); - modelFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lc"; - lexFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lex"; - semeval_relation_classifier = new semeval_relation_classifier(); - semeval_relation_classifier.readLexicon(lexFile); - semeval_relation_classifier.readModel(modelFile); - } + File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false); + String modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc"; + String lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex"; + relationClassifier = new relation_classifier(); + relationClassifier.readModel(modelFile); + relationClassifier.readLexicon(lexFile); + constrainedClassifier = new ACERelationConstrainedClassifier(relationClassifier); File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.6, false); GazetteersFactory.init(5, gazetteersResource.getPath() + File.separator + "gazetteers", true); WordNetManager.loadConfigAsClasspathResource(true); @@ -103,7 +84,7 @@ public void addView(TextAnnotation record) throws AnnotatorException { if (!record.hasView(ViewNames.MENTION)) { throw new AnnotatorException("Missing required view MENTION"); } - if (record.getView(ViewNames.MENTION).getConstituents().get(0).getAttribute("EntityType").equals("MENTION")){ + if (record.getView(ViewNames.MENTION).getConstituents().get(0).getAttribute("EntityType").equals("MENTION")) { logger.error("The mentions don't have types; this will cause poor performance in predictions.. . "); } @@ -188,7 +169,7 @@ public void addView(TextAnnotation record) throws AnnotatorException { } } } - record.addView(ViewNames.RELATION + "_" + type, mentionView); + record.addView(ViewNames.RELATION, mentionView); } } \ No newline at end of file From b295741b8ea48d86f7be574bbf38b0cfc5ac16cc Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 16:46:21 -0400 Subject: [PATCH 08/11] minor comment. --- .../cogcomp/transliteration/TransliterationAnnotatorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java index 3b0444292..61a6a9924 100644 --- a/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java +++ b/transliteration/src/test/java/edu/illinois/cs/cogcomp/transliteration/TransliterationAnnotatorTest.java @@ -39,7 +39,7 @@ public void testTransliterationWorks() throws AnnotatorException { List consList = ta.getView(ViewNames.TRANSLITERATION).getConstituents(); boolean hasJohn = false; for (Constituent c : consList) { - if (c.getLabel().contains("جان")) hasJohn = true; + if (c.getLabel().contains("جان")) hasJohn = true; // Persian transliteration of "John" } assertTrue(hasJohn); } From 56553880b9e643ea758ebc4ceba55b3600716d87 Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 17:06:59 -0400 Subject: [PATCH 09/11] ignore external annotator tests. --- .../pipeline/handlers/clausie/TestClausIEAnnotator.java | 2 ++ .../cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java | 3 ++- .../cs/cogcomp/pipeline/main/ExternalAnnotatorsTest.java | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/external/clausie/src/test/java/edu/illinois/cs/cogcomp/pipeline/handlers/clausie/TestClausIEAnnotator.java b/external/clausie/src/test/java/edu/illinois/cs/cogcomp/pipeline/handlers/clausie/TestClausIEAnnotator.java index c651ecfb5..7d8a12d70 100644 --- a/external/clausie/src/test/java/edu/illinois/cs/cogcomp/pipeline/handlers/clausie/TestClausIEAnnotator.java +++ b/external/clausie/src/test/java/edu/illinois/cs/cogcomp/pipeline/handlers/clausie/TestClausIEAnnotator.java @@ -10,10 +10,12 @@ import edu.illinois.cs.cogcomp.annotation.AnnotatorException; import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation; import edu.illinois.cs.cogcomp.core.utilities.DummyTextAnnotationGenerator; +import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.*; public class TestClausIEAnnotator { + @Ignore @Test public void testAnnotator() throws AnnotatorException { TextAnnotation ta = DummyTextAnnotationGenerator. diff --git a/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java b/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java index 7950f9051..b83561c0f 100644 --- a/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java +++ b/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java @@ -1,7 +1,7 @@ /** * This software is released under the University of Illinois/Research and Academic Use License. See * the LICENSE file in the root folder for details. Copyright (c) 2016 - * + *

* Developed by: The Cognitive Computation Group University of Illinois at Urbana-Champaign * http://cogcomp.cs.illinois.edu/ */ @@ -42,6 +42,7 @@ public void init() throws IOException, AnnotatorException { this.ta3 = service.createBasicTextAnnotation("", "", sampleText3); } + @Ignore @Test public void testExternalAnnotators() throws AnnotatorException { // sample text 1 diff --git a/external/stanford_3.8.0/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/ExternalAnnotatorsTest.java b/external/stanford_3.8.0/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/ExternalAnnotatorsTest.java index 919a75a6e..1cf828380 100644 --- a/external/stanford_3.8.0/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/ExternalAnnotatorsTest.java +++ b/external/stanford_3.8.0/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/ExternalAnnotatorsTest.java @@ -31,6 +31,7 @@ public class ExternalAnnotatorsTest { private TextAnnotation ta2 = null; private TextAnnotation ta3 = null; + @Ignore @Before public void init() throws IOException, AnnotatorException { Stanford_3_8_0_AnnotatorService.initialize(); @@ -42,6 +43,7 @@ public void init() throws IOException, AnnotatorException { this.ta3 = service.createBasicTextAnnotation("", "", sampleText3); } + @Ignore @Test public void testExternalAnnotators() throws AnnotatorException { service.addView(ta, StanfordOpenIEHandler.viewName); From c40c2d34b843e9795132df413f4c8a5c9031c8cc Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 17:35:34 -0400 Subject: [PATCH 10/11] fix a compile error. --- .../edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java index f90690e2d..544e22141 100644 --- a/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java +++ b/pipeline/src/main/java/edu/illinois/cs/cogcomp/pipeline/main/PipelineFactory.java @@ -380,8 +380,7 @@ private static Map buildAnnotators(ResourceManager nonDefault viewGenerators.put(ViewNames.MENTION, mentionAnnotator); } if (rm.getBoolean(PipelineConfigurator.USE_RELATION)){ - viewGenerators.put(ViewNames.RELATION + "_ACE", new RelationAnnotator(true, "ACE")); - viewGenerators.put(ViewNames.RELATION + "_SEMEVAL", new RelationAnnotator(true, "SEMEVAL")); + viewGenerators.put(ViewNames.RELATION, new RelationAnnotator(true)); } if (rm.getBoolean(PipelineConfigurator.USE_TIMEX3)){ Properties rmProps = new TemporalChunkerConfigurator().getDefaultConfig().getProperties(); From a87f4dcc7d86d636bfbb8d1df6cbd25abaef3b77 Mon Sep 17 00:00:00 2001 From: khashab2 Date: Mon, 30 Oct 2017 18:04:21 -0400 Subject: [PATCH 11/11] fixing header snippet. --- .../cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java b/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java index b83561c0f..34ac24a50 100644 --- a/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java +++ b/external/path-lstm/src/test/java/edu/illinois/cs/cogcomp/pipeline/main/PathLSTMAnnotatorTest.java @@ -1,7 +1,7 @@ /** * This software is released under the University of Illinois/Research and Academic Use License. See * the LICENSE file in the root folder for details. Copyright (c) 2016 - *

+ * * Developed by: The Cognitive Computation Group University of Illinois at Urbana-Champaign * http://cogcomp.cs.illinois.edu/ */