3. 序列标注问题
• 问题:给定一个文本序列,如何识别出每个词语是何种标记
• 例如:从 乐视 大厦 出发 怎么 坐 公交车 去 天安门 ?
• 出发地 交通方式 目的地
• De la musique, comme le bâtiment comment prendre un bus à la
place Tiananmen? (谷歌翻译)
• 方法:HMM、CRF、seq2seq模型(RNN、LSTM、LSTM-CRF)等
• 模型f: 观测序列X -> 标记序列(状态序列) Y P(Y|X)
9. 举例: POS-tagging
形容词以“的”字结尾
句首是动词,句末是问号
形容词后面跟着名词
连续两个词是人名
λ1=3
λ2=1
λ3=5
λ4=-2
• s: 红红的_太阳_高高照
• l: 形容词_名词_动词 vs 形容词_形容词_名词
Tag: 形容词、动词、名词、人名、其他
1 0 2 1 3 2
1
1 1 1 0 1 1 2 1 1 1 3 2
2 2 1 0 2 2 2 1 2 2 3 2
( | 1) ( ( ,1, , ) ( ,2, , ) ( ,3, , ))
( ,1, , ) ( ,2, , ) ( ,3, , )
+ ( ,1, , ) ( ,2, , ) ( ,3, ,
m
j j j j j j
j
score l s f s l l f s l l f s l l
f s l l f s l l f s l l
f s l l f s l l f s l l
3 3 1 0 3 3 2 1 3 3 3 2
4 4 1 0 4 4 2 1 4 4 3 2
)
+ ( ,1, , ) ( ,2, , ) ( ,3, , )
+ ( ,1, , ) ( ,2, , ) ( ,3, , )
f s l l f s l l f s l l
f s l l f s l l f s l l
10. 举例: POS-tagging
• s: 红红的_太阳_高高照
• l: 形容词_名词_动词 vs 形容词_形容词_名词
Tag: 形容词、动词、名词、人名、其他
1 0 2 1 3 2
1
1 1 1 0 1 1 2 1 1 1 3 2
2 2 1 0 2 2 2 1 2 2 3 2
( | 1) ( ( ,1, , ) ( ,2, , ) ( ,3, , ))
( ,1, , ) ( ,2, , ) ( ,3, , )
+ ( ,1, , ) ( ,2, , ) ( ,3, ,
m
j j j j j j
j
score l s f s l l f s l l f s l l
f s l l f s l l f s l l
f s l l f s l l f s l l
3 3 1 0 3 3 2 1 3 3 3 2
4 4 1 0 4 4 2 1 4 4 3 2
)
+ ( ,1, , ) ( ,2, , ) ( ,3, , )
+ ( ,1, , ) ( ,2, , ) ( ,3, , )
f s l l f s l l f s l l
f s l l f s l l f s l l
1 1 0 1 2 1 1 3 2 3 2 1 3 3 2( ,1, , ) ( ,2, , ) ( ,3, , ) ( ,2, , ) ( ,3, , )
1 1 0 0 1 0
2 1 0 0 0 1
f s l l f s l l f s l l f s l l f s l l
l
l
形容词以“的”字结尾
形容词后面跟着名词
λ1=3
λ3=5
26. 参考资料
• [1] Huang, Z., Xu, W., & Yu, K. (2015). Bidirectional LSTM-CRF models
for sequence tagging. arXiv preprint arXiv:1508.01991.
• [2] Graves, A., Jaitly, N., & Mohamed, A. R. (2013, December). Hybrid
speech recognition with deep bidirectional LSTM. In Automatic
Speech Recognition and Understanding (ASRU), 2013 IEEE Workshop
on (pp. 273-278). IEEE.
• [3] CRF++工具:https://taku910.github.io/crfpp/
• [4] Zhou, J., & Xu, W. (2015). End-to-end learning of semantic role
labeling using recurrent neural networks. In ACL (1) (pp. 1127-1137).