NER(Named entity recognition)命名实体识别是一种序列标注问题, 输入一个句子,输出一个标注的序列。
标注的种类有: - Person (PER) (He or she are not considered named entities.) - Organization (ORG) - Location (LOC) - Miscellaneous (MISC) (杂项) - O(不是命名实体)
标注的评价指标: 对于非空的标注,计算Recall, Precision, F1-score(如果直接计算全体标注正确率,会因为O比较多造成较大干扰)。
另外有entity-level评价指标: 也就是说计算entitiy的Recall, Precision和F1-score的值,那么只有在一个词组全部标注对的时候,才算标注正确了这个entity。
更全面的刻画是confusion matrix,例如:
gold/guessPERORGLOCMISCOPER297359411462ORG15216489462136LOC5710418682540MISC4758451012106O4649123342619最简单的思路是根据window里的x直接通过一个神经网络来预测。
以下为一些问题和解答:
Q: Provide 2 examples of sentences containing a named entity with an ambiguous type A: 这个问题只是举例子,比较简单,这个问题说明命名实体识别存在歧义,答案给的句子是:
“Spokesperson for Levis, Bill Murray, said … “, where it is ambiguous whether Levis is a person or an organization. “Heartbreak is a new virus,” where Heartbreak could either be a MISC named entity (it’s actually the name of a virus), or simply a noun.
Q: Why might it be important to use features apart from the word itself to predict named entity labels? A: 因为很多时候有些普通名词可能是一个组织,很多时候人名也可能是组织,所以说,单凭单个单词没有办法获得全部信息,需要结合周围语境综合判断,这就是window的出发点。
Q: Describe at least two features (apart from the word) that would help in predicting whether a word is part of a named entity or not. A: 例如单词的大小写情况,以及词性,前后缀之类的。
比较简单,略。
代码实现略,另外如果在IDE中,注意设置命令行参数。 分析的结果是给出混淆矩阵,ORG容易被误识成PER。
RNN, GRU模型应用于序列标注问题比较常见了,下面是几个注意点。
因为F1-score涉及整语料,而且是离散的不可导,所以F1-score没法直接作为损失函数而采用交叉熵损失函数。
课件里有涉及到。
assignment里涉及了GRU模拟自动机的习题,主要是不等式操作,比较简单。这给了一个预训练的思路,先给出大致的自动机模型,预训练参数按照不等式随即设置。