1. A method comprising: providing a neural network model which has been trained to predict a canonical form, containing a sequence of words, for an input text sequence, containing a sequence of words, the neural network model comprising: an encoder which generates a first representation of the input text sequence based on a representation of n-grams in the text sequence, the encoder including a first neural network which reads the input text sequence and generates a second representation of the input text sequence, and a decoder which sequentially predicts a next term of the canonical form, based on the first and second representations and a predicted prefix of the canonical form, the prefix containing a sequence of at least one word; receiving an input text sequence, containing a sequence of words; with a processor, predicting a canonical form, containing a sequence of words, for the input text sequence with the trained neural network model; and outputting information based on the predicted canonical form.