# A Data-Driven Approach for University Public Opinion Analysis and Its Applications
## 3 Model Construction
### Chinese Word Segmentation  
English uses separators to segment words, whereas Chinese sentences are written in a continuous manner without separators between words, so different segmentation methods result in different meanings for a sentence. Consequently, incorrect segmentation combinations result in misunderstanding of the original sentence and affect the accuracy of sentiment analysis. Therefore, the key to Chinese word segmentation is reasonably slicing the strings so as to correctly identify words. From a technical perspective, the Chinese word segmentation task can be regarded as a character-based sequence-labelling problem, whereby each character is labelled as one of four categories: beginning (B), middle (M), end (E) or single segmentation (S). Conventional Chinese word segmentation methods include lexicon-based segmentation methods (e.g., maximum matching method) and word-frequency-based segmentation methods (e.g., \(n\)-gram, MaxEnt, CRF, etc. ); however, the effect of the former is easily affected by the quality of the lexicon, and the implementation of the latter requires a high computational payload. In recent years, neural-network-based word segmentation methods have been widely applied and achieved positive results. In this study, a long short-term memory network-based Chinese word segmentation model is designed, as illustrated in Figure 3. Considering that the concept of words only applies after word segmentation, a character vector is obtained by the Word2 Vec tool, as described in the Section 3.4. For a given text sequence (\(c^{(1:n)}\)) of length \(n\), a window of size \(k\) is slid from the first character (\(c^{(1)}\)) to the last character (\(c^{(n)}\)) (\(k=3\) is demonstrated in \begin{table}
\begin{tabular}{c c} \hline \hline
**Part of Speech** & **Examples** \\ \hline Preposition & \\ Interjection & \\ Conjunction & \\ Adjunct Word & \\ Pronoun & \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Examples of stopping words. \begin{table}
\begin{tabular}{c c} \hline \hline
**Content** & **Regular Expression** \\ \hline URL link & ((https! http! ftp! r step! mms)? :W) [\^{}\$]+ \\ HTML label & \textless{}/? \$+\$’]\textless{}>> \\ Non-Chinese characters & \textless{}\textless{}\textbackslash  
Figure 3). Then, the vector (\(c^{(t-1)}\), \(c^{(t)}\), \(c^{(t+1)}\)) is input to the Word2 Vec model to obtain the numerical word vectors as the input for the hidden layer. The hidden layer uses a long short-term memory network to extract the features of the input data. In comparison with the RNN model, the LSTM model can better capture the long-term dependencies among sequence elements and achieves better training results [27]. The LSTM unit consists of an input gate, a forget gate and an output gate. The mathematical updating process is shown in Equations (1)-(6) [27], where \(i_{t},f_{t}\) and \(o_{t}\) are the input gate, forget gate and output gate, respectively; and \(\sigma(\cdot)\) represents the sigmoid function. \[i_{t}=\sigma(\mathbf{W}_{i}[\mathbf{h}_{t-1},\mathbf{x}_{t}]+b_{i}) \tag{1}\]  
\[\widetilde{C}_{t}=\tanh(\mathbf{W}_{c}[\mathbf{h}_{t-1},\mathbf{x}_{t}]+b_{c}) \tag{2}\]  
\[f_{t}=\sigma\left(\mathbf{W}_{f}[\mathbf{h}_{t-1},\mathbf{x}_{t}]+b_{f}\right) \tag{3}\]  
\[C_{t}=f_{t}\circ C_{t-1}+i_{t}\circ\widetilde{C}_{t-1} \tag{4}\]  
\[o_{t}=\sigma(\mathbf{W}_{o}[\mathbf{h}_{t-1},\mathbf{x}_{t}]+b_{o}) \tag{5}\]  
\[h_{t}=o_{t}\circ\tanh(C_{t}) \tag{6}\]  
The features extracted from the LSTM layer are input to the CRF layer for four-tag labelling. In the CRF layer, the input sequence is first scored according to Equation (7), where \(y_{i}\) represents the label value, \(h_{i}\) represents the sequence output value of the LSTM network and matrix \(\mathbf{A}\) is the model parameter. \[S(X,y,\theta)=\sum_{i}^{N}A_{y_{i},y_{i+1}}+\sum_{i}^{N}h_{i,y_{i}} \tag{7}\]  
Figure 3: Chinese word segmentation architecture. Then, the CRF layer defines chained conditional probabilities to normalize the output scores, as shown in Equation (8).