姚茂建 李晗靜 呂會華 姚登峰



關鍵詞: 自然語言處理; 中文分詞; 神經網絡; 雙向長短時記憶條件隨機場; 字嵌入; 序列標注
中圖分類號: TN711?34; TP391.1 ? ? ? ? ? ? ? ? ? 文獻標識碼: A ? ? ? ? ? ? ? ? ? ?文章編號: 1004?373X(2019)01?0095?05
Abstract: The mainstream Chinese word segmentation method based on supervised learning algorithm requires a lot of corpora labeled manually, and the extracted local feature has sparse problem. Therefore, a bidirectional long short?term memory conditional random field (BI_LSTM_CRF) model is proposed, which can automatically learn the text features, and model the text context dependent information. The tag information before and after sentence character is considered in CRF layer, and the text information is deduced. The word segmentation model has achieved perfect word segmentation results on datasets of MSRA, PKU and CTB 6.0, and the experiment for the model is carried out with news data, MicroBlog data, automobile forum data and restaurant review data. The experimental results show that the BI_LSTM_CRF model has high word segmentation performance in testing set, and strong generalization ability in cross?domain data testing.
Keywords: natural language processing; Chinese word segmentation; neural network; bidirectional long short?term memory random field; word embedding; sequence labeling
中文分詞是中文自然語言處理必需的過程,是進一步進行詞性標注、機器翻譯、信息檢索的基礎。分詞效果直接影響著中文自然語言任務結果的好壞,所以中文分詞具有重要意義。然而中文是一種復雜的語言,存在一詞多意、未登錄詞、語句歧義現象,只有結合上下文信息才能有效地進行分詞。近些年,中文分詞研究取得了持續發展。中文分詞常用的方法可以分為以下幾大類:基于規則和字典的方法、基于統計的方法、基于神經網絡的方法。
基于規則和字典的方法主要思想是建立一個充分大的詞典,按照一定的算法策略將待分詞的字符序列與詞典中收錄的詞條進行匹配,若在詞典中存在,則匹配成功,完成分詞[1]。但其對詞典依賴性很強,對歧義和未登錄詞識別效果不佳等問題?;诮y計的方法是基于訓練語料庫來學習任意字符相鄰出現的概率,得到分詞模型,通過計算字符序列切分最大概率作為分詞結果[2]。該方法需要人工定義和提取特征,其性能也受到訓練語料、特征設定的影響,存在特征過多、模型復雜、容易過擬合的問題。隨著深度學習的快速發展,近年來神經網絡算法被廣泛用于自然語言處理任務中。由于神經網絡可以從原始數據中自主學習特征,不僅替代了人工提取特征的工作量,同時也避免了人為特征設定的局限性。
為了提高中文分詞的性能,應用BI_LSTM_CRF神經網絡處理中文分詞任務,使用BI_LSTM_CRF網絡構造更具表征的字符信息,本文系統性地比較了4字詞位標注與6字詞位標注方法在測試集上的測試結果,實驗結果表明采用6字詞位標注的方法能更好地表征詞語中的詞位信息,并且性能更加優越。使用6字詞位標注方法的神經網絡分詞模型分別在新聞數據、微博數據、汽車論壇數據、餐飲點評數據進行了測試,實驗結果顯示,BI_LSTM_CRF神經網絡分詞模型在跨領域數據測試上也有很好的泛化能力。
長短時記憶(Long Short?term Memory,LSTM)網絡是遞歸神經網絡(Recurrent Neural Network,RNN)的一種變種,在很多任務上表現的比RNN更好,可以學習長期依賴信息。1997年,Schuster等人在LSTM網絡模型基礎上提出了雙向長短時記憶(Bidirectional Recurrent Neural Networks,BI_RNN)模型,由于是雙向輸入,在記憶長時信息方面比LSTM更具有優勢。以上述神經網絡為基礎的模型在處理與時間相關的序列任務中取得了很大的成功,通常模型都能對長短時依賴信息進行表達。
文獻[3]對神經網絡建立概率語言模型,該方法對n?gram模型有顯著的改進,并且利用了較長的上下文信息。文獻[4]使用神經網絡結構處理中文自然語言任務,描述了一種感知器訓練神經網絡的替代算法,以加速整個訓練過程。文獻[5]將LSTM網絡模型應用于中文分詞中,以解決上下文長距離依賴關系,并取得了不錯的分詞效果。2016年,Yao等人提出采用BI_LSTM網絡模型處理中文分詞,該模型將過去和未來上下文中文信息都考慮進去,中文分詞效果得到了提高。2017年,李雪蓮等針對LSTM神經網絡模型復雜、訓練時間長等問題,提出基于GRU(Gate Recurrent Unit)模型,使得模型訓練更加簡化并且取得了與LSTM模型相當的分詞效果。





