1. A non-transitory computer-readable medium storing instructions executable by one or more computers which, upon such execution, cause the one or more computers to perform operations comprising: receiving, at a server, a query identifying one or more attributes of an entity; accessing, at the server, a set of candidate templates for answering the query based on the one or more attributes of the entity, each candidate template having one or more fields, wherein each field is associated with at least one constraint; obtaining, at the server, a set of information that answers the query; selecting, at the server and from among the set of candidate templates, a template from which to generate a phrase that comprises an answer to the query, the selected template selected based on a determination that the selected template has a maximum number of fields with constraints that are satisfied by the set of information, in that no other template in the set of candidate templates has more fields with constraints that are satisfied by the set of information than the maximum number of fields of the selected template; generating, at the server, the phrase by adding the set of information to the one or more fields of the selected template, such that the phrase comprises an answer to the query; and communicating, from the server, the phrase to a client device.
1. A non-transitory computer-readable medium storing instructions executable by one or more computers which, upon such execution, cause the one or more computers to perform operations comprising: receiving, at a server, a query identifying one or more attributes of an entity; accessing, at the server, a set of candidate templates for answering the query based on the one or more attributes of the entity, each candidate template having one or more fields, wherein each field is associated with at least one constraint; obtaining, at the server, a set of information that answers the query; selecting, at the server and from among the set of candidate templates, a template from which to generate a phrase that comprises an answer to the query, the selected template selected based on a determination that the selected template has a maximum number of fields with constraints that are satisfied by the set of information, in that no other template in the set of candidate templates has more fields with constraints that are satisfied by the set of information than the maximum number of fields of the selected template; generating, at the server, the phrase by adding the set of information to the one or more fields of the selected template, such that the phrase comprises an answer to the query; and communicating, from the server, the phrase to a client device. 2. The computer-readable medium of claim 1 , wherein the at least one constraint comprises one or more of a type constraint, a temporal constraint, a gender constraint, a relationship constraint, a singular/plural constraint, a unit of measure constraint, and a determinant constraint.