Skip to content

Commit

Permalink
Remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cassiosantos committed Jun 8, 2017
1 parent 43ec0f4 commit b3fca32
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<String> results = new ArrayList<String>();

Expand All @@ -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()]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -336,8 +318,6 @@ private static void extractPos(Result result) {
}
}
}
// pw.close();
// pw2.close();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 <String, String[]> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -108,13 +104,6 @@ public static HashMap<String, String[]> extractNEs(String sentence) {
sentence.matches("\\W*+"))
return new HashMap<String, String[]>();

/* 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);
Expand All @@ -126,9 +115,6 @@ public static HashMap<String, String[]> 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 = "";
Expand Down

0 comments on commit b3fca32

Please sign in to comment.