Text data has not only the characteristics of high dimension and serialization, but also most of the data are not labeled. This makes it difficult for the traditional method to achieve good results only relying on the training class mark to solve the problem of text classification. Later, some people put forward the method of metric learning to solve the problem of text classification. Its principle is to learn the measurement distance function for a specific task according to different tasks, that is to say, samples are classified by “distance measurement”. The triplet network used in this paper is an algorithm based on “distance measurement”. By optimizing the original triplet network, we can learn a non-linear measurement space with stronger data representation ability, so as to achieve better results than the traditional metric learning. Finally, we analyze the performance and efficiency of the method on IMDB movie review data set, and prove the superiority of the method for text classification.