GQuery query = queryIterator.next();
System.err.println(query.getTitle());
String queryText = query.getText();
// stupid hack. need to lowercase the query vector
FeatureVector temp = new FeatureVector(null);
Iterator<String> qTerms = query.getFeatureVector().iterator();
while(qTerms.hasNext()) {
String term = qTerms.next();
temp.addTerm(term.toLowerCase(), query.getFeatureVector().getFeaturetWeight(term));
}
temp.normalizeToOne();
query.setFeatureVector(temp);
// if we're doing feedback
if(fbDocs > 0 && fbTerms > 0) {
List<TResult> results = client.search(queryText, query.getQuerytweettime(), fbDocs);
FeedbackRelevanceModel fb = new FeedbackRelevanceModel();
fb.setOriginalQuery(query);
fb.setRes(results);
fb.build(stopper);
FeatureVector fbVector = fb.asFeatureVector();
fbVector.pruneToSize(fbTerms);
fbVector.normalizeToOne();
fbVector = FeatureVector.interpolate(query.getFeatureVector(), fbVector, ORIG_QUERY_WEIGHT);
System.err.println(fbVector);
StringBuilder builder = new StringBuilder();
Iterator<String> terms = fbVector.iterator();
while(terms.hasNext()) {
String term = terms.next();
if(term.length() < 2)
continue;
double prob = fbVector.getFeaturetWeight(term);
builder.append(term + "^" + prob + " ");
}
queryText = builder.toString().trim();
}