5. The method of claim 1 , wherein the score that an n-gram corresponds to a node is based on the identified edges connected to the node.
1. A method comprising, by one or more computing devices: receiving from a first user of an online social network an unstructured text query, the online social network being associated with a social graph comprising a plurality of nodes and a plurality of edges connecting the nodes; parsing the text query to identify one or more n-grams; determining a score for each n-gram that the n-gram corresponds to an edge or a node, wherein the score for each n-gram is a probability that the n-gram corresponds to an edge or a node; identifying one or more edges and one or more nodes based on their scores, each identified node and identified edge corresponding to at least one of the n-grams, each of the identified nodes being connected to at least one of the identified edges; and generating one or more structured queries that each comprise references to one or more of the identified edges and one or more of the identified nodes.