As a huge knowledge network diagram, the knowledge graph contains entity concepts, relationships, and other information. Although the semantic representation based on deep learning has strong generalization, it is not sensitive to some proprietary knowledge, so many researchers try to combine knowledge graphs with neural network. At present, most of the methods of semantic representation of knowledge graphs are based on general domain knowledge graphs, and there is no research on the semantic representation of knowledge graphs in the academic field. In this paper, the full-text data of academic literature is taken as the research object, and the semantic representation method based on an academic knowledge graphs is studied. On the basis of constructing academic knowledge graph, the research method of the general field (K-BERT) is improved (KEBERT), and entity knowledge is further used to enhance the semantic information of the text. By conducting comparative experiments on downstream tasks, the performance of KEBERT, K-BERT, and ERNIE is verified on academic retrieval datasets. The experiment uses the NDCG evaluation index commonly used in the retrieval task to evaluate the results. The experimental results show that the improved KEBERT is superior to other models in the retrieval task.
4)Transformer层.从某种程度上说,可视矩阵 M 中包含了句子树的结构信息,为了利用这些信息,避免插入的知识对原始句子的语义造成负面影响,本文对Transformer结构进行了调整,使其能够根据矩阵 M 来限制自注意力机制的可见区域.Mask-Transformer由多个mask-self-attention堆叠而成,与BERT结构一样,其层数为L,隐藏层输出的大小为H,mask-self-attention的头数量为A.mask-self-attention的自注意力计算过程如式(2)~式(4).
式中:Wq、Wk、Wv 是可训练参数;hi 是第i个mask-self-attention块的隐藏状态, M 是可视层输出的可视矩阵.
2.2.2 KEBERT模型结构
基于K-BERT方法,本研究针对学术知识图谱数据的特点对上述方法进行了改进,改进后称为KEBERT,具体流程示意如图4所示.改进后的方法主要有四个模块.在输入层将学术文本句子作为输入,抽取出其中的学术实体并进行实体链接.以“support vector machine model uses Twitter data for classification”句子为例,通过实体链接将句子中的“support vector machine”和“Twitter”实体抽取出来并链接到学术知识图谱中,检索到与之相关的三元组.与原始的K-BERT的不同,本文的KEBERT在进行处理时,将句子中的实体作为一个整体进行操作.在知识层,将链接的三元组和原始的学术句子进行组合构造一个句子树.将知识层输出的句子树作为嵌入层的输入进行嵌入表示.嵌入表示主要有三个部分:token embedding、soft position embedding和segment embedding.相比于原始的K-BERT模型在进行嵌入表示时将句子中的每个单词都转化为一个单独的token来进行表示,本文在KEBERT模型中将同一个实体的单词作为一个整体转化为一个token进行表示,在后续的掩码过程中也可以对整个实体同时进行掩码,保留了实体信息的完整性,使模型能够更完整地学习知识图谱中的三元组知识.soft position embedding和segment embedding的表示方法保持不变.在可视层,由于在学术文献中,每个句子都可能包含多个实体.因此可能出现大量的三元组被链接到句子中,但是在这些三元组中只有一部分是对句子的语义理解有效的三元组.因此如果将全部的三元组和句子一起通过自注意力机制,就会使模型对原本的语义理解出现偏差,导致知识噪声问题的出现.因此在可视层中依旧延续前文中的方法,Transformer层也与前文中的处理方法保持一致.
绿色节点为文献节点,粉色节点代表数据源节点,蓝色节点代表具体模型,黄色节点代表软件工具.绿色文献节点在知识图谱中为中心节点,各个文献的周围有多个子节点,不同颜色的子节点代表不同的实体.多篇文献通过相同的子节点互相连接,这个使文献之间互相连接的子节点包括数据源、具体模型、软件工具.搜索某数据源,查看该对象所有的相关文献.以数据源“Web of Science”为例,查询语句为:MATCH q=()-[]->(n:Datasource {entity: "Web of Science"}) RETURN q.查询后的可视化结果如 图7左图所示,可以看出,与“Web of Science”存在关系的有大约20个相关文献,说明这些文献在研究过程中均使用了Web of Science数据.搜索某软件工具,查看该对象所有的相关文献.以软件工具“SPSS”为例,查询语句为:MATCH q=()-[]->(n:Software {entity:"SPSS"}) RETURN q.查询后的可视化结果如图7右图所示,可以看出,与“SPSS”存在关系的有大约7个相关文献,说明这些文献在研究过程中均使用了SPSS软件.
3.3 三元组处理与实体链接
本实验中主要使用的实体类型有软件工具、模型、数据源以及对应的实体关系,因此需要对上述知识图谱数据进行预处理,将(头实体-关系-尾实体)转化为相应的文本表示,尤其是实体关系需要表示为相应的文本.以(模型-关系-文献)三元组为例,经过处理将其表示为(模型-a tool used by-文献),以便在后续的嵌入表示过程中得到更准确的语义表示. 预处理后的数据示例如图8所示,头实体-关系-尾实体之间采用制表符分隔.
在实验过程中需要通过实体链接对输入的检索词和文档进行句子树构建,以检索词“tf-idf similarity”为例,通过实体链接技术在知识图谱中查询到与当前检索词相关的三元组“TF‐IDF-a tool used by-A survey on tag recommendation methods”和“TF-IDF-a tool used by-Indexing biomedical documents with a possibilistic network”,因此可以将检索词的树结构设计为如图9所示的样式.
3.4 检索实验设计与结果分析
为了验证本文提出的知识图谱增强的语义表示方法的有效性,本文在检索任务上进行了初步验证.并且实验采用NDCG@k值作为评价指标,对检索结果进行评价与分析.本实验中具体实验细节如图10所示.首先本文将检索词和文档用[SEP]进行拼接,输入样例如下:“[CLS] One Sentence containing entity knowledge in JASIST [SEP] One Query in Google [SEP].”其中[CLS]表示包含实体知识句子的开头,第一个SEP表示包含实体知识句子与Google检索词的分隔符,第二个表示Google检索词的结束符.然后通过知识层,链接知识图谱中的三元组,对检索词和文档进行句子树扩展,然后将扩展后的句子树输入向量层进行表示,得到向量表示和对应的可视化矩阵,随后输入Mask-Transformer层,随后接入一个池化层构建文档与检索词之间的语义表示,并将此语义表示输入回归层,计算包含实体知识的文档与检索词之间的语义相关度.
LIY Z, YUB W, XUEM G,et al .Enhancing pre-trained Chinese character representation with word-aligned attention[C]//Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:3442-3448.
[2]
KEP, JIH Z, LIUS Y,et al .SentiLARE:sentiment-aware language representation learning with linguistic knowledge[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:6975-6988.
[3]
ROBERTSA, RAFFELC, SHAZEERN .How much knowledge can you pack into the parameters of a language model?[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:5418-5426.
[4]
LEVINEY, LENZB, DAGANO,et al .SenseBERT:driving some sense into BERT[C]//Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:4656-4667.
[5]
TIANH, GAOC, XIAOX Y,et al .SKEP:sentiment knowledge enhanced pre-training for sentiment analysis[C]//Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:4067-4076.
[6]
YAMADAI, ASAIA, SHINDOH,et al .LUKE:deep contextualized entity representations with entity-aware self-attention[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:6442-6454.
[7]
LEWISP, PEREZE, PIKTUSA,et al .Retrieval-augmented generation for knowledge-intensive NLP tasks[C]//Proceedings of the 34th International Conference on Neural Information Processing Systems. 2020,Vancouver,BC,Canada: ACM,2020:9459-9474.
[8]
KARPUKHINV, OGUZB, MINS,et al .Dense passage retrieval for open-domain question answering[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:6769-6781.
[9]
LEWISM, LIUY H, GOYALN,et al .BART:denoising sequence-to-sequence pre-training for natural language generation,translation,and comprehension[C]//Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:7871-7880.
[10]
JOSHIM, LEEK, LUANY,et al .Contextualized representations using textual encyclopedic knowledge[J].ArXiv e-Prints,2020:arXiv:2004.12006.
[11]
GUU K, LEEK, TUNGZ,et al .REALM:retrieval-augmented language model pre-training[C]//Proceedings of the 37th International Conference on Machine Learning.ACM,2020: 3929-3938.
[12]
GANGOPADHYAYB, HAZRAS, DASGUPTAP .Semi-lexical languages:a formal basis for using domain knowledge to resolve ambiguities in deep-learning based computer vision[J].Pattern Recognition Letters,2021,152:143-149.
[13]
HASANPOURS H, ROUHANIM, FAYYAZM,et al .Lets keep it simple,Using simple architectures to outperform deeper and more complex architectures[J].ArXiv e-Prints,2016:arXiv:1608.06037.
[14]
DENGJ, DINGN, JIAY Q,et al .Large-scale object classification using label relation graphs[C]//European Conference on Computer Vision.Cham:Springer,2014:48-64.
[15]
AMIZADEHS, PALANGIH, POLOZOVO, et al. Neuro-symbolic visual reasoning: disentangling "visual" from "reasoning"[C]// Proceedings of the International Conference on Machine Learning (ICML). 2020.
[16]
HANX, ZHAOW L, DINGN,et al .PTR:prompt tuning with rules for text classification[J].AI Open,2022,3:182-192.
[17]
BAIJ G, WANGY J, CHENY R,et al .Syntax-BERT:improving pre-trained transformers with syntax trees[C]//Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics:Main Volume.Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2021:3011-3020.
[18]
ZHOUJ R, ZHANGZ S, ZHAOH,et al .LIMIT-BERT:linguistics informed multi-task BERT[C]//Findings of the Association for Computational Linguistics:EMNLP 2020.Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:4450-4461.
[19]
SACHAND S, ZHANGY, QIP, et al. Do syntax trees help pre-trained transformers extract information? [C]// Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics. 2021: 2647-2661.
[20]
ZHANGZ Y, HANX, LIUZ Y,et al .ERNIE:enhanced language representation with informative entities[C]//Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics.Florence,Italy.Stroudsburg,PA,USA:Association for Computational Linguistics,2019:1441-1451.
[21]
PETERSM E, NEUMANNM, LOGANR,et al .Knowledge enhanced contextual word representations[C]//Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP).Hong Kong,China.Stroudsburg,PA,USA:Association for Computational Linguistics,2019:43-54.
[22]
WANGP, WUQ, SHENC H,et al .Explicit knowledge-based reasoning for visual question answering[C]//Proceedings of the 26th International Joint Conference on Artificial Intelligence.Melbourne,Australia: ACM, 2017: 1290-1296.
[23]
WANGP, WUQ, SHENC H,et al .FVQA:fact-based visual question answering[J].IEEE Transactions on Pattern Analysis and Machine Intelligence,2018,40(10):2413-2427.
[24]
XIONGW, DUJ, WANGW Y,et al.Pretrained encyclopedia: weakly supervised knowledge-pretrained language model[C]//International Conference on Learning Representations.2020.
[25]
LAUSCHERA, VULIĆI, PONTIE M,et al .Specializing unsupervised pretraining models for word-level semantic similarity[C]//Proceedings of the 28th International Conference on Computational Linguistics.Barcelona,Spain (Online).Stroudsburg,PA,USA:International Committee on Computational Linguistics,2020:1371-1383.
[26]
SHENT, MAOY, HEP C,et al .Exploiting structured knowledge in text via graph-guided representation learning[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:8980-8994.
[27]
BOSSELUTA, RASHKINH,SAP M,et al .COMET:commonsense transformers for automatic knowledge graph construction[C]//Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics.Florence,Italy.Stroudsburg,PA,USA:Association for Computational Linguistics,2019:4762-4779.
[28]
JIH Z, KEP, HUANGS H,et al .Language generation with multi-hop reasoning on commonsense knowledge graph[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).Online.Stroudsburg,PA,USA:Association for Computational Linguistics,2020:725-736.
[29]
LIUY, WANY, HEL F,et al .KG-BART:knowledge graph-augmented BART for generative commonsense reasoning[J].Proceedings of the AAAI Conference on Artificial Intelligence,2021,35(7): 6418-6425.
[30]
YANGA, WANGQ, LIUJ,et al. Enhancing pre-trained language representations with rich knowledge for machine reading comprehension[C]//Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics.Florence,Italy.Stroudsburg,PA,USA:Association for Computational Linguistics,2019:2346-2357.