WO2023103914A1 - Text sentiment analysis method and device, and computer-readable storage medium - Google Patents

Text sentiment analysis method and device, and computer-readable storage medium Download PDF

Info

Publication number
WO2023103914A1
WO2023103914A1 PCT/CN2022/136328 CN2022136328W WO2023103914A1 WO 2023103914 A1 WO2023103914 A1 WO 2023103914A1 CN 2022136328 W CN2022136328 W CN 2022136328W WO 2023103914 A1 WO2023103914 A1 WO 2023103914A1
Authority
WO
WIPO (PCT)
Prior art keywords
word
text
attribute
sentiment analysis
representation
Prior art date
Application number
PCT/CN2022/136328
Other languages
French (fr)
Chinese (zh)
Inventor
夏睿
李成路
周祥生
董修岗
孙文卿
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2023103914A1 publication Critical patent/WO2023103914A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the present application relates to the field of big data, in particular to a text sentiment analysis method, device and computer-readable storage medium.
  • Text sentiment analysis also known as opinion mining, is a classic research task in the field of natural language processing.
  • Embodiments of the present application provide a text sentiment analysis method, device, and computer-readable storage medium.
  • the embodiment of the present application provides a text sentiment analysis method, including: obtaining each word in the target text; obtaining the word vector representation of each word; obtaining the implicit dependency syntax structure information representation of each word; The word vector representation of the word and the implicit dependency syntactic structure information representation are concatenated to obtain an input matrix; the input matrix is input into an attribute sentiment analysis model to obtain the attribute emotion classification of the target text.
  • Embodiments of the present application also provide a text sentiment analysis device, including: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores information that can be processed by the at least one processor. Instructions executed by a processor, the instructions are executed by the at least one processor, so that the at least one processor can execute the text sentiment analysis method as described above.
  • Embodiments of the present application also provide a computer-readable storage medium storing a computer program, and implementing the aforementioned text sentiment analysis method when the computer program is executed by a processor.
  • Fig. 1 is a program flow chart of the text sentiment analysis method provided by an embodiment of the present application
  • Fig. 2 is a schematic diagram of the operational flow of the Biaffine parser model in the text sentiment analysis method provided by an embodiment of the present application;
  • Fig. 3 is a program flow chart of the steps of obtaining the attribute sentiment classification of the target text in the text sentiment analysis method provided by an embodiment of the present application;
  • Fig. 4 is a schematic diagram of the operation flow of the attribute-level sentiment analysis model in the text sentiment analysis method provided by an embodiment of the present application;
  • FIG. 5 is a program flow chart of a text sentiment analysis method provided in another embodiment of the present application.
  • Fig. 6 is a schematic structural diagram of a text sentiment analysis device provided by another embodiment of the present application.
  • Attribute-level sentiment analysis aims to identify the attribute words that appear in the text first, and then judge the emotional tendency of the entire text for the specific attribute words based on the identified attribute words.
  • attribute-level sentiment analysis has a wide range of application scenarios and room for research and development.
  • attribute-level sentiment analysis technology can be used to understand the user's perception of a product.
  • Valuable business information is mined from a large amount of review data.
  • many works have begun to mine and utilize the dependency syntactic structure information of text in attribute-level sentiment analysis.
  • the storage method of dependency syntax tree is Stored in the form of an adjacency matrix.
  • an embodiment of the present application relates to a text sentiment analysis method, as shown in Figure 1, at least including the following steps:
  • Step S101 Obtain each word in the target text.
  • the target text is segmented into individual words according to the word segmentation model.
  • the target text can be the result text of Optical Character Recognition (OCR) (that is, OCR text), or it can be ordinary text, that is, as long as It only needs to be text and has a wide range of applications.
  • OCR Optical Character Recognition
  • the length of the target text is not limited, and at least one word can be obtained after segmentation by the word segmentation model.
  • the word segmentation model can be an N-gram model (n-gram).
  • the N-gram model is a relatively mature model for word segmentation.
  • the n-th item can be inferred based on the first n-1 items, and the word segmentation of the text is more accurate.
  • Step S102 Obtain the word vector representation of each word.
  • a pre-trained GloVe (Global Vectors, global vector) word embedding model is used to convert each word into its corresponding 300-dimensional vector. That is, there is a one-to-one correspondence between each word in the target text and its word vector representation. It can be understood that the foregoing is only an example of obtaining the word vector representation of each word in this embodiment, and does not constitute a limitation.
  • the Skip-gram model or continuous Word bag model ContinuousBag-of-Words
  • the Skip-gram model and the continuous word bag model to obtain the word vector representation of each word, etc., according to A flexible setting is actually required.
  • Step S103 Obtain the implicit dependency syntax structure information representation of each word.
  • each word in the target text is input into the deep neural dependency syntactic analysis model, the hidden state representation generated by the deep neural dependency syntactic analysis model in the encoding stage is obtained, and the implicit dependency syntactic structure of each word is obtained according to the hidden state representation information representation.
  • the implicitly dependent syntactic structure information of each word refers to the hidden state generated by the deep neural dependency syntactic analysis model in the encoding layer stage.
  • the deep neural dependent syntactic analysis model is, for example, the Biaffine parser model, and the Biaffine parser model is Including three layers of Bi-LSTM (Long Short-Term Memory, two-way long-short-term memory) network, as shown in Figure 2, in this embodiment, in the coding phase, the three layers of Bi-LSTM network of Biaffine parser model extracts the content of target text feature information and output the hidden state of the target text, and the hidden state representation of each word in the target text can be regarded as a representation with implicitly dependent syntactic structure information. In the decoding stage, a matrix with decimals on the right side of Figure 2 can be obtained.
  • Bi-LSTM Long Short-Term Memory, two-way long-short-term memory
  • the value in this matrix represents the biaffine score between words, that is, the probability value of a dependency edge between two words.
  • the formed matrix is called It is a probability matrix (Probability Matrix), which can also be regarded as a weighted directed graph.
  • the dependency syntax tree at the top of Figure 2 is obtained, also known as the best dependency syntax tree (1-best dependency tree), and the right element values are only discrete with 0 and 1
  • the matrix is the adjacency matrix representation of the dependency syntax tree. For example, there are 5 words in the input text in Figure 2, where the "$" symbol represents the root node of the dependency syntax tree, which is used to point to the predicate in the text.
  • the size of the adjacency matrix is 5 ⁇ 5.
  • Each row indicates whether there is a dependency edge between the word and other words. If there is a dependency edge between words, the value of the element at the corresponding position is 1, otherwise it is 0. For example, "like” has A dependency edge pointing to "eating", and the positions of the two words in the original text are 3 and 4 respectively, then the value of the element in the third row and fourth column in the adjacency matrix is 1. According to this rule, the Element values elsewhere in the adjacency matrix.
  • the hidden state generated by the deep neural dependency syntax analysis model at the encoding layer stage is directly used as the implicit dependency syntax structure information of each word, without constructing the dependency syntax tree.
  • Step S104 Concatenate the word vector representation of each word and the implicit dependency syntax structure information representation to obtain an input matrix.
  • the word vector representation of each word is directly concatenated with its corresponding implicit dependency syntax structure information representation to obtain an input matrix.
  • implicit dependency syntax structure information representation to obtain an input matrix.
  • Step S105 Input the input matrix into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text.
  • Step S201 The attribute sentiment analysis model obtains the attribute words in each word according to the input matrix.
  • the attribute sentiment analysis model obtains the input matrix
  • the input matrix passes through an attribute mask layer, and the output matrix of the attribute word in the target text can represent the hidden information of the attribute word,
  • the attribute words are obtained according to the output matrix.
  • the target text contains n words, from the beginning of the ⁇ +1 word to the end of the ⁇ +k word is the range of attribute words, the number of attribute words is k, and the aforementioned step S101 is performed on the target text
  • the input matrix obtained after processing to step S104 is
  • the output matrix obtained after passing the input matrix through the attribute mask layer is
  • the words corresponding to the non-zero values in the output matrix are the attribute words.
  • Step S202 The attribute sentiment analysis model uses the attention mechanism to extract the context information related to the attribute words.
  • Performing an attention operation can extract the semantic information most related to the attribute word from the context information, that is, get the weight score of each word in the final emotional representation.
  • the calculation formula of the weight score ⁇ is as follows:
  • Step S203 The attribute sentiment analysis model obtains the attribute sentiment classification of the target text according to the context information.
  • the hidden representation used as the final attribute sentiment classification is to combine the implicit dependency syntactic structure information of each word in the context and the concatenation value of the word vector according to the weight score. and obtained, and finally use the fully connected Softmax classifier to predict the probability of the emotional category of r, assuming that the emotional prediction probability distribution is represented by p, the calculation formula is as follows:
  • W p and b p are fixed value parameters, which can be set according to actual needs, and can also be set according to the method of model training.
  • the word vector representation of each word and the representation of implicitly dependent syntactic structure information are directly spliced to obtain The input matrix is input into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text.
  • the optimal dependency syntax tree is not directly modeled, but the implicit dependency syntax structure information of the target text is used to represent the input Performing sentiment analysis in the attribute sentiment analysis model not only improves the effect of the attribute sentiment analysis model on the attribute-level sentiment analysis data set, but also reduces the error propagation problem caused by the dependency syntax tree, and improves the attribute-level sentiment of the target text Analyze the effect.
  • An implementation manner of the present application relates to a text sentiment analysis method, as shown in Figure 5, including:
  • Step S301 Obtain each word in the target text.
  • Step S302 Obtain the word vector representation of each word.
  • steps S301 to S302 in the text sentiment analysis method proposed in this embodiment are substantially the same as steps S101 to S102 in the foregoing embodiments, and will not be repeated here, and can refer to the descriptions of the foregoing embodiments.
  • Step S303 Input each word into the deep neural-dependent syntactic analysis model, and obtain the hidden state representation generated by the deep neural-dependent syntactic analysis model in the encoding stage.
  • each word in the target text is input into the deep neural-dependent syntactic analysis model, and the hidden state representation generated by the deep neural-dependent syntactic analysis model in the encoding stage is obtained.
  • Step S304 Map the hidden state representation through the linear mapping layer to obtain the implicit dependency syntax structure information representation of each word.
  • the three-layer hidden state generated by the deep neural dependency parsing model in the encoding layer is denoted as in Represents the hidden state of the nth word in the target text in the first layer of the Bi-LSTM network, and passes the hidden state of the output L layer through a linear mapping layer to obtain the final syntax of each word with implicitly dependent syntactic structure information
  • the calculation formula of the linear mapping layer is, Among them, W l and b l are fixed parameters, which can be set flexibly according to actual needs, for example, through model training, l is any layer in the Bi-LSTM network, and L is the total number of Bi-LSTM networks. layers. That is, in this step, the three-layer hidden state of the target text is linearly mapped and the mapping results are accumulated to obtain a syntax-aware word representation with implicitly dependent syntactic structure information for each word in the text.
  • Step S305 Concatenate the word vector representation of each word and the implicit dependency syntax structure information representation to obtain the input matrix.
  • Step S306 Input the input matrix into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text.
  • steps S305 to S306 in the text sentiment analysis method proposed in this embodiment are substantially the same as steps S104 to S105 in the foregoing embodiments, and will not be repeated here, and can refer to the descriptions of the foregoing embodiments.
  • the three-layer hidden state of the target text is linearly mapped and then the mapping results are accumulated, so that each word in the target text finally has implicitly dependent syntactic structure information
  • the result of the syntax-aware word representation is more accurate, which further improves the accuracy of the final text sentiment analysis result.
  • One embodiment of the present application relates to a text sentiment analysis device, as shown in FIG. 6 , including: at least one processor 401; and a memory 402 communicatively connected to at least one processor 401; Instructions executed by at least one processor 401 , the instructions are executed by at least one processor 401 , so that at least one processor 401 can execute the text sentiment analysis method provided in the foregoing embodiments.
  • the memory 402 and the processor 401 are connected by a bus, and the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors 401 and various circuits of the memory 402 together.
  • the bus may also connect together various other circuits such as peripherals, voltage regulators, and power management circuits, all of which are well known in the art and therefore will not be further described herein.
  • the bus interface provides an interface between the bus and the transceivers.
  • a transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing means for communicating with various other devices over a transmission medium.
  • the data processed by the processor 401 is transmitted on the wireless medium through the antenna, and the antenna also receives the data and transmits the data to the processor 401 .
  • Processor 401 is responsible for managing the bus and general processing, and may also provide various functions including timing, peripheral interface, voltage regulation, power management, and other control functions. And the memory 402 may be used to store data used by the processor 401 when performing operations.
  • An embodiment of the present application relates to a computer-readable storage medium storing a computer program.
  • the computer program is executed by the processor, the text sentiment analysis method provided in the foregoing embodiments is realized.
  • a storage medium includes several instructions to make a device ( It may be a single-chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .
  • Embodiments of the present application provide a text sentiment analysis method, device, and computer-readable storage medium, so that the accuracy of text sentiment analysis results can be improved.
  • the word vector representation of each word and the implicit dependency syntax Structural information indicates that the input matrix is obtained after splicing, and the input matrix is input into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text.
  • the optimal dependency syntax tree is not directly modeled, but the implicit structure of the target text is used.
  • Dependent syntactic structure information is input into the attribute sentiment analysis model for sentiment analysis, which not only improves the effect of the attribute sentiment analysis model on the attribute-level sentiment analysis data set, but also reduces the error propagation problem caused by the dependency syntax tree, and improves the performance of the attribute sentiment analysis model. Attribute-Level Sentiment Analysis Effects on Target Text.

Abstract

The present application relates to the field of big data, and discloses a text sentiment analysis method and device, and a computer-readable storage medium. The text sentiment analysis method comprises: obtaining each word in target text (S101); obtaining word vector representation of each word (S102); obtaining implicit dependency syntactic structure information representation of each word (S103); splicing the word vector representation and the implicit dependency syntactic structure information representation of each word to obtain an input matrix (S104); and inputting the input matrix into an attribute sentiment analysis model to obtain attribute sentiment classification of the target text (S105).

Description

文本情感分析方法、装置及计算机可读存储介质Text sentiment analysis method, device and computer-readable storage medium
相关申请的交叉引用Cross References to Related Applications
本申请基于申请号为202111486407.6、申请日为2021年12月07日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。This application is based on a Chinese patent application with application number 202111486407.6 and a filing date of December 07, 2021, and claims the priority of this Chinese patent application. The entire content of this Chinese patent application is hereby incorporated by reference into this application.
技术领域technical field
本申请涉及大数据领域,特别涉及一种文本情感分析方法、装置及计算机可读存储介质。The present application relates to the field of big data, in particular to a text sentiment analysis method, device and computer-readable storage medium.
背景技术Background technique
互联网时代的飞速发展,使得各类数据海量增长,而文本数据作为人们交流表达的重要载体,蕴含着大量有价值的信息,其中丰富的用户情感信息体现在文本中。然而,互联网环境错综复杂,数据量之大可想而知,如何智能高效地分析出这些数据背后所蕴含的价值变得异常重要,因此,针对互联网评论资源,关于文本情感分析的相关研究也随之受到关注。文本情感分析,又被称为意见挖掘,是自然语言处理领域内的一项经典研究任务。The rapid development of the Internet era has led to a massive increase in various types of data, and text data, as an important carrier of people's communication and expression, contains a large amount of valuable information, among which rich user emotional information is reflected in the text. However, the Internet environment is complex, and the amount of data can be imagined. How to intelligently and efficiently analyze the value behind these data has become extremely important. Therefore, for Internet comment resources, related research on text sentiment analysis has also followed. Having attention. Text sentiment analysis, also known as opinion mining, is a classic research task in the field of natural language processing.
然而,本申请的发明人发现,在一些情形下的文本情感分析结果的准确度较低。However, the inventors of the present application found that the accuracy of text sentiment analysis results in some cases is low.
发明内容Contents of the invention
本申请实施方式提供一种文本情感分析方法、装置及计算机可读存储介质。Embodiments of the present application provide a text sentiment analysis method, device, and computer-readable storage medium.
本申请的实施方式提供了一种文本情感分析方法,包括:获取目标文本中的各个词语;获取所述各个词语的词向量表示;获取所述各个词语的隐式依存句法结构信息表示;将各个所述词语的所述词向量表示和所述隐式依存句法结构信息表示拼接、得到输入矩阵;将所述输入矩阵输入属性情感分析模型,得到所述目标文本的属性情感分类。The embodiment of the present application provides a text sentiment analysis method, including: obtaining each word in the target text; obtaining the word vector representation of each word; obtaining the implicit dependency syntax structure information representation of each word; The word vector representation of the word and the implicit dependency syntactic structure information representation are concatenated to obtain an input matrix; the input matrix is input into an attribute sentiment analysis model to obtain the attribute emotion classification of the target text.
本申请的实施方式还提供了一种文本情感分析装置,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个 处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如前述的文本情感分析方法。Embodiments of the present application also provide a text sentiment analysis device, including: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores information that can be processed by the at least one processor. Instructions executed by a processor, the instructions are executed by the at least one processor, so that the at least one processor can execute the text sentiment analysis method as described above.
本申请的实施方式还提供了一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现前述的文本情感分析方法。Embodiments of the present application also provide a computer-readable storage medium storing a computer program, and implementing the aforementioned text sentiment analysis method when the computer program is executed by a processor.
附图说明Description of drawings
图1是本申请一实施方式所提供的文本情感分析方法的程序流程图;Fig. 1 is a program flow chart of the text sentiment analysis method provided by an embodiment of the present application;
图2是本申请一实施方式所提供的文本情感分析方法中Biaffine parser模型的运算流程示意图;Fig. 2 is a schematic diagram of the operational flow of the Biaffine parser model in the text sentiment analysis method provided by an embodiment of the present application;
图3是本申请一实施方式所提供的文本情感分析方法中得到目标文本的属性情感分类的步骤的程序流程图;Fig. 3 is a program flow chart of the steps of obtaining the attribute sentiment classification of the target text in the text sentiment analysis method provided by an embodiment of the present application;
图4是本申请一实施方式所提供的文本情感分析方法中的属性级情感分析模型的运算流程示意图;Fig. 4 is a schematic diagram of the operation flow of the attribute-level sentiment analysis model in the text sentiment analysis method provided by an embodiment of the present application;
图5是本申请另一实施方式所提供的文本情感分析方法的程序流程图;5 is a program flow chart of a text sentiment analysis method provided in another embodiment of the present application;
图6是本申请另一实施方式所提供的文本情感分析装置的结构示意图。Fig. 6 is a schematic structural diagram of a text sentiment analysis device provided by another embodiment of the present application.
实施方式Implementation
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本申请各实施方式中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。In order to make the purpose, technical solution and advantages of the present application clearer, various embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. However, those of ordinary skill in the art can understand that, in each implementation manner of the present application, many technical details are provided for readers to better understand the present application. However, even without these technical details and various changes and modifications based on the following implementation modes, the technical solution claimed in this application can also be realized.
属性级情感分析旨在先识别文本中出现的属性词,针对识别出的属性词,根据特定属性词来判断整个文本对该特定属性词的情感倾向。在实际的应用场景中,属性级情感分析有着广泛的应用场景和研究发展的空间,以淘宝、亚马逊和当当等为代表的电商平台中,使用属性级情感分析技术可以从用户对某一商品的大量评论数据中挖掘出有价值的商业信息。近年来,许多工作在属性级情感分析中开始挖掘利用文本的依存句法结构信息,在这些融入文本的依存句法结构信息到属性级情感分析任务上的研究工作中,依存句法树的存储方式是以邻接矩阵的形式存储。Attribute-level sentiment analysis aims to identify the attribute words that appear in the text first, and then judge the emotional tendency of the entire text for the specific attribute words based on the identified attribute words. In actual application scenarios, attribute-level sentiment analysis has a wide range of application scenarios and room for research and development. In e-commerce platforms represented by Taobao, Amazon, and Dangdang, attribute-level sentiment analysis technology can be used to understand the user's perception of a product. Valuable business information is mined from a large amount of review data. In recent years, many works have begun to mine and utilize the dependency syntactic structure information of text in attribute-level sentiment analysis. In these research works that integrate text-dependent syntactic structure information into attribute-level sentiment analysis tasks, the storage method of dependency syntax tree is Stored in the form of an adjacency matrix.
然而,本申请的发明人发现,在一些情形下的文本的依存句法分析过程存在误差, 这一误差的存在导致最终的文本情感分析结果的准确度较低。However, the inventors of the present application have found that in some cases, there are errors in the process of text-dependent syntactic analysis, and the existence of this error leads to a lower accuracy of the final text sentiment analysis result.
为了解决这一技术问题,本申请的一种实施方式涉及一种文本情感分析方法,如图1所示,至少包括以下步骤:In order to solve this technical problem, an embodiment of the present application relates to a text sentiment analysis method, as shown in Figure 1, at least including the following steps:
步骤S101:获取目标文本中的各个词语。Step S101: Obtain each word in the target text.
在本实施方式中,首先根据分词模型将目标文本分割为一个个词语,目标文本可以是光学字符识别(Optical Character Recognition,OCR)的结果文本(即OCR文本),也可以是普通文本,即只要是文本即可,应用范围较广。目标文本的长度不限,经过分词模型分割后至少可以得到一个词语。分词模型可以是N元模型(n-gram),N元模型是一种较为成熟的用于分词的模型,可以根据前n-1项推测第n项,对文本的分词较为准确。可以理解的是,前述仅为本实施方式中对目标文本进行分词的一种方法的举例说明,并不构成限定,在本申请的其它实施方式中,也可以是其它方法,可以根据实际需要进行灵活的设置,例如当目标文本为英文文本时,也可以是通过NLTK(Natural Language Toolkit,自然语言工具包)对目标文本进行精确的分词操作,并去除目标文本中的停用词。In this embodiment, firstly, the target text is segmented into individual words according to the word segmentation model. The target text can be the result text of Optical Character Recognition (OCR) (that is, OCR text), or it can be ordinary text, that is, as long as It only needs to be text and has a wide range of applications. The length of the target text is not limited, and at least one word can be obtained after segmentation by the word segmentation model. The word segmentation model can be an N-gram model (n-gram). The N-gram model is a relatively mature model for word segmentation. The n-th item can be inferred based on the first n-1 items, and the word segmentation of the text is more accurate. It can be understood that the foregoing is only an example of a method for word segmentation of the target text in this embodiment, and does not constitute a limitation. In other embodiments of the application, other methods can also be used, which can be implemented according to actual needs. Flexible settings, for example, when the target text is English text, NLTK (Natural Language Toolkit, Natural Language Toolkit) can also be used to perform precise word segmentation on the target text and remove stop words in the target text.
步骤S102:获取各个词语的词向量表示。Step S102: Obtain the word vector representation of each word.
在本实施方式中,使用预训练好的GloVe(Global Vectors,全局向量)词嵌入模型将各个词语转化为与其对应的300维向量。即目标文本中的各个词语与其词向量表示是一一对应的。可以理解的是,前述仅为本实施方式中获取各个词语的词向量表示的一种举例说明,并不构成限定在,在本申请的其它实施方式中,还可以是通过Skip-gram模型或连续词袋模型(ContinuousBag-of-Words)等其它算法模型获取各个词语的词向量表示,或者是同时使用Skip-gram模型和连续词袋模型两种算法模型获取各个词语的词向量表示等,可以根据实际需要进行灵活的设置。In this embodiment, a pre-trained GloVe (Global Vectors, global vector) word embedding model is used to convert each word into its corresponding 300-dimensional vector. That is, there is a one-to-one correspondence between each word in the target text and its word vector representation. It can be understood that the foregoing is only an example of obtaining the word vector representation of each word in this embodiment, and does not constitute a limitation. In other embodiments of the application, the Skip-gram model or continuous Word bag model (ContinuousBag-of-Words) and other algorithm models to obtain the word vector representation of each word, or use the Skip-gram model and the continuous word bag model to obtain the word vector representation of each word, etc., according to A flexible setting is actually required.
步骤S103:获取各个词语的隐式依存句法结构信息表示。Step S103: Obtain the implicit dependency syntax structure information representation of each word.
在本实施方式中,将目标文本中的各个词语输入深度神经依存句法分析模型,获取深度神经依存句法分析模型在编码阶段产生的隐藏状态表示,根据隐藏状态表示获取各个词语的隐式依存句法结构信息表示。各个词语的隐式依存句法结构信息是指深度神经依存句法分析模型在编码层阶段产生的隐藏状态,在本实施方式中,深度神经依存句法分析模型例如为Biaffine parser模型,Biaffine parser模型在编码阶段包括三层Bi-LSTM(Long Short-Term Memory,双向长短时记忆)网络,如图2所示,在本实施方式中,在编码阶段,Biaffine parser模型的三层Bi-LSTM网络提取目标文本的特征信息并输出目标 文本的隐藏状态,目标文本中每个词的隐藏状态表示可以看作是带有隐式依存句法结构信息的表示。在解码阶段,可以得到如图2右边带小数的矩阵,该矩阵中的值表示词语之间的双亲分数(biaffine score),即两个词之间有依存关系边的概率值,构成的矩阵称为概率矩阵(Probability Matrix),也可以看作是带权的有向图。在一些情形下,对概率矩阵使用MST算法解码后便得到了图2最上方的依存句法树,也称为最佳依存句法树(1-best dependency tree),右边元素值只有0和1的离散矩阵是该依存句法树的邻接矩阵表示,例如图2中输入文本一共有5个词,其中“$”符号表示依存句法树的根节点,用于指向文本中的谓词,那该依存句法树的邻接矩阵的大小就是5×5,每一行表示该词与其他词之间是否有依存关系边,词语之间有依存关系边那对应位置的元素值为1,否则为0,比如“like”有一条指向“eating”的依存关系边,并且两个词在原文本中的位置分别是3和4,那邻接矩阵中第三行第四列的元素值便是1,根据此规则便能得到该邻接矩阵中其他位置的元素值。In this embodiment, each word in the target text is input into the deep neural dependency syntactic analysis model, the hidden state representation generated by the deep neural dependency syntactic analysis model in the encoding stage is obtained, and the implicit dependency syntactic structure of each word is obtained according to the hidden state representation information representation. The implicitly dependent syntactic structure information of each word refers to the hidden state generated by the deep neural dependency syntactic analysis model in the encoding layer stage. In this embodiment, the deep neural dependent syntactic analysis model is, for example, the Biaffine parser model, and the Biaffine parser model is Including three layers of Bi-LSTM (Long Short-Term Memory, two-way long-short-term memory) network, as shown in Figure 2, in this embodiment, in the coding phase, the three layers of Bi-LSTM network of Biaffine parser model extracts the content of target text feature information and output the hidden state of the target text, and the hidden state representation of each word in the target text can be regarded as a representation with implicitly dependent syntactic structure information. In the decoding stage, a matrix with decimals on the right side of Figure 2 can be obtained. The value in this matrix represents the biaffine score between words, that is, the probability value of a dependency edge between two words. The formed matrix is called It is a probability matrix (Probability Matrix), which can also be regarded as a weighted directed graph. In some cases, after decoding the probability matrix using the MST algorithm, the dependency syntax tree at the top of Figure 2 is obtained, also known as the best dependency syntax tree (1-best dependency tree), and the right element values are only discrete with 0 and 1 The matrix is the adjacency matrix representation of the dependency syntax tree. For example, there are 5 words in the input text in Figure 2, where the "$" symbol represents the root node of the dependency syntax tree, which is used to point to the predicate in the text. The size of the adjacency matrix is 5×5. Each row indicates whether there is a dependency edge between the word and other words. If there is a dependency edge between words, the value of the element at the corresponding position is 1, otherwise it is 0. For example, "like" has A dependency edge pointing to "eating", and the positions of the two words in the original text are 3 and 4 respectively, then the value of the element in the third row and fourth column in the adjacency matrix is 1. According to this rule, the Element values elsewhere in the adjacency matrix.
可以理解的是,在本实施方式中,直接使用深度神经依存句法分析模型在编码层阶段产生的隐藏状态作为各个词语的隐式依存句法结构信息,而不对依存句法树进行构建。It can be understood that, in this embodiment, the hidden state generated by the deep neural dependency syntax analysis model at the encoding layer stage is directly used as the implicit dependency syntax structure information of each word, without constructing the dependency syntax tree.
步骤S104:将各个词语的词向量表示和隐式依存句法结构信息表示拼接、得到输入矩阵。Step S104: Concatenate the word vector representation of each word and the implicit dependency syntax structure information representation to obtain an input matrix.
在本实施方式中,将各个词语的词向量表示直接拼接在其对应的隐式依存句法结构信息表示后,得到输入矩阵。可以理解的是,前述仅为本实施方式中的一种拼接方法的举例说明,并不构成限定没在本申请的其它实施方式中,也可以是将各个词语的词向量表示和其对应的隐式依存句法结构信息进行相加、以得到输入矩阵等,可以根据实际需要进行灵活的设置,在此不进行一一例举。In this embodiment, the word vector representation of each word is directly concatenated with its corresponding implicit dependency syntax structure information representation to obtain an input matrix. It can be understood that the foregoing is only an example of a splicing method in this embodiment, and does not constitute a limitation. Formula-dependent syntactic structure information is added to obtain an input matrix, etc., which can be flexibly set according to actual needs, and will not be listed here.
步骤S105:将输入矩阵输入属性情感分析模型,得到目标文本的属性情感分类。Step S105: Input the input matrix into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text.
在本实施方式中,如图3所示,至少包括以下步骤:In this embodiment, as shown in Figure 3, at least the following steps are included:
步骤S201:属性情感分析模型根据输入矩阵获取各个词语中的属性词。Step S201: The attribute sentiment analysis model obtains the attribute words in each word according to the input matrix.
在本实施方式中,如图4所示,属性情感分析模型在获取到输入矩阵后,将输入矩阵通过一个属性掩码层,目标文本中属性词的输出矩阵即可表征属性词的隐藏信息,从而根据输出矩阵获取属性词。In this embodiment, as shown in Figure 4, after the attribute sentiment analysis model obtains the input matrix, the input matrix passes through an attribute mask layer, and the output matrix of the attribute word in the target text can represent the hidden information of the attribute word, Thus, the attribute words are obtained according to the output matrix.
例如,以
Figure PCTCN2022136328-appb-000001
来表示目标文本,目标文 本中包含n个词,从第τ+1个词开始到第τ+k个词结束为属性词的范围,属性词数量为k个,对目标文本进行前述的步骤S101至步骤S104处理后得到的输入矩阵为
Figure PCTCN2022136328-appb-000002
将输入矩阵通过属性掩码层后得到的输出矩阵为
Figure PCTCN2022136328-appb-000003
输出矩阵中不为零的值所对应的词语即为属性词。
For example, with
Figure PCTCN2022136328-appb-000001
To represent the target text, the target text contains n words, from the beginning of the τ+1 word to the end of the τ+k word is the range of attribute words, the number of attribute words is k, and the aforementioned step S101 is performed on the target text The input matrix obtained after processing to step S104 is
Figure PCTCN2022136328-appb-000002
The output matrix obtained after passing the input matrix through the attribute mask layer is
Figure PCTCN2022136328-appb-000003
The words corresponding to the non-zero values in the output matrix are the attribute words.
步骤S202:属性情感分析模型利用注意力机制提取与属性词相关的上下文信息。Step S202: The attribute sentiment analysis model uses the attention mechanism to extract the context information related to the attribute words.
在本实施方式中,将输入矩阵In this embodiment, the input matrix
Figure PCTCN2022136328-appb-000004
和输出矩阵
Figure PCTCN2022136328-appb-000004
and the output matrix
Figure PCTCN2022136328-appb-000005
进行一次注意力操作即可以从上下文信息中提取与属性词最相关的语义信息,即得到每个词在最终情感表示中的权重分值,权重分值α的计算公式如下:
Figure PCTCN2022136328-appb-000005
Performing an attention operation can extract the semantic information most related to the attribute word from the context information, that is, get the weight score of each word in the final emotional representation. The calculation formula of the weight score α is as follows:
Figure PCTCN2022136328-appb-000006
Figure PCTCN2022136328-appb-000006
Figure PCTCN2022136328-appb-000007
Figure PCTCN2022136328-appb-000007
步骤S203:属性情感分析模型根据上下文信息得到目标文本的属性情感分类。Step S203: The attribute sentiment analysis model obtains the attribute sentiment classification of the target text according to the context information.
有了各个上下文中各个属性词的权重分值后,用作最终属性情感分类的隐藏表示便是将上下文中每个词的隐式依存句法结构信息和词向量的拼接值按权重分值加权求和得到,最后使用带全连接的Softmax分类器对r进行情感类别的概率预测,假设情感预测概率分布用p表示,则计算公式如下:With the weight scores of each attribute word in each context, the hidden representation used as the final attribute sentiment classification is to combine the implicit dependency syntactic structure information of each word in the context and the concatenation value of the word vector according to the weight score. and obtained, and finally use the fully connected Softmax classifier to predict the probability of the emotional category of r, assuming that the emotional prediction probability distribution is represented by p, the calculation formula is as follows:
Figure PCTCN2022136328-appb-000008
Figure PCTCN2022136328-appb-000008
p=softmax(Wp r+b p) p=softmax(Wp r +b p )
其中W p和b p为固定值参数,其可以根据实际需要进行设置,也可以根据模型训练的方法进行设置。 Wherein W p and b p are fixed value parameters, which can be set according to actual needs, and can also be set according to the method of model training.
本申请一种实施方式所提供的文本情感分析方法中通过获取各个词语的词向量表示和隐式依存句法结构信息表示,直接将各个词语的词向量表示和隐式依存句法结构信息表示拼接后得到输入矩阵,将输入矩阵输入属性情感分析模型从而得到目标文本的属性情感分类,这一过程中没有直接对最佳依存句法树进行建模,而是使用目标文本的隐式依存句法结构信息表示输入到属性情感分析模型中进行情感分析,不仅提高了属性情感分析模型在属性级情感分析数据集上的效果,而且可以减少因依存句法树带来的误差传播问题,提升对目标文本的属性级情感分析效果。In the text sentiment analysis method provided by an embodiment of the present application, by obtaining the word vector representation of each word and the representation of implicitly dependent syntactic structure information, the word vector representation of each word and the representation of implicitly dependent syntactic structure information are directly spliced to obtain The input matrix is input into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text. In this process, the optimal dependency syntax tree is not directly modeled, but the implicit dependency syntax structure information of the target text is used to represent the input Performing sentiment analysis in the attribute sentiment analysis model not only improves the effect of the attribute sentiment analysis model on the attribute-level sentiment analysis data set, but also reduces the error propagation problem caused by the dependency syntax tree, and improves the attribute-level sentiment of the target text Analyze the effect.
本申请的一种实施方式涉及一种文本情感分析方法,如图5所示,包括:An implementation manner of the present application relates to a text sentiment analysis method, as shown in Figure 5, including:
步骤S301:获取目标文本中的各个词语。Step S301: Obtain each word in the target text.
步骤S302:获取各个词语的词向量表示。Step S302: Obtain the word vector representation of each word.
可以理解的是,本实施方式所提的文本情感分析方法中的步骤S301至步骤S302与前述实施方式中的步骤S101至步骤S102大致相同,在此不再赘述,可以参照前述实施方式的说明。It can be understood that steps S301 to S302 in the text sentiment analysis method proposed in this embodiment are substantially the same as steps S101 to S102 in the foregoing embodiments, and will not be repeated here, and can refer to the descriptions of the foregoing embodiments.
步骤S303:将各个词语输入深度神经依存句法分析模型,获取深度神经依存句法分析模型在编码阶段产生的隐藏状态表示。Step S303: Input each word into the deep neural-dependent syntactic analysis model, and obtain the hidden state representation generated by the deep neural-dependent syntactic analysis model in the encoding stage.
在本实施方式中,将目标文本中的各个词语输入深度神经依存句法分析模型,获取深度神经依存句法分析模型在编码阶段产生的隐藏状态表示。In this embodiment, each word in the target text is input into the deep neural-dependent syntactic analysis model, and the hidden state representation generated by the deep neural-dependent syntactic analysis model in the encoding stage is obtained.
步骤S304:将隐藏状态表示经由线性映射层映射后得到各个词语的隐式依存句法结构信息表示。Step S304: Map the hidden state representation through the linear mapping layer to obtain the implicit dependency syntax structure information representation of each word.
在本步骤中,深度神经依存句法分析模型在编码层产生的三层隐藏状态记作
Figure PCTCN2022136328-appb-000009
其中
Figure PCTCN2022136328-appb-000010
表示目标文本中第n个词在Bi-LSTM网络第l层的隐藏状态,将输出的L层的隐藏状态通过一个线性映射层后得到每个词的最终带有隐式依存句法结构信息的句法感知词表示,记作s={s 1,...,s n},线性映射层的计算公式为,
Figure PCTCN2022136328-appb-000011
其中,W l和b l为固定参数,其可根据实际需要进行灵活的设置,例如通过模型训练的方法进行设置,l为Bi-LSTM网络中的任意一层,L为Bi-LSTM网络的总层数。即在本步骤中,对目标文本的三层隐藏状态进行线性映射后将映射结果进行累加,从而得到文本中每个词最终带有隐式依存句法结构信息的句法感知词表示。
In this step, the three-layer hidden state generated by the deep neural dependency parsing model in the encoding layer is denoted as
Figure PCTCN2022136328-appb-000009
in
Figure PCTCN2022136328-appb-000010
Represents the hidden state of the nth word in the target text in the first layer of the Bi-LSTM network, and passes the hidden state of the output L layer through a linear mapping layer to obtain the final syntax of each word with implicitly dependent syntactic structure information Perceptual word representation, denoted as s={s 1 ,...,s n }, the calculation formula of the linear mapping layer is,
Figure PCTCN2022136328-appb-000011
Among them, W l and b l are fixed parameters, which can be set flexibly according to actual needs, for example, through model training, l is any layer in the Bi-LSTM network, and L is the total number of Bi-LSTM networks. layers. That is, in this step, the three-layer hidden state of the target text is linearly mapped and the mapping results are accumulated to obtain a syntax-aware word representation with implicitly dependent syntactic structure information for each word in the text.
步骤S305:将各个词语的词向量表示和隐式依存句法结构信息表示拼接、得到输入 矩阵。Step S305: Concatenate the word vector representation of each word and the implicit dependency syntax structure information representation to obtain the input matrix.
步骤S306:将输入矩阵输入属性情感分析模型,得到目标文本的属性情感分类。Step S306: Input the input matrix into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text.
可以理解的是,本实施方式所提的文本情感分析方法中的步骤S305至步骤S306与前述实施方式中的步骤S104至步骤S105大致相同,在此不再赘述,可以参照前述实施方式的说明。It can be understood that steps S305 to S306 in the text sentiment analysis method proposed in this embodiment are substantially the same as steps S104 to S105 in the foregoing embodiments, and will not be repeated here, and can refer to the descriptions of the foregoing embodiments.
本实施方式在保留前述实施方式的技术效果的同时,将对目标文本的三层隐藏状态进行线性映射后将映射结果进行累加,可以使得目标文本中每个词最终带有隐式依存句法结构信息的句法感知词表示的结果更为精准,从而进一步的提升了最终的文本情感分析结果的精准度。In this embodiment, while retaining the technical effects of the foregoing embodiments, the three-layer hidden state of the target text is linearly mapped and then the mapping results are accumulated, so that each word in the target text finally has implicitly dependent syntactic structure information The result of the syntax-aware word representation is more accurate, which further improves the accuracy of the final text sentiment analysis result.
上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包含相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。The division of the steps of the above methods is only for the sake of clarity of description. During implementation, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this patent. ; Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but not changing the core design of the algorithm and process are all within the scope of protection of this patent.
本申请一种实施方式涉及一种文本情感分析装置,如图6所示,包括:至少一个处理器401;以及,与至少一个处理器401通信连接的存储器402;其中,存储器402存储有可被至少一个处理器401执行的指令,指令被至少一个处理器401执行,以使至少一个处理器401能够执行如前述实施方式所提供的文本情感分析方法。One embodiment of the present application relates to a text sentiment analysis device, as shown in FIG. 6 , including: at least one processor 401; and a memory 402 communicatively connected to at least one processor 401; Instructions executed by at least one processor 401 , the instructions are executed by at least one processor 401 , so that at least one processor 401 can execute the text sentiment analysis method provided in the foregoing embodiments.
其中,存储器402和处理器401采用总线方式连接,总线可以包括任意数量的互联的总线和桥,总线将一个或多个处理器401和存储器402的各种电路连接在一起。总线还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路连接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口在总线和收发机之间提供接口。收发机可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器401处理的数据通过天线在无线介质上进行传输,天线还接收数据并将数据传送给处理器401。Wherein, the memory 402 and the processor 401 are connected by a bus, and the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors 401 and various circuits of the memory 402 together. The bus may also connect together various other circuits such as peripherals, voltage regulators, and power management circuits, all of which are well known in the art and therefore will not be further described herein. The bus interface provides an interface between the bus and the transceivers. A transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing means for communicating with various other devices over a transmission medium. The data processed by the processor 401 is transmitted on the wireless medium through the antenna, and the antenna also receives the data and transmits the data to the processor 401 .
处理器401负责管理总线和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器402可以被用于存储处理器401在执行操作时所使用的数据。Processor 401 is responsible for managing the bus and general processing, and may also provide various functions including timing, peripheral interface, voltage regulation, power management, and other control functions. And the memory 402 may be used to store data used by the processor 401 when performing operations.
本申请一种实施方式涉及一种计算机可读存储介质,存储有计算机程序。计算机程 序被处理器执行时实现前述实施方式所提供的文本情感分析方法。An embodiment of the present application relates to a computer-readable storage medium storing a computer program. When the computer program is executed by the processor, the text sentiment analysis method provided in the foregoing embodiments is realized.
即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be completed by instructing related hardware through a program, the program is stored in a storage medium, and includes several instructions to make a device ( It may be a single-chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .
本申请实施方式提供一种文本情感分析方法、装置及计算机可读存储介质,使得文本情感分析结果的准确度提高。Embodiments of the present application provide a text sentiment analysis method, device, and computer-readable storage medium, so that the accuracy of text sentiment analysis results can be improved.
根据本申请实施方式,对于目标文本中的各个词语,通过获取各个词语的词向量表示和隐式依存句法结构信息表示,直接将各个所述词语的所述词向量表示和所述隐式依存句法结构信息表示拼接后得到输入矩阵,将输入矩阵输入属性情感分析模型从而得到目标文本的属性情感分类,这一过程中没有直接对最佳依存句法树进行建模,而是使用目标文本的隐式依存句法结构信息表示输入到属性情感分析模型中进行情感分析,不仅提高了属性情感分析模型在属性级情感分析数据集上的效果,而且可以减少因依存句法树带来的误差传播问题,提升对目标文本的属性级情感分析效果。According to the embodiment of the present application, for each word in the target text, by obtaining the word vector representation and implicit dependency syntax structure information representation of each word, the word vector representation of each word and the implicit dependency syntax Structural information indicates that the input matrix is obtained after splicing, and the input matrix is input into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text. In this process, the optimal dependency syntax tree is not directly modeled, but the implicit structure of the target text is used. Dependent syntactic structure information is input into the attribute sentiment analysis model for sentiment analysis, which not only improves the effect of the attribute sentiment analysis model on the attribute-level sentiment analysis data set, but also reduces the error propagation problem caused by the dependency syntax tree, and improves the performance of the attribute sentiment analysis model. Attribute-Level Sentiment Analysis Effects on Target Text.
本领域的普通技术人员可以理解,上述各实施方式是实现本申请的若干实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。Those of ordinary skill in the art can understand that the above-mentioned embodiments are several embodiments of the present application, and in practical applications, various changes can be made in form and details without departing from the spirit and spirit of the present application. scope.

Claims (10)

  1. 一种文本情感分析方法,包括:A text sentiment analysis method, comprising:
    获取目标文本中的各个词语;Obtain each word in the target text;
    获取所述各个词语的词向量表示;Obtain the word vector representation of each word;
    获取所述各个词语的隐式依存句法结构信息表示;Obtaining the implicit dependency syntax structure information representation of each word;
    将各个所述词语的所述词向量表示和所述隐式依存句法结构信息表示拼接,得到输入矩阵;splicing the word vector representation of each of the words and the implicit dependency syntactic structure information representation to obtain an input matrix;
    将所述输入矩阵输入属性情感分析模型,得到所述目标文本的属性情感分类。Inputting the input matrix into the attribute sentiment analysis model to obtain the attribute sentiment classification of the target text.
  2. 根据权利要求1所述的文本情感分析方法,其中,所述获取所述各个词语的隐式依存句法结构信息表示,包括:The text sentiment analysis method according to claim 1, wherein said acquisition of the implicit dependency syntax structure information representation of each word comprises:
    将所述目标文本输入深度神经依存句法分析模型,获取所述深度神经依存句法分析模型在编码阶段产生的隐藏状态表示,根据所述隐藏状态表示获取所述各个词语的隐式依存句法结构信息表示。Input the target text into the deep neural dependency syntactic analysis model, obtain the hidden state representation generated by the deep neural dependency syntactic analysis model in the encoding stage, and obtain the implicit dependency syntactic structure information representation of each word according to the hidden state representation .
  3. 根据权利要求2所述的文本情感分析方法,其中,所述获取所述深度神经依存句法分析模型在编码阶段产生的隐藏状态表示,包括:The text sentiment analysis method according to claim 2, wherein said acquisition of the hidden state representation produced by the deep neural dependency syntax analysis model in the encoding stage comprises:
    经由三层双向长短时记忆网络对所述目标文本进行编码处理,得到所述隐藏状态表示。The target text is encoded through a three-layer bidirectional long-short-term memory network to obtain the hidden state representation.
  4. 根据权利要求3所述的文本情感分析方法,其中,所述根据所述隐藏状态表示获取所述各个词语的隐式依存句法结构信息表示,包括:The text sentiment analysis method according to claim 3, wherein said obtaining the implicit dependency syntax structure information representation of each word according to said hidden state representation comprises:
    将所述隐藏状态表示经由线性映射层映射后得到所述各个词语的隐式依存句法结构信息表示。The hidden state representation is mapped through a linear mapping layer to obtain the implicit dependency syntax structure information representation of each word.
  5. 根据权利要求4所述的文本情感分析方法,其中,所述将所述隐藏状态表示经由线性映射层映射后得到所述各个词语的隐式依存句法结构信息表示,包括:The text sentiment analysis method according to claim 4, wherein the implicitly dependent syntactic structure information representation of each word is obtained after the hidden state representation is mapped through a linear mapping layer, including:
    将所述隐藏状态表示的不同层级分别经由所述线性映射层映射,得到多个映射结果,将所述多个映射结果累加得到所述各个词语的隐式依存句法结构信息表示。Map different levels of the hidden state representation through the linear mapping layer to obtain multiple mapping results, and accumulate the multiple mapping results to obtain the implicit dependency syntax structure information representation of each word.
  6. 根据权利要求1所述的文本情感分析方法,其中,所述将所述输入矩阵输入属 性情感分析模型,得到所述目标文本的属性情感分类,包括:The text sentiment analysis method according to claim 1, wherein, the described input matrix input attribute sentiment analysis model, obtains the attribute sentiment classification of the target text, comprising:
    根据所述输入矩阵获取所述目标文本中的属性词;Obtaining attribute words in the target text according to the input matrix;
    利用注意力机制提取与所述属性词相关的上下文信息;Utilize the attention mechanism to extract the contextual information relevant to the described attribute words;
    根据所述上下文信息得到所述目标文本的属性情感分类。The attribute sentiment classification of the target text is obtained according to the context information.
  7. 根据权利要求6所述的文本情感分析方法,其中,所述根据所述输入矩阵获取所述各个词语中的属性词,包括:The text sentiment analysis method according to claim 6, wherein said obtaining attribute words in said respective words according to said input matrix comprises:
    将所述输入矩阵通过属性掩码层,根据所述属性掩码层的输出矩阵获取所述属性词。passing the input matrix through an attribute mask layer, and obtaining the attribute words according to an output matrix of the attribute mask layer.
  8. 根据权利要求7所述的文本情感分析方法,其中,所述利用注意力机制提取与所述属性词相关的上下文信息,包括:The text sentiment analysis method according to claim 7, wherein said utilizing attention mechanism to extract contextual information relevant to said attribute word comprises:
    将所述输入矩阵和所述输出矩阵进行注意力操作,获取与所述属性词相关的上下文信息。performing an attention operation on the input matrix and the output matrix to obtain context information related to the attribute word.
  9. 一种文本情感分析装置,包括:A text sentiment analysis device, comprising:
    至少一个处理器;以及,at least one processor; and,
    与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至8中任一所述的文本情感分析方法。The memory is stored with instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can perform any one of claims 1 to 8 text sentiment analysis method.
  10. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至8中任一项所述的文本情感分析方法。A computer-readable storage medium storing a computer program, which implements the text sentiment analysis method according to any one of claims 1 to 8 when the computer program is executed by a processor.
PCT/CN2022/136328 2021-12-07 2022-12-02 Text sentiment analysis method and device, and computer-readable storage medium WO2023103914A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111486407.6A CN114201957A (en) 2021-12-07 2021-12-07 Text emotion analysis method and device and computer readable storage medium
CN202111486407.6 2021-12-07

Publications (1)

Publication Number Publication Date
WO2023103914A1 true WO2023103914A1 (en) 2023-06-15

Family

ID=80651070

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/136328 WO2023103914A1 (en) 2021-12-07 2022-12-02 Text sentiment analysis method and device, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN114201957A (en)
WO (1) WO2023103914A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114201957A (en) * 2021-12-07 2022-03-18 中兴通讯股份有限公司 Text emotion analysis method and device and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107330032A (en) * 2017-06-26 2017-11-07 北京理工大学 A kind of implicit chapter relationship analysis method based on recurrent neural network
CN113361617A (en) * 2021-06-15 2021-09-07 西南交通大学 Aspect level emotion analysis modeling method based on multivariate attention correction
CN113378547A (en) * 2021-06-16 2021-09-10 武汉大学 GCN-based Chinese compound sentence implicit relation analysis method and device
US20210390261A1 (en) * 2020-06-11 2021-12-16 East China Jiaotong University Data processing method, electronic device, and storage medium
CN114201957A (en) * 2021-12-07 2022-03-18 中兴通讯股份有限公司 Text emotion analysis method and device and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107330032A (en) * 2017-06-26 2017-11-07 北京理工大学 A kind of implicit chapter relationship analysis method based on recurrent neural network
US20210390261A1 (en) * 2020-06-11 2021-12-16 East China Jiaotong University Data processing method, electronic device, and storage medium
CN113361617A (en) * 2021-06-15 2021-09-07 西南交通大学 Aspect level emotion analysis modeling method based on multivariate attention correction
CN113378547A (en) * 2021-06-16 2021-09-10 武汉大学 GCN-based Chinese compound sentence implicit relation analysis method and device
CN114201957A (en) * 2021-12-07 2022-03-18 中兴通讯股份有限公司 Text emotion analysis method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN114201957A (en) 2022-03-18

Similar Documents

Publication Publication Date Title
US10360308B2 (en) Automated ontology building
AU2018261160B2 (en) Systems and methods of applying pragmatics principles for interaction with visual analytics
US9773053B2 (en) Method and apparatus for processing electronic data
US20210303558A1 (en) Applying Natural Language Pragmatics in a Data Visualization User Interface
US11010396B1 (en) Data visualization user interface using cohesion of sequential natural language commands
KR20050033420A (en) Method and apparatus for identifying semantic structures from text
US20080208566A1 (en) Automated word-form transformation and part of speech tag assignment
JP7286810B2 (en) Text intelligent cleaning method, apparatus and computer readable storage medium
US10795902B1 (en) Applying natural language pragmatics in a data visualization user interface
US11704326B2 (en) Generalization processing method, apparatus, device and computer storage medium
US11726997B2 (en) Multiple stage filtering for natural language query processing pipelines
US20220414463A1 (en) Automated troubleshooter
CN111508502A (en) Transcription correction using multi-tag constructs
US20230094730A1 (en) Model training method and method for human-machine interaction
CN108536735A (en) Multi-modal lexical representation method and system based on multichannel self-encoding encoder
WO2023103914A1 (en) Text sentiment analysis method and device, and computer-readable storage medium
CN114281968A (en) Model training and corpus generation method, device, equipment and storage medium
CN113779062A (en) SQL statement generation method and device, storage medium and electronic equipment
CN110717014B (en) Ontology knowledge base dynamic construction method
US20230325384A1 (en) Interactive assistance for executing natural language queries to data sets
CN108319586B (en) Information extraction rule generation and semantic analysis method and device
WO2023060633A1 (en) Relationship extraction method and apparatus for enhancing semantics, and computer device and storage medium
US11726994B1 (en) Providing query restatements for explaining natural language query results
US20130339003A1 (en) Assisted Free Form Decision Definition Using Rules Vocabulary
KR20230065017A (en) Apparatus and method for generating summary of program source code based on ai analysis

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22903336

Country of ref document: EP

Kind code of ref document: A1