1. A method performed by one or more computers, the method comprising: accessing data indicating a set of classes that each represent a different level of specificity of a same, particular semantic concept, wherein the classes respectively correspond to different types of words or phrases, and each class includes multiple words or phrases of the corresponding type for the class; identifying a language sequence including a particular word or phrase that corresponds to the particular semantic concept; generating a first modified language sequence by replacing the particular word or phrase with a symbol representing the first class; generating a second modified language sequence by replacing the particular word or phrase with a symbol representing at least one the second classes; generating a first language model in which a single first class from the set of classes represents the particular semantic concept, the first language model being trained using the first modified language sequence; generating a second language model in which multiple second classes from the set of classes represent the particular semantic concept at a greater level of specificity than the first class, each of the second classes being different from the first class, the second language model being trained using the second modified language sequence; and selecting the first class or the multiple second classes based on output of the first language model and output of the second language model.