<p>A solution that is slightly less off the shelf, but probably hard to beat in terms of accuracy if you have a specific thing you're trying to do:</p>

<p>Build an RNN (with LSTM or GRU memory cells, <a href="http://arxiv.org/pdf/1412.3555.pdf" rel="noreferrer">comparison here</a>) and optimize the error function of the actual task you're trying to accomplish. You feed it your sentence, and train it to produce the output you want. The activations of the network after being fed your sentence is a representation of the sentence (although you might only care about the networks output). </p>

<p>You can represent the sentence as a sequence of one-hot encoded characters, as a sequence of one-hot encoded words, or as a sequence of word vectors (e.g. <a href="http://nlp.stanford.edu/projects/glove/" rel="noreferrer">GloVe</a> or <a href="https://code.google.com/p/word2vec/" rel="noreferrer">word2vec</a>). If you use word vectors, you can keep backpropagating into the word vectors, updating their weights, so you also get custom word vectors tweaked specifically for the task you're doing. </p>
How can a sentence or a document be converted to a vector?
<p>We have models for converting words to vectors (for example the word2vec model). Do similar models exist which convert sentences/documents into vectors, using perhaps the vectors learnt for the individual words?</p>