Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I assume this type of question is more on-topic here than on regular SO.

I have been working on a search feature for my team's web application and have had a lot of success building a multithreaded, "divide and conquer" processing system to work through a large amount of fulltext.

Our problem domain is pretty specific. Users of the app generate posts, and as a general rule, posts that are more recent are considered to be of greater relevance. Some of the data we are trying to extract from search is very specific (user's feelings about specific items or things) and we are using python nltk to do named-entity extraction to find interesting likely query terms. Essentially we look for descriptive adjective-noun pairs and generate a general picture of a user's expressed sentiment as a list of tokens. This search is intended as an internal tool for our team to draw out a local picture of sentiments like "soggy pizza." There's some machine learning in there too to do entity resolution on terms like "soggy" to all manner of adjectives expressing nastiness.

My problem is I am at a loss for how to go about scoring these results. The text being searched is split up into tokens in a list, so my initial approach would be to normalize a float score between 0.0-1.0 generated off of how far into the list the terms appear and how often they are repeated (a later mention of the term being worth less, earlier more, greater frequency->greater score, etc.) A certain amount of weight could be given to the timestamp as well, though I am not certain how to calculate this.

I am curious if anyone has had to solve a similar problem in a search relevance grading between appreciable metrics (frequency, term location/colocation, recency) and if there are and guidelines for how to weight each.

I should mention as well that the final fallback procedure in the search is to pipe the query to Sphinx, which has its own scoring practices. Sphinx operates as the last resort in case our application specific processing can't find any eligible candidates.

share|improve this question
This isn't really a programming decision, although the programmers may be involved. Does the business not have their own ideas? – pdr Oct 26 '12 at 16:44
@pdr The unfortunate truth is that we are a small startup, and as the lead server-side dev I am co-opted into making these decisions despite the fact that under ideal circumstances they would be better left to a data scientist of some sort. They give me the rough "abstract" (using the term kindly) of what type of data should be extracted via query and I chart the best possible course I can think of with the tools available (hence the emphasis we have on nltk, given the descriptive pairs goal.) Perhaps you've had similar situations and can sympathize? :) – DeaconDesperado Oct 26 '12 at 16:55
I have had similar experiences, I do sympathise, and it's my experience that these things end only in tears. I would suggest picking something REALLY simple. Cause whatever you do, it'll be wrong when the business sees it. Nonetheless, voted to close this question, cause I think it's off-topic. – pdr Oct 26 '12 at 17:02

closed as off topic by pdr, MainMa, GlenH7, Walter, BЈовић Oct 29 '12 at 10:10

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.