Terrier Users :  Terrier Forum terrier.org
General discussion about using/developing applications using Terrier 
Terrier Query Expansion Terms
Posted by: Jeremy ()
Date: September 10, 2017 01:41PM

I was wondering whether it is possible in terrier to receive the list of terms used for query expansion. Some context: Doing a paper for political science and need to identify commonly linked words for further analysis. I was hoping that the additional terms that Terrier identifies may be accessible somewhere.

Example. If term searching for is 'cat' and with query expansion 'mat' and 'sat' were included as well, I want to know what those terms used are as opposed to happening in background.

Any help would be very appreciated

Options: ReplyQuote
Re: Terrier Query Expansion Terms
Posted by: Nader ()
Date: September 12, 2017 08:29PM

Let me see if I got your question right: you want a way to tell that the expansion terms "mat" and "sat" were chosen because of the query term "cat" ?

Options: ReplyQuote
Re: Terrier Query Expansion Terms
Posted by: Jeremy ()
Date: September 14, 2017 11:33AM

Yep. That's exactly what I'm trying to find out.

Options: ReplyQuote
Re: Terrier Query Expansion Terms
Posted by: Jeremy ()
Date: September 14, 2017 11:45AM

Ironically just after I posted my reply I had a brainwave and believe i have found a solution. I sort of plugged this java into the 'webapp' version of terrier so probably need to do a clean version of terier on Java to make a better solution but below are the relevent lines of code

Manager queryingManager = (Manager)application.getAttribute("terrier.jsp.manager"winking smiley;
SearchRequest srq = queryingManager.newSearchRequest("results.jsp.query", query);
srq.setOriginalQuery(query);
srq.setControl("start", sStart);
srq.setControl("decorate", "on"winking smiley;
srq.setControl("qe", "on"winking smiley;

srq.setControl("end", String.valueOf(iStart + NUM_RESULTS_PER_PAGE -1));
srq.addMatchingModel(defaultMatching, defaultModel);
queryingManager.runPreProcessing(srq);
queryingManager.runMatching(srq);
queryingManager.runPostProcessing(srq);
queryingManager.runPostFilters(srq);
ResultSet rs = srq.getResultSet();
QueryExpansion qexpan = new QueryExpansion();
qexpan.process(queryingManager, srq);
out.print(qexpan.lastExpandedQuery);

Its far from the best solution I imagine and sends it out in a string with a few numbers however should be a guide to anyone attempting a similar thing. Also not 100% sure its giving the right answers at the moment but they look pretty good

Edit:
Unfortunately it looks like the site has converted ' ) : ' (remove the space) at the end of my code lines as emojis. Not sure how to add 'just code' into my comments but hopefully people trying to replicate can work it out :p



Edited 1 time(s). Last edit at 09/14/2017 11:47AM by Jeremy.

Options: ReplyQuote


Sorry, only registered users may post in this forum.
This forum powered by Phorum.