Query Generation
I previously pointed out that the first step of generating the query from a question is possibly the most important step. There are five different components in a generated query:
- Unigrams (single words).
- Bigrams (two-word phrases).
- Expected entities based on the question word.
- Expected entity based on the first noun or verb of the question.
- The query transformation.
For example, the question "Who is the Prime Minister of Britain?" has the following unigrams and bigrams"Prime," "Minister," "Britain," "Prime Minister," "the Prime," "Minister of," and "of Britain." The expected entity based on the question word is a person, and the entity from the first noun is a head of state or representative. The transformations are phrases like "responsible for" and "eligible to."
The Lucene search engine (lucene.apache.org) allows for boosts of specific keywords in a query. In a general search engine query, users assign equal importance to all keywords. In some search engines, the order of keywords may affect the results. Keywords earlier in the query may be given higher importance than later keywords. In Lucene, this can be codified by assigning boosts for individual keywords.
Some components of the query may have a higher weight than others since they are better discriminators. The weights of unigrams and bigrams are usually higher than the weight of entities in most question types. This is expected since the unigrams and bigrams are specific terms, while the entities are general indicators of what is expected in an answer. Similarly, the transformation also has a lower weight than the specific components of the query.
Each question type is assigned a set of weights for the five components of the generated query. The weights are computed from a training set of questions and answers. An initial set of weights is assigned and a hill-climbing algorithm searches for an optimized set of weights for all training questions belonging to a particular question type.
The bag-of-words approach for query generation uses just the set of unigrams and bigrams alone to find answers. This approach finds an answer roughly 40 percent of the time. Adding entities and query transformation can increase the accuracy rate to 60 percent or higher.