Investment decision-making can be a complex process, influenced by various factors, including investor behavior preferences. Therefore, it's important to understand and capture investor sentiment for predicting future changes in the stock market trend. In this regard, machine learning algorithms can be helpful in analyzing investor sentiment in the financial market. It aims to construct a predictive model for stock indices using an LSTM network and text sentiment analysis in this paper.To begin with, a web crawler program is used to collect text comments on individual stocks in the East Money Stock Bar. The text data are analyzed using the SVM sentiment classification algorithm to construct a market sentiment index that reflects investor sentiment. Additionally, the LSTM deep learning network is used to extract the features of the market sentiment index and make short-term predictions on the SSE 50 index.Various traditional time series analysis models and machine learning models are compared. The results show that the LSTM neural network has higher accuracy and precision in financial time series prediction. After incorporating market sentiment features, the accuracy and precision of the LSTM network prediction results can be improved. This indicates that investor market sentiment is highly effective and applicable for market index prediction. It is also found that error correction of the LSTM network prediction results can effectively optimize the prediction results.Overall, a new method is provided for understanding investor sentiment and predicting future changes in the stock market trend. It is hoped that our research results can provide useful reference and guidance for financial investors and analysts.