Skip to content

Commit

Permalink
Shorten Translation a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanTater committed Apr 2, 2014
1 parent 336e1e2 commit e2d8272
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/main/java/uncc2014watsonsim/Translation.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,27 @@
public class Translation {

public static String getIndriQuery(String question) {
String indriResultsFilter = "#filrej( portal.title #filrej( "
String query = "#filrej( portal.title #filrej( "
+ "template.title #filrej(index.title #filrej( "
+ "list.title #filrej( wikipedia.title #combine("+question+"))))))";

question = question.replaceAll("[^0-9a-zA-Z ]+", " ");
String processed = null;
processed = StringUtils.filterRelevant(question);
String words[] = processed.split(" ");
String query = indriResultsFilter;
String words[] = StringUtils.filterRelevant(question).split(" ");

for (String word : words) {
query = "#filrej(" + word + ".title " + query + " )";
query = " #filrej(" + word + ".title " + query + " )";
}
return query;
}

public static String getLuceneQuery(String question) {
String luceneResultsFilter = question + " NOT title:*\\:*" + " NOT title:list*"
String query = question + " NOT title:*\\:*" + " NOT title:list*"
+ " NOT title:index*" ;
question = question.replaceAll("[^0-9a-zA-Z ]+", " ");
String processed = null;
processed = StringUtils.filterRelevant(question);
String words[] = processed.split(" ");

String query = luceneResultsFilter;
String[] words = StringUtils.filterRelevant(question).split(" ");

for (String word : words) {
query = "NOT title:" + word + " " + query ;
query = " NOT title:" + word + " " + query ;
}
return query;
}
Expand Down

0 comments on commit e2d8272

Please sign in to comment.