Previous studies have shown that changes in human emotions or public opinions can have an impact on volatility of stock market. In this paper, we make use of the unstructured comments data from the stock forum on the Shanghai Composite Index to generate the structural emotion time series of the stock market based on a series of methods including word segmentation, feature extraction, machine learning and modeling techniques. Then, we analyze the relationship between the stock price changes and the emotional index. From the results, it can be seen that stock emotional index has strong interaction with volatility of stock market. Therefore, the emotion index changes may be used as a tool for future stock market trend prediction.