本文主要研究了BI_LSTM_CRF神經網絡來實現中文分詞,實驗中不僅使用MSRA,PKU,CTB 6.0數據集做了測試,比較了4詞位標注與6詞位標注模型的表現性能,實驗結果顯示6詞位標注模型表現出了更好的分詞性能。同時,采用6詞位標注的模型對新聞數據、微博數據、汽車論壇數據、餐飲點評數據不同領域進行了測試,結果表明6詞位標注的模型在跨領域中文分詞也具有良好的性能,說明模型具有很好的泛化能力。
注:本文通訊作者為李晗靜。
參考文獻
[1] WU A. Word segmentation in sentence analysis [C]// Procee?dings of 1998 International Conference on Chinese Information Processing. Beijing: Chinese Information Society, 1998: 1?10.
[2] LAFFERTY J D, MCCALLUM A, PEREIRA F C N. Conditional random fields: probabilistic models for segmenting and labeling sequence data [C]// Proceedings of the Eighteenth International Conference on Machine Learning. San Francisco: Morgan Kaufmann Publishers Inc., 2001: 282?289.
[3] BENGIO Y, VINCENT P, JANVIN C. A neural probabilistic language model [J]. Journal of machine learning research, 2003, 3(6): 1137?1155.
[4] ZHENG X, CHEN H, XU T. Deep learning for Chinese word segmentation and POS tagging [C]// 2013 Conference on Empirical Methods in Natural Language Processing. Seattle: Association for Computational Linguistics, 2013: 647?657.
[5] CHEN X, QIU X, ZHU C, et al. Long short?term memory neural networks for Chinese word segmentation [C]// 2015 Confe?rence on Empirical Methods in Natural Language Processing. [S.l.: s.n.], 2015: 1197?1206.
[6] GRAVES A. Long short?term memory [M]// Anon. Supervised sequence labelling with recurrent neural networks. Berlin: Springer, 2012: 37?45.
[7] ZHAO H, HUANG C N, LI M, et al. An improved Chinese word segmentation system with conditional random field [C]// Proceedings of the Fifth Sighan Workshop on Chinese Language Processing. [S.l.: s.n.], 2006: 162?165.
[8] MIKOLOV T, CHEN K, CORRADO G, et al. Efficient estimation of word representations in vector space [EB/OL]. [2013?09?07]. http://www.surdeanu.info/mihai/teaching/ista555?spring15/readings/mikolov2013.pdf.
[9] LAI S, LIU K, HE S, et al. How to generate a good word embedding [J]. IEEE intelligent systems, 2016, 31(6): 5?14.
[10] YAO Y, HUANG Z. Bi?directional LSTM recurrent neural network for Chinese word segmentation [C]// 2016 International Conference on Neural Information Processing. Berlin: Springer, 2016: 345?353.
[11] STRUBELL E, VERGA P, BELANGER D, et al. Fast and accurate entity recognition with iterated dilated convolutions [C]// Proceedings of 2017 Conference on Empirical Methods in Natural Language Processing. [S.l.: s.n.], 2017: 2664?2669.