1. A method comprising, by a computing device: receiving, from a client device of a first user, a text string comprising one or more characters inputted by the first user; generating a set of suggested queries based on the text string, each suggested query in the set being based on a string generated by a grammar of a grammar model and comprising the text string of the query and one or more tokens inserted by the grammar model corresponding to one or more terms, respectively; calculating, for each suggested query in the set, a quality score based on an insertion cost of the one or more tokens of the suggested query inserted by the grammar model; filtering the set to remove one or more suggested queries from the set based on the respective quality scores of the suggested queries; and sending, to the client device, one or more of the suggested queries from the post-filtered set for presentation to the first user.
1. A method comprising, by a computing device: receiving, from a client device of a first user, a text string comprising one or more characters inputted by the first user; generating a set of suggested queries based on the text string, each suggested query in the set being based on a string generated by a grammar of a grammar model and comprising the text string of the query and one or more tokens inserted by the grammar model corresponding to one or more terms, respectively; calculating, for each suggested query in the set, a quality score based on an insertion cost of the one or more tokens of the suggested query inserted by the grammar model; filtering the set to remove one or more suggested queries from the set based on the respective quality scores of the suggested queries; and sending, to the client device, one or more of the suggested queries from the post-filtered set for presentation to the first user. 2. The method of claim 1 , further comprising: receiving, from the client device, a selection of one of the sent suggested queries; and generating one or more search results responsive to the selected suggested query, the one or more search results corresponding to one or more objects associated with the online social network, respectively, each object matching the one or more tokens of the selected suggested query.