Skip to content

Commit

Permalink
Revert "Majority of the test cases pass; but query variations must be…
Browse files Browse the repository at this point in the history
… applied conditionally"

This reverts commit ada6e2e.

Changes are moved to a separate branch: author-parsing
  • Loading branch information
romanchyla committed Jan 27, 2021
1 parent ada6e2e commit 4f3c5f2
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 392 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ private QueryNode expandNodes(QueryNode node, NameInfo origNameInfo, int[] level
List<QueryNode> children = node.getChildren();
boolean changed = false;
for (int i=0;i<children.size();i++) {

QueryNode n = children.get(i);
if (n.getTag(AqpAnalyzerQueryNodeProcessor.TYPE_ATTRIBUTE) == "AUTHOR_QUERY_VARIANT")
continue;
doExpansion(origNameInfo, children.get(i), collector, level);

// interlacing new values right behind the old values
Expand Down Expand Up @@ -179,8 +175,6 @@ private void doExpansion(NameInfo origNameInfo, QueryNode node, List<QueryNode>
if (nameParts.length < origNameInfo.noOfParts ) return; // do nothing

if (origNameInfo.containsOnlySurname) { // orig was lone surname
// do nothing if the input has been generated by variations
// do something if it was user input or synonym
parentChildren.add(new PrefixWildcardQueryNode(fqn.getField(), v + "*", fqn.getBegin(), fqn.getEnd()));
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public boolean incrementToken() throws IOException {

private boolean genVariations() {
String authorName = termAtt.toString();

//log.debug("generating variations for " + authorName);
HashSet<String> variations = AuthorQueryVariations.getQueryVariationsInclRegex(authorName);
if (variations.size() > 0) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.io.Reader;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -138,7 +137,7 @@ public void add(Reader in) throws IOException, ParseException {
if (seen.contains(shortForm)) continue;
seen.add(shortForm);
newBr.append(escape(shortForm) + "=>" +
escape(sides[0]) + "," +
sides[0] + "," +
buildLine(names));
newBr.append("\n");
}
Expand Down Expand Up @@ -483,8 +482,7 @@ public void add(Reader in) throws IOException, ParseException {
String[] sides = line.split("=>");
if (sides.length > 1) { // explicit mapping
String[] names = getNames(sides[1]);
Arrays.sort(names); // from shortest to longest
newBr.append(escape(sides[0]));
newBr.append(escape(names[0]));
newBr.append("=>");
boolean first = false;
for (String n: names) {
Expand All @@ -496,7 +494,6 @@ public void add(Reader in) throws IOException, ParseException {
}
else {
String[] names = getNames(sides[0]);
Arrays.sort(names); // from shortest to longest (important if we want to see synonyms before automatically generated query variants)
newBr.append(buildLine(names));
}
newBr.append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ public void setDebug(boolean v) {
tp.setDebug(v);
}

public boolean getDebug() {
return tp.getDebug();
}

/*
* This is only for printing/debugging, DO NOT use this for testing!!!
*
Expand Down
Loading

0 comments on commit 4f3c5f2

Please sign in to comment.