From b3fca32a199412daa51586b74ce202f1f63c8821 Mon Sep 17 00:00:00 2001 From: Cassio Santos Date: Thu, 8 Jun 2017 18:44:46 -0300 Subject: [PATCH] Remove comments --- .../src/info/ephyra/OpenEphyra.java | 6 ----- .../ephyra/answerselection/AnswerPattern.java | 16 ------------- .../filters/AnswerPatternFilter.java | 24 ++----------------- .../src/info/ephyra/nlp/NETagger.java | 14 ----------- .../src/info/ephyra/nlp/StanfordNeTagger.java | 14 ----------- 5 files changed, 2 insertions(+), 72 deletions(-) diff --git a/lucida/questionanswering/OpenEphyra/src/info/ephyra/OpenEphyra.java b/lucida/questionanswering/OpenEphyra/src/info/ephyra/OpenEphyra.java index 0f70b359b..0b37d7e59 100644 --- a/lucida/questionanswering/OpenEphyra/src/info/ephyra/OpenEphyra.java +++ b/lucida/questionanswering/OpenEphyra/src/info/ephyra/OpenEphyra.java @@ -13,7 +13,6 @@ import info.ephyra.answerselection.filters.ScoreSorterFilter; import info.ephyra.answerselection.filters.StopwordFilter; import info.ephyra.answerselection.filters.TruncationFilter; -//import info.ephyra.answerselection.filters.WebDocumentFetcherFilter; import info.ephyra.io.Logger; import info.ephyra.io.MsgPrinter; import info.ephyra.nlp.LingPipe; @@ -41,7 +40,6 @@ import info.ephyra.questionanalysis.QuestionNormalizer; import info.ephyra.search.Result; import info.ephyra.search.Search; -//import info.ephyra.search.searchers.BingKM; import info.ephyra.search.searchers.IndriKM; import java.util.ArrayList; @@ -274,9 +272,6 @@ protected void initFactoid() { // search // - knowledge miners for unstructured knowledge sources Search.clearKnowledgeMiners(); -// Search.addKnowledgeMiner(new BingKM()); -// Search.addKnowledgeMiner(new GoogleKM()); -// Search.addKnowledgeMiner(new YahooKM()); for (String[] indriIndices : IndriKM.getIndriIndices()) Search.addKnowledgeMiner(new IndriKM(indriIndices, false)); // for (String[] indriServers : IndriKM.getIndriServers()) @@ -290,7 +285,6 @@ protected void initFactoid() { // - answer extraction filters AnswerSelection.addFilter(new AnswerTypeFilter()); AnswerSelection.addFilter(new AnswerPatternFilter()); - //AnswerSelection.addFilter(new WebDocumentFetcherFilter()); AnswerSelection.addFilter(new PredicateExtractionFilter()); AnswerSelection.addFilter(new FactoidsFromPredicatesFilter()); AnswerSelection.addFilter(new TruncationFilter()); diff --git a/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/AnswerPattern.java b/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/AnswerPattern.java index d62ea8c19..4eff00495 100644 --- a/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/AnswerPattern.java +++ b/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/AnswerPattern.java @@ -1,9 +1,5 @@ package info.ephyra.answerselection; -//import java.io.File; -//import java.io.FileNotFoundException; -//import java.io.FileOutputStream; -//import java.io.PrintWriter; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -364,16 +360,6 @@ public String[] getPropertyTypes() { * not match the pattern */ public String[] apply(String sentence) { - - /*PrintWriter pw = null; - try { - pw = new PrintWriter(new FileOutputStream(new File("regex_data.txt"),true)); - } catch (FileNotFoundException ex) { - System.out.println("File not found exception!!"); - }*/ - - // pw.printf("%s ----- %s\n", pattern.pattern(), sentence); - Matcher m = pattern.matcher(sentence); ArrayList results = new ArrayList(); @@ -387,8 +373,6 @@ public String[] apply(String sentence) { m.region(m.start() + 1, sentence.length()); } - // pw.close(); - return results.toArray(new String[results.size()]); } } diff --git a/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/filters/AnswerPatternFilter.java b/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/filters/AnswerPatternFilter.java index 3bc7fdc99..0e0bd60cf 100644 --- a/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/filters/AnswerPatternFilter.java +++ b/lucida/questionanswering/OpenEphyra/src/info/ephyra/answerselection/filters/AnswerPatternFilter.java @@ -12,8 +12,6 @@ import info.ephyra.util.StringUtils; import java.io.BufferedReader; import java.io.File; -// import java.io.FileNotFoundException; -// import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; @@ -284,26 +282,10 @@ private static void extractPos(Result result) { tokens[i] = NETagger.tokenize(originalSentences[i]); sentences[i] = StringUtils.concatWithSpaces(tokens[i]); } - - /* PrintWriter pw = null; - try { - pw = new PrintWriter(new FileOutputStream(new File("netagger_data.txt"),true)); - } catch (FileNotFoundException ex) { - System.out.println("File not found exception!!"); - }*/ - + // extract named entities String[][][] nes = NETagger.extractNes(tokens); - - // pw.printf("%s ----- %s\n", tokens.toString(), nes.toString()); - - /*PrintWriter pw2 = null; - try { - pw2 = new PrintWriter(new FileOutputStream(new File("regex_data.txt"),true)); - } catch (FileNotFoundException ex) { - System.out.println("File not found exception!!"); - }*/ - + for (int i = 0; i < sentences.length; i++) { // prepare sentence for answer extraction sentences[i] = prepSentence(sentences[i], to, cos, nes[i]); @@ -336,8 +318,6 @@ private static void extractPos(Result result) { } } } - // pw.close(); - // pw2.close(); } /** diff --git a/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/NETagger.java b/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/NETagger.java index c65d1e274..ddb77678f 100644 --- a/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/NETagger.java +++ b/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/NETagger.java @@ -7,11 +7,8 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileFilter; -// import java.io.FileNotFoundException; -// import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; -// import java.io.PrintWriter; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; @@ -847,26 +844,15 @@ public static String[][][] extractNes(String[][] sentences) { nes[s][finders.length + allPatternNames.length + i] = neList.toArray(new String[neList.size()]); } - - /* PrintWriter pw = null; - try { - pw = new PrintWriter(new FileOutputStream(new File("StanfordNeTagger_data.txt"),true)); - } catch (FileNotFoundException ex) { - System.out.println("File not found exception!!"); - }*/ // apply stanford tagger HashMap allStanfordNEs = StanfordNeTagger.extractNEs(StringUtils.concatWithSpaces(sentences[s])); - //pw.printf("%s\n", StringUtils.concatWithSpaces(sentences[s])); - // pw.printf("%s ----- %s\n", StringUtils.concatWithSpaces(sentences[s]), nes.toString()); - for (int i = 0; i < stanfordNames.length; i++) { String[] stanfordNEs = allStanfordNEs.get(stanfordNames[i]); if (stanfordNEs == null) stanfordNEs = new String[0]; nes[s][finders.length + allPatternNames.length + lists.length + i] = stanfordNEs; } - //pw.close(); } return nes; diff --git a/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/StanfordNeTagger.java b/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/StanfordNeTagger.java index 24ba32f0e..5d065ec05 100644 --- a/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/StanfordNeTagger.java +++ b/lucida/questionanswering/OpenEphyra/src/info/ephyra/nlp/StanfordNeTagger.java @@ -7,10 +7,6 @@ import edu.stanford.nlp.ie.AbstractSequenceClassifier; import edu.stanford.nlp.ie.crf.CRFClassifier; -// import java.io.File; -// import java.io.FileNotFoundException; -// import java.io.FileOutputStream; -// import java.io.PrintWriter; /** * Wrapper for the Stanford named entity recognizer. @@ -108,13 +104,6 @@ public static HashMap extractNEs(String sentence) { sentence.matches("\\W*+")) return new HashMap(); - /* PrintWriter pw = null; - try { - pw = new PrintWriter(new FileOutputStream(new File("StanfordNeTagger_data.txt"),true)); - } catch (FileNotFoundException ex) { - System.out.println("File not found exception!!"); - }*/ - String neString = ""; try { neString = classifier.testString(sentence); @@ -126,9 +115,6 @@ public static HashMap extractNEs(String sentence) { MsgPrinter.printErrorMsg(e.toString()); } - //pw.printf("%s ----- %s\n", sentence, neString); - //pw.close(); - String[] neTokens = neString.split("\\s"); String mark = "O"; String ne = "";