• 学术搜索
  • 科研智能体
    • Research Labs
    • AI 阅读
    • AI 文库
    • 深度研究
    • 学者亮点
  • 学术资源
    • AI2000
    • 期刊/会议
    • 学者库
    • 学术API
    • 溯源树
    • 数据集
  • 知识沉淀
    • 学术空间
订阅小程序
旧版功能
aminer vip
开通会员低至0.73元/天
一次搞定AI科研
立即登录
  • English
  • 联系方式
    专

    一种基于LED背景墙的电影虚拟化制作系统及方法

    TW106063727C
    发明人
    赵建军, 陈军, 鲁梦河, 孔明敏, 卢柏宏, 耿天乐, 肖翱
    受让人
    BEIJING FILM ACAD
    申请人
    ROBERT ALFRED BLAKE
    申请号
    10923904
    申请日
    2009-12-14
    公开(公告)号
    TW106063727C
    公开(公告)日
    1991-11-28
    IPC分类号
    G08G1/0968
    CPC分类号
    -
    优先权号
    056812
    075720
    优先权日
    2017-05-03
    2017-06-14
    摘要

    The arrangement is for measuring the level of material in a container (1) contains several pressure measurement cells (5) which are exposed to the material. Each contains a pressure sensor connected to an evaluation circuit.

    The pressure measurement cells are arranged at defined, uniform vertical distances (a) from each other on a common carrier element (6). This can be inserted into the container and attached to its inner wall or suspended from a support.

    USE/ADVANTAGE -The level measurement arrangement is simple to install and enables increased measurement accuracy to be achieved compared to conventional ones.

    权利要求
    1. A storage media conversion device, for using with a plurality of first size hard disks (A) or a plurality of second size hard disks (B), the first size hard disk (A) being larger in size than the second size hard disk (B), the storage media conversion device comprising: a mounting bracket ( 100 ) including a first baseplate ( 110 ) and two corresponding side plates ( 120 ) disposed perpendicularly on the first baseplate ( 110 ), the first baseplate ( 110 ) and the side plates ( 120 ) enclosing a first loading space ( 130 ), wherein any of the side plates ( 120 ) includes a first resilient positioning portion ( 150 ), and the first resilient positioning portion ( 150 ) is provided for positioning the first size hard disk (A); and a holder ( 200 ) including a pivot shaft ( 210 ) pivotally connected to one side of the first baseplate ( 110 ), a handle ( 220 ) rotatable with respect to the pivot shaft ( 210 ), and a contact portion ( 230 ) disposed close to the pivot shaft ( 210 ), wherein the length from the handle ( 220 ) to the pivot shaft ( 210 ) is greater than the length from the contact portion ( 230 ) to the pivot shaft ( 210 ); and a conversion bracket ( 300 ) disposed in the first loading space ( 130 ) of the mounting bracket ( 100 ), the conversion bracket ( 300 ) comprising: a second baseplate ( 310 ), two long side plates ( 320 ) extending perpendicularly from the second baseplate ( 310 ) a support stand ( 400 ) disposed perpendicularly on the second baseplate ( 310 ) at least one positioning element ( 420 ) perpendicularly disposed on the second baseplate ( 310 ) and parallel to at least one short side plate ( 322 ), wherein the positioning element ( 420 ), the support stand ( 400 ), and one of the side plates ( 120 ) enclose a second loading space ( 430 ) for positioning the second size hard disk (B).
    2. The storage media conversion device of claim 1 , wherein the first resilient positioning portion ( 150 ) further comprises a slot ( 180 ) and a first extending arm ( 190 ), one end of the first extending arm ( 190 ) is connected to the side plate ( 120 ), the other end includes a protrusion point ( 154 ) resiliently movable in the slot ( 180 ), the protrusion point ( 154 ) protrudes toward the first loading space ( 130 ), and the first extending arm ( 190 ) including the protrusion point ( 154 ) is inclined outwardly from the side plate ( 120 ).
    3. The storage media conversion device of claim 1 , further including a fastening portion ( 340 ) is disposed on any of the corresponding long side plates ( 320 ) for positioning the first resilient positioning portion ( 150 ); a support stand ( 400 ) disposed parallel to one of the long side plates ( 320 ), the support stand ( 400 ) includes at least one second resilient positioning portion ( 410 ).
    4. The storage media conversion device of claim 3 , wherein the support stand ( 400 ) further includes two second extending arms ( 450 ), each of the second extending arms ( 450 ) extends toward two sides of the support stand ( 400 ), and the second resilient positioning portion ( 410 ) is disposed on one end of the second extending arm ( 450 ) for positioning the second size hard disk (B).
    5. The storage media conversion device of claim 3 , wherein the mounting bracket ( 100 ) further includes a fixed pillar ( 160 ) and at least one buffer ( 170 ), the buffer ( 170 ) is disposed on the first baseplate ( 110 ), the conversion bracket ( 300 ) includes a positioning hole ( 352 ) for positioning the fixed pillar ( 160 ).
    6. The storage media conversion device of claim 3 , wherein the fastening portion ( 340 ) is a round hole, the second baseplate ( 310 ) further includes a baffle plate ( 370 ) and an opening ( 380 ), the opening ( 380 ) is formed on the second baseplate ( 310 ) and disposed corresponding to the second loading space ( 430 ), the baffle plate ( 370 ) protrudes toward the opening ( 380 ) to carry the second size hard disk (B).
    7. The storage media conversion device of claim 3 , further comprising an assembly element ( 360 ), the mounting bracket ( 100 ) including an assembly hole ( 152 ), the conversion bracket ( 300 ) including an opening ( 350 ) corresponding to the assembly hole ( 152 ), the assembly element ( 360 ) being inserted through the opening ( 350 ) to be positioned in the assembly hole ( 152 ).
    8. The storage media conversion device of claim 5 , wherein one end of the support stand ( 400 ), one end of the positioning element ( 420 ), and an upper edge of the second extending arm ( 450 ) respectively include a guiding portion ( 470 ) for guiding the second size hard disk (B) to be assembled in the second loading space ( 430 ), and the second resilient positioning portion ( 410 ) is a protruding point protruding toward the second loading space ( 430 ).
    9. The storage media conversion device of claim 1 , wherein the mounting bracket ( 100 ) further comprises a groove ( 122 ) formed on the first baseplate ( 110 ), the handle ( 220 ) includes a hook ( 240 ) which is disposed corresponding to the groove ( 122 ) and is positioned therein.
    10. The storage media conversion device of claim 1 , wherein the contact portion ( 230 ) has a plurality of edges ( 250 ) to form a recess.
    11. A server for using with a plurality of first size hard disks (A) or a plurality of second size hard disks (B), the first size hard disk (A) being greater in size than the second size hard disk (B), the server comprising: a plurality of mounting brackets ( 100 ), each of the mounting brackets ( 100 ) including a first baseplate ( 110 ) and two corresponding side plates ( 120 ) disposed perpendicularly on the first baseplate ( 110 ), the first baseplate ( 110 ) and the side plates ( 120 ) enclosing a first loading space ( 130 ), wherein any of the side plates ( 120 ) includes a first resilient positioning portion ( 150 ); a plurality of holders ( 200 ), each of the holders ( 200 ) including a pivot shaft ( 210 ), a handle ( 220 ), and a contact portion ( 230 ), the pivot shaft ( 210 ) being pivotally connected to the first baseplate ( 110 ), the handle ( 220 ) being rotatable with respect to the pivot shaft ( 210 ), and the contact portion ( 230 ) being disposed close to the pivot shaft ( 210 ), wherein the length from the handle ( 220 ) to the pivot shaft ( 210 ) is greater than the length from the contact portion ( 230 ) to the pivot shaft ( 210 ); and a loading plate ( 500 ) disposed with a plurality of pairs of side plates ( 510 ), a third loading space ( 520 ) and a plurality of engaged portions ( 530 ) being disposed between each pair of the side plates ( 510 ), each of the third loading spaces ( 520 ) being provided for positioning each of the mounting brackets ( 100 ), the engaged portion ( 530 ) being disposed corresponding to the contact portion ( 230 ) of the holder ( 200 ), wherein the handle ( 220 ) is rotatable with respect to the pivot shaft ( 210 ), the mounting bracket ( 100 ) is movable with respect to the loading plate ( 500 ); and each pair of the side plates ( 510 ) further includes a third resilient positioning portion ( 550 ) engages to the first resilient positioning portion ( 150 ) for positioning the first resilient positioning portion ( 150 ), the third resilient positioning portion ( 550 ) is a protruding point protruding toward the third loading space ( 520 ), the engaged portion ( 530 ) is a protruding pillar.
    12. The server of claim 11 , wherein the loading plate ( 500 ) further comprising a plurality of electrical connectors ( 540 ), each of the electrical connectors ( 540 ) being disposed corresponding to each of the third loading spaces ( 520 ) for electrically connected to the first size hard disks (A) or the second size hard disks (B).
    13. The server of claim 11 , wherein the first resilient positioning portion ( 150 ) further comprises a slot ( 180 ) and a first extending arm ( 190 ), one end of the first extending arm ( 190 ) is connected to the side plate ( 120 ), the other end includes a protrusion point ( 154 ) resiliently movable in the slot ( 180 ), the protrusion point ( 154 ) protrudes toward the first loading space ( 130 ), and the first extending arm ( 190 ) including the protrusion point ( 154 ) is inclined outwardly from the side plate ( 120 ).
    14. The server of claim 11 , further including a plurality of conversion brackets ( 300 ) disposed in the first loading space ( 130 ) of the mounting bracket ( 100 ), each of the conversion brackets ( 300 ) comprising: a second baseplate ( 310 ), two long side plates ( 320 ) extending perpendicularly from the second baseplate ( 310 ), and at least one short side plate ( 322 ), a fastening portion ( 340 ) being disposed on any of the corresponding long side plates ( 320 ) for positioning the first resilient positioning portion ( 150 ); a support stand ( 400 ) disposed perpendicularly on the second baseplate ( 310 ) and parallel to one of the long side plates ( 320 ), the support stand ( 400 ) including at least one second resilient positioning portion ( 410 ); and at least one positioning element ( 420 ) perpendicularly disposed on the second baseplate ( 310 ) and parallel to the at least one short side plate ( 322 ), wherein the positioning element ( 420 ), the support stand ( 400 ), and one of the side plates ( 120 ) enclose a second loading space ( 430 ).
    15. The server of claim 14 , wherein the support stand ( 400 ) further includes two second extending arms ( 450 ), each of the second extending arms ( 450 ) extends toward two sides of the support stand ( 400 ), and the second resilient positioning portion ( 410 ) is disposed on one end of the second extending arm ( 450 ).
    16. The server of claim 14 , wherein the mounting bracket ( 100 ) further includes a fixed pillar ( 160 ) and at least one buffer ( 170 ), the buffer ( 170 ) is disposed on the first baseplate ( 110 ), the conversion bracket ( 300 ) includes a positioning hole ( 352 ) for positioning the fixed pillar ( 160 ).
    17. The server of claim 14 , further comprising a plurality of assembly elements ( 360 ), each of the mounting brackets ( 100 ) including an assembly hole ( 152 ), each of the conversion brackets ( 300 ) including an opening ( 350 ) corresponding to the assembly hole ( 152 ), each of the assembly elements ( 360 ) being inserted through the opening ( 350 ) to be positioned in the assembly hole ( 152 ).
    18. The server of claim 14 , wherein one end of the support stand ( 400 ), one end of the positioning element ( 420 ), and an upper edge of the second extending arm ( 450 ) respectively include a guiding portion ( 470 ), the second resilient positioning portion ( 410 ) is a protruding point protruding toward the second loading space ( 430 ), the contact portion ( 230 ) has a plurality of edges ( 250 ) to form a recess.
    19. The server of claim 16 , wherein each of the conversion brackets ( 300 ) includes a positioning hole ( 352 ) for positioning the fixed pillar ( 160 ), and the fastening portion ( 340 ) is a round hole.
    说明书
    [0001]技术领域
    [0002]本发明涉及计算机文本信息处理技术领域,涉及文本间相似度计算方法,具体涉及一种基于距离感知自注意力机制和多角度建模的文本相似度计算系统及方法。
    [0003]背景技术
    [0004]近年来随着移动互联网的蓬勃发展以及智能设备的普及,人们在工作生活中更加依赖于互联网,也因此涌现了大量基于互联网的服务平台,例如搜索引擎、博客、智能客服等等。这些服务为人们带来了便利,也产生了海量的数据,尤其是文本数据,例如人们在使用搜索引擎时产生的查询和响应数据,客服和用户之间的问答数据,博客中大量的相似性文章数据等等。然而,简单的依靠人工是无法从海量的网络数据中快速有效地获取人们所需要的信息的,因此计算机自动地进行信息抽取和挖掘技术应运而生,也因此发展出许多文本的自动化、智能化处理的理论和技术,包括信息检索、数据挖掘、机器翻译等等,而文本相似度算法是这些技术的核心技术之一。
    [0005]自然语言处理领域的文本相似度旨在计算两个文本在语义上的相似程度,因此也叫文本匹配算法,通常两个文本的两个文本的相似度越高,说明它们越匹配;两个文本相似度越低,说明它们越不匹配。因此文本相似度算法的重点在于研究两段文本之间的语义关系,例如判断两段文本是否表达相同的含义。文本相似度算法是多个自然语言处理(NLP)和信息检索任务的基本任务。
    [0006]在文本信息检索中,文本相似度算法可以计算用户查询文本和海量文本数据的关联程度,帮助用户快速准确的找到所需要的信息;在智能问答中,短文本匹配常用于从问答数据库中找到与给定问题文本最相似的问题,然后返回其对用的答案;在社区问答中,短文本匹配算法能够处理相似的问题和答案,维护问答社区的洁净,保障用户良好体验。由于短文本文本较短,噪声多,不规范,因此如何准确地判断两个短文本之间的语义关系是一项充满挑战的研究。
    [0007]现有的文本相似度计算方法主要包括:基于手工特征的方法、基于单一语义表示的神经网络方法和基于匹配聚合的神经网络方法。其中基于手工特征的方法通常利用词袋模型、TF-IDF等方法构建文本的向量表示,接着再利用余弦相似度计算两个文本向量之间的相似度。然而这类方法通常难以捕获到文本的语义特征,并且导致文本的特征向量语义稀疏,此外,这类方法还忽略了两个文本之间的交互信息,因此相似度计算的准确率低。
    [0008]随着深度学习和各种神经网络的兴起如CNN,LSTM,GRU等,深度神经网络在解决文本相似度计算问题取得了一定成功,基于神经网络的相似度计算方法分为单一语义表示架构和匹配聚合架构。单一语义表示框架将两个文本使用相同结构共享参数的网络进行编码,获得文本的向量表示形式,然后使用相似度度量方法来评估其语义相似度分数。基于单一语义表示架构的方法更易于训练,因此其处理速度将非常快,适用于需要快速响应的大多数任务。然而这种方式仅从全局角度考虑文本表示,在编码过程中没有考虑两个文本的相互作用,这使得模型难以更有效得捕获两个文本之间的语义相似度关系。另一种架构是匹配聚合网络架构,它使用匹配和聚合方法对两个文本的对齐关系进行建模,这种方法通常使用注意力机制来建模句间的对齐关系。然而这类方法虽然捕捉了两个文本之间的对齐关系,但随着模型的不断深入,在提取两个文本之间的交互信息时,在一定程度上忽略了文本单一语义的重要性。
    [0009]综上,上述方法虽然能够捕获到文本的语义向量,进而进行文本之间的相似度计算,然而难以抽取更深层次的语义特征的同时提取两个文本之间的交互信息,此外,从多种角度对特征抽取后的文本向量进行相似度度量,也会影响最终文本对<P、Q>相似度计算的准确性。
    [0010]发明内容
    [0011]为了解决现有技术存在的文本对<P、Q>相似度计算缺陷或者不足,本发明的目的在于,提供一种基于距离感知自注意力机制和多角度建模的文本相似度计算系统及方法。
    [0012]为了实现上述任务,本发明采用如下技术方案予以实现:
    [0013]一种基于距离感知自注意力机制和多角度建模的文本相似度计算系统,至少包括依次相连的词表示模块、上下文表示模块、增强语义建模模块、软对齐模块、多角度相似性建模模块和相似度结果输出模块,其中:
    [0014]词表示模块:用于输入文本P和Q,得到预处理后的文本对<P,Q>,接着使用预先训练的词嵌入得到文本对<P,Q>通过中每个词的词向量,并且进一步融合字符嵌入和精确匹配标记特征;
    [0015]所述的词表示模块中的文本预处理和词训练的实现方法是:首先对原始的文本P和Q进行分词、去除停用词,得到预处理后的文本对<P,Q>;接着使用Word2vec算法训练预处理得到文本P和Q的词向量矩阵,为了使得词向量特征丰富,同时融合字符嵌入表示和精确匹配标记特征;
    [0016]上下文表示模块:用于对文本对<P,Q>中每个词的词向量进行上下文编码,得到<P,Q>编码后的上下文表示向量;
    [0017]构建方法是:对于词嵌入表示得到的文本对<P,Q>,将其送入双层BiLSTM网络中进行上下文编码,得到文本对<P,Q>的上下文表示<h p ,h q >;
    [0018]增强语义建模模块:用于分别对文本P和Q建模,抽取出文本P和Q的更深层次的语义特征;
    [0019]构建方法是:提出一种基于距离感知的自注意力机制Distance-aware Self-attention,来对上下文建模后的表示<h p ,h q >进一步抽取更深层次的语义特征,建模后的特征向量表示为
    [0020]软对齐模块:用于建模文本对<P,Q>之间的交互信息,对两个文本的语义向量进行增强表示;
    [0021]构建方法是:在抽取增强语义表示的同时,对文本对<P,Q>使用交互注意力机制Co-attention来计算两个文本之间的软对齐关系,抽取得到的对齐后的特征为<h′ p ,h′ q >;
    [0022]多角度相似性建模模块:用于从多个不同角度对文本P和Q的语义向量进行相似度计算;
    [0023]构建方法是:首先融合软对齐和增强语义建模特征得到<vp,v q >,接着同时利用逐元素相似度、双线性距离以及余弦相似度计算特征向量<v p ,v q >之间的多角度聚合向量v。
    [0024]相似度结果输出模块:用于将文本对<P,Q>多角度相似性建模后的聚合向量经过池化操作,再得到最终的相似度分数,最后将文本对的相似度数值转换为具体的分数输出;
    [0025]构建方法是:首先融合软对齐和增强语义建模特征得到<v p ,v q >,接着同时利用逐元素相似度、双线性距离以及余弦相似度计算特征向量<v p ,v q >之间的多角度聚合向量v。
    [0026]本发明还公开了一种基于距离感知自注意力机制和多角度建模的文本相似度计算方法,包括如下步骤:
    [0027]步骤S1:对原始文本P和Q分别进行分词、去除停用词预处理,将预处理后的文本对<P,Q>利用Word2vec模型预训练得到文本对<P,Q>的词向量,同时加入随机初始化后送入GRU学习的文本对<P,Q>字符嵌入表示以及文本P和Q之间的精确匹配标记;
    [0028]步骤S2:将词嵌入表示后的文本对<P,Q>利用双层BiLSTM进行编码,得到文本对<P,Q>的上下文表示;
    [0029]步骤S3:使用提出的距离感知自注意力机制Distance-aware Self-attention对文本P和Q分别编码,捕获文本P和Q的深层次特征,进而得到文本对<P,Q>增强的语义向量表示;
    [0030]步骤S4:利用交互注意力机制Co-attention对文本P和Q建模,捕获文本P和Q之间的交互信息;
    [0031]步骤S5:利用多角度相似性建模算法,同时利用逐元素相似度、双线性距离以及余弦相似度从多个不同的角度计算增强特征向量之间的相似度,得到多角度相似度聚合向量;
    [0032]步骤S6:将多角度相似度聚合向量进行最大池化和平均池化,抽取出关键特征,再送入到全连接层和softmax中计算最终的相似度分值,最终转换为具体的相似度分数并输出。
    [0033]上述基于距离感知自注意力机制和多角度建模的文本相似度计算方法,应用制成任意一种计算机可读指令的存储介质。当所述计算机可读指令被一个或多个处理器执行该存储介质时,使得一个或多个处理器执行所述基于距离感知自注意力机制和多角度建模的文本相似度计算方法。
    [0034]本发明与现有技术相比,带来的有益的技术效果在于:
    [0035]1、提出改进的距离感知自注意力机制Distance-aware Self-attention对文本对进行更深层次的语义特征抽取,能够有效地对文本进行增强表示,提高相似度计算准确率。
    [0036]2、提出了一种多角度相似性建模方法,从不同角度捕获文本对之间的相似性和差异性,获得了更丰富的聚合信息,提高了相似度计算效果。
    [0037]3、在词表示中同时融合特征抽取后的字符嵌入以及丰富的精确匹配标记特征,从改善词表示的层面上也改进了相似度计算性能。
    [0038]4、模型结构简单、性能高效、鲁棒性强,易于在实践中推广使用
    [0039]附图说明
    [0040]图1是本发明的基于距离感知自注意力机制和多角度建模的文本相似度计算系统结构示意图。
    [0041]图2是本发明的基于距离感知自注意力机制和多角度建模的文本相似度计算方法具体流程图。
    [0042]图3是本发明的基于距离感知自注意力机制的结构示意图。
    [0043]以下结合附图和实施例对本发明作进一步详细说明。
    [0044]具体实施方式
    [0045]参见图1,本实施例给出一种基于距离感知自注意力机制和多角度建模的文本相似度计算系统,至少包括依次相连的词表示模块、上下文表示模块、增强语义建模模块、软对齐模块、多角度相似性建模模块和相似度结果输出模块,其中:
    [0046]词表示模块:用于输入文本P和Q,得到预处理后的文本对<P,Q>,接着则使用预先训练的词嵌入得到文本对<P,Q>通过中每个词的词向量,并且进一步融合字符嵌入和精确匹配标记特征;
    [0047]上下文表示模块:用于对文本对<P,Q>中每个词的词向量进行上下文编码,得到<P,Q>编码后的上下文表示向量;
    [0048]增强语义建模模块:用于分别对文本P和Q建模,抽取出文本P和Q的更深层次的语义特征;
    [0049]软对齐模块:用于建模文本对<P,Q>之间的交互信息,对两个文本的语义向量进行增强表示;
    [0050]多角度相似性建模模块:用于从多个不同角度对文本P和Q的语义向量进行相似度计算;
    [0051]相似度结果输出模块:用于将文本对<P,Q>多角度相似性建模后的聚合向量经过池化操作,再得到最终的相似度分数,最后将文本对的相似度数值转换为具体的分数输出。
    [0052]所述的词表示模块中文本预处理和词训练的实现方法是:首先对原始的文本P和Q进行分词、去除停用词,得到预处理后的文本对<P,Q>;接着使用Word2vec算法训练预处理得到文本P和Q的词向量矩阵,为了使得词向量特征丰富,同时融合字符嵌入表示和精确匹配标记特征。
    [0053]所述的上下文表示模块构建方法是:对于词嵌入表示得到的文本对<P,Q>,将其送入双层BiLSTM网络中进行上下文编码,得到文本对<P,Q>的上下文表示<h p ,h q >。
    [0054]所述的增强语义建模模块构建方法是:提出一种基于距离感知的自注意力机制Distance-aware Self-attention,来对上下文建模后的表示<h p ,h q >进一步抽取更深层次的语义特征,建模后的特征向量表示为
    [0055]所述的软对齐模块构建方法是:在抽取增强语义表示的同时,对文本对<P,Q>使用交互注意力机制Co-attention来计算两个文本之间的软对齐关系,抽取得到的对齐后的特征为<h′ p ,h′ q >。
    [0056]所述的多角度相似性建模模块构建方法是:首先融合软对齐和增强语义建模特征得到<v p ,v q >,接着同时利用逐元素相似度、双线性距离以及余弦相似度计算特征向量<v p ,v q >之间的多角度聚合向量v。
    [0057]最终,所述的相似度结果输出模块,将多角度聚合向量v进行最大池化和平均池化得到池化后的向量v avg 和v max ,最后拼接后送入全连接层和softmax层得到最终文本对<P,Q>的相似度分数,再转换为具体的分数输出。
    [0058]参见图2所示:本发明还公开了一种基于距离感知自注意力机制和多角度建模的文本相似度计算方法,包括如下步骤:
    [0059]步骤S1:对文本P和Q分别进行预处理,接着对预处理后的文本对<P,Q>通过Word2vec算法预训练得到词嵌入后加入字符嵌入和精确匹配标记,得到最终的词表示;
    [0060]步骤S2:将嵌入表示后的文本对<P,Q>送入双层BiLSTM网络中学习文本对<P,Q>的上下文表示;
    [0061]步骤S3:使用提出的距离感知自注意力机制Distance-aware Self-attention对上下文表示后的文本对<P,Q>进一步抽取出深层次的语义特征。
    [0062]步骤S4:使用交互注意力机制Co-attention抽取出文本对<P,Q>之间的软对齐关系。
    [0063]步骤S5:提出多角度相似性建模算法,同时利用逐元素相似度、双线性距离以及余弦相似度从多个不同的角度计算增强特征向量之间的相似度,得到多角度相似度聚合向量。
    [0064]步骤S6:将多角度相似度聚合向量进行最大池化和平均池化,抽取出关键特征,再送入到全连接层和softmax中计算最终的相似度分值,最终转换为具体的分数并输出。
    [0065]以下结合本发明的基于距离感知自注意力机制和多角度建模的文本相似度算法的各个分步骤,进一步解释说明本发明的整体技术构思。
    [0066]步骤S1:步骤S1包含四个步骤:
    [0067]步骤S1.1:首先采用Jieba分词工具对文本对<P,Q>进行分词,再去除停用词;
    [0068]步骤S1.2:接着对预处理后的文本对采用Word2vec算法预训练得到300维单词-向量矩阵,获得每个单词到300维词向量的映射,记为e w ;
    [0069]步骤S1.3:将随机初始化的字符嵌入送入RNN中来学习字符嵌入e c ,字符特征e c 可以为某些OOV(Out Of Vocabulary)单词提供额外信息;
    [0070]步骤S1.4:加入精确匹配标记特征f,如果在另一个句子中找到相同的单词,则完全匹配标志f将被激活,精确匹配标记可以帮助理解文本;最终文本对<P,Q>的词表示分别表示为<p w ,q w >;公式如下:
    [0071]步骤S2:使用BiLSTM网络对两个输入的文本对<P,Q>进行编码,BiLSTM可以提取句子的上下文特征并可以存储长距离信息,为简化模型,仅使用两层BiLSTM编码句子并共享参数,得到文本对<P,Q>的上下文表示<h p ,h q >,其中:
    [0072]步骤S3:采用距离感知自注意力机制Distance-aware Self-attention对文本对<P,Q>进行更深层次的编码,如图3所示,步骤S3提出的距离感知自注意力机制Distance-aware Self-attention进一步包含三个步骤:
    [0073]步骤S3.1:采用多维“token2token”自我注意机制Self-attention分别对文本P和Q进行编码,对于这种文本对语义相似度算法,其实通过几个关键词信息就可以判断文本对之间的语义关系。因此,为了强调文本中某些词的重要性以及加强单一文本底层特征的提取,使用了自我注意机制Self-attention来捕获文本中每个词的上下文信息。
    [0074]对于P或Q的上下文表示h=[h 1 ,h 2 ,…,h l ],h指的是两层BiLSTM编码得到的上下文表示,h i 表示的是BiLSTM在时间i上输入句子所生成的隐藏状态,Self-attention对上下文表示h进行编码得到增强后的表示h′。其中:
    [0075]s(h i ,h j )=σ((W 1 h i +W 2 h j +b)/c) (6)
    [0076]其中,s(h i ,h j )是相似度函数,是用来计算h i 和h j 之间的依赖关系,即计算文本中两个词之间的相似度关系,这里使用加性注意力机制。W 1 , 是可学习的参数,σ是激活函数。此外,c是标量,设置c=1并使用tanh作为激活函数σ。
    [0077]步骤S3.2:针对文本对相似度算法,提出新的掩码相似度算法s(h i ,h j )′应用于自我注意机制Self-attention中。主要是考虑到文本中每个词应该对其距离更近的词给予更多地关注,而对距离越远的词给予越少的关注,使得计算文本对<P,Q>之间的相似度更加准确;进而构造掩码矩阵M ij ,自动地控制文本中词与词之间相似度的分数;掩码相似度算法s(h i ,h j )′如下式:
    [0078]s(h i ,h j )′=σ((W 1 h i +W 2 h j +b)/c)+M ij (7)
    [0079]f(i,j)=-|i-j| (9)
    [0080]其中,f(i,j)是一个关于位置i和j的距离函数,k是一个正的常数,k被设置为3。当|i-j|<k时,M ij 的值为0。表示当i和j之间的距离小于k时不改变原来的相似度s(i,j)的值;这其实也是借鉴了双向n-gram的思想,也就是说,对当前词进行统计或者计算时只考虑这个词前面n个词和它后面n个词。当|i-j|≥k且i≠j时,M ij 定义为f(i,j),f(i,j)是一个和|i-j|呈负相关变化的函数,当i和j之间的距离越大,f(i,j)则越小,因此原来相似度s(i,j)相应变得更小。此外,之所以当i≠j时,M ij 为负无穷大,是因为要忽略词自身的影响,因为词和自身之间的相似度肯定是最大的,当给它们赋予一个负无穷大的值以后,那么自身所占的权重则为0。
    [0081]步骤S3.3:最后对文本对<P,Q>分别使用所提出的距离感知自注意力机制Distance-aware Self-attention进行增强语义建模,得到两个增强后的语义表示向量分别
    [0082]步骤S4进一步包含以下两个步骤:
    [0083]步骤S4.1:使用一种基于交互注意力机制Co-attention的软对齐方式来计算获得文本对<P,Q>之间的对齐依赖关系。针对文本对<P,Q>的上下文表示<h p ,h q >,采用交互注意力机制Co-attention算法计算它们之间的对齐向量表示<h′ p ,h′ q >;其中:
    [0084]式中,W c 、W d 是可学习的参数,e ij 用来计算文本P和Q的上下文表示的点积,得到相似性得分。输出向量h′ p 和h′ q 是通过对另一个文本的表示进行加权求和计算得到的,该总和由当前位置和另一个文本中相应位置之间的相似性分数加权得到。
    [0085]步骤S4.2:将软对齐后的特征<h′ p ,h′ q >和距离感知自注意力机制得到的特征 进行融合,得到最终的增强语义特征向量<v p ,v q >如下:
    [0086]步骤S5:步骤S5分为四个步骤:
    [0087]步骤S5.1:首先计算两个增强语义向量<v p ,v q >的余弦相似度m 1 ,得到相似度向量m 1 。余弦相似度需要对两个句子的每个维度的词与词之间的相似度进行计算,再对所有维度的相似度求和,得到的是词与词之间在所有维度空间上的整体相似度表现。
    [0088]m 1 的表达式如下:
    [0089]m 1 =cosine similarity(v p ,v q ) (15)
    [0090]步骤S5.2:计算两个增强语义向量<v p ,v q >的双线性距离m 2 ,双线性距离实际上在Attention相似度分数的计算中使用的比较多,本质上是点积运算,实际上计算的是向量级别的相似性,也就说考虑的是整个句子的角度,并且由于它使用了一个可学习参数W 1 和激活函数σ,能学习到更多有用的信息。
    [0091]m 2 的表达式如下:
    [0092]m 2 =σ(v p W 1 )·v q (16)
    [0093]步骤S5.3:计算两个增强语义向量<v p ,v q >逐元素相似度m 3 ,逐元素匹配从元素的角度考虑相似性。<v p ,v q >是文本P和Q的增强语义表示,类似于图像的张量图。正如图片中每个“像素”都有不同的值。由于不同词的重要性不同,对应的值也不同。因此,对于不同的值来计算差异和相似度可以学习到更好的文本之间的关系。
    [0094]m 3 的表达式如下:
    [0095]m 3 =Concat(v p ,v q ,v p +v q ;v p -v q ,|v p -v q |,v p *v q ) (17)
    [0096]步骤S5.4:最终的聚合向量v为余弦相似度m 1 、双线性距离m 2 以及逐元素相似度m 3 融合的结果。
    [0097]v的表达式如下:
    [0098]v=concate[m 1 ;m 2 ;m 3 ] (18)
    [0099]步骤S6分为以下两个步骤:
    [0100]步骤S6.1:将最终的匹配使用平均池化和最大池化,以获取相应的向量表示形式,得到最终的输出语义向量o。平均池化可以用来聚合全局语义,而最大池化则表示导入语义特征。
    [0101]v max =[max 1<i<n v i ] (20)
    [0102]o=concate[v avg ;v max ] (21)
    [0103]步骤S6.2:将步骤S6.1得到输出语义向量o,输入到多层感知机和softmax中得到最终的相似度分数similarity <P , Q >如下式所示:
    [0104]similarity <P , Q> =MLP(o)(22)
    [0105]为了验证本实施例的基于距离感知自注意力机制和多角度建模的文本相似度计算方法的有效性,发明人设计了一组评估实验,利用两个文本相似度判断的数据集来衡量两个文本的语义相似度,即BQ和LCQMC语料库。
    [0106]公开数据集BQ语料库是用于文本对语义相似度判断的中文银行问题对数据集,包含来在线银行真实客户服务日志,该数据集包括100,000个训练集,10,000个验证集,10,000个测试集。
    [0107]公开数据集LCQMC是哈尔滨工业大学在自然语言处理国际顶会COLING2018构建的问题语义匹配数据集,是从百度知识收集的开放域中文数据集,该数据集包括239,000个训练集,8,400个验证集,12,500个测试集。
    [0108]这两个公开数据集的目标是判断两个问题文本的语义是否相同,如果两个问题文本表达相同的含义或者具有相同的意图,那么这两个文本在语义上是对等的,标记为1,否则,这两个文本语义不对等,标记为0。
    [0109]因此,发明人所设计的实验的目的是判断两个问题文本是否具有相同的语义,预测出两个文本对的标签,和真实标签进行对比,计算预测成功的准确率。因此,在和其他发明或者其他人提出的方法进行对比时,所采用的评价指标是分类准确率Accuracy。
    [0110]在BQ和LCQMC数据集上准确率计算结果对比如下表所示。
    [0111]对比模型 LCQMC BQ (1)Text-CNN 72.8 68.52 (2)BiLSTM 76.1 73.51 (3)BiMPM 83.4 81.85 (4)ESIM 84.0 81.7 (5)DIIN 84.47* 81.41 our 86.8 84.1
    [0112]上表显示了模型在LCQMC和BQ两个中文数据集上的性能与近几年当前的优秀的文本相似度模型的对比,包括Text-CNN,BiLSTM,BIMPM,ESIM,DIIN,模型在这两个数据集上均达到了当前最佳的性能。其中Text-CNN是用于文本分类的卷积神经网络(CNN)模型。BiMPM是用于自然语言文本匹配的良好性能的双边多视角匹配模型,DIIN是用于自然语言推理的密交互推理网络,通过从交互空间中分层抽取语义特征,实现对句子对的高层次理解。
    [0113]在LCQMC数据集中,本实施例给出的模型高出句子匹配模型DIIN将近2.4%,高出ESIM2.8%,和BIMPM相比提高了3.4%,在BQ数据集中,模型和BiMPM、ESIM、DIIN相比分别提高了2.2%、2.4%以及2.7%。
    [0114]尽管Text-CNN利用CNN单元来捕获文本的局部特征,而BiLSTM模型利用BiLSTM单元来捕获文本的长距离依赖特征,但它们都属于单一语义表示框架,也就是说它们没有考虑到两个输入的文本之间的复杂相互作用。BiMPM、ESIM以及DIIN是文本相似度算法领域中较好的基于交互型的模型并且功能强大,都是利用Attention机制获得两个文本之间的交互作用。
    [0115]和上述模型相比,本实施例给出的模型仍然比它们高出不少,这是因为本实施例的技术方案不仅利于交互注意力机制Co-attention提取文本间对齐关系,还提出了基于距离感知自注意力机制Distance-aware self-attention,能够有效地从文本特征提取的角度改善算法效果。实验表明,本实施例的基于距离感知自注意力机制和多角度建模的文本相似度算法十分有效。
    同族专利
    暂无同族专利