There are some problems in the field of text clustering and particle swarm optimization (PSO) technology, for example, the researchers need to determine the appropriate number of clusters before clustering, the clustering results are sensitive to the initial cluster center, and the PSO algorithm has precocious convergence and easy to fall into local optimality defects. We propose a dynamic topology adaptive PSO (DTA-PSO) algorithm that combines the K-means algorithm PSO to realize automatic text clustering. In DTA-PSO, we adopt an improved comprehensive dynamic learning strategy from social group experience the source of the social experience of the particle group is not only the particle with the best performance among all its neighbors, according to the performance of all its neighbors and the relative position with the particle, the target position is calculated in the next iteration. We choose three data sets in the knowledge base of the machine learning open data set and part of the Chinese corpus of Fudan University. Many experiments are carried out on the automatic cluster of DTA-PSO, the text automatic clustering algorithm has a certain improvement on the K value determination and the clustering effect by the contrast analysis.