A sentence sentiment analysis method, device, equipment and storage medium

By using entity recognition and relation extraction models, the entities and relationships of comment statements are obtained, solving the problem of incomplete information in existing technologies and achieving efficient sentiment analysis.

CN115358238BActive Publication Date: 2025-12-09SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210986049.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-16
Publication Date
2025-12-09
Estimated Expiration
2042-08-16

AI Technical Summary

Technical Problem

Existing technologies lack comprehensive information in fine-grained sentiment analysis, affecting the comprehensiveness and efficiency of sentence sentiment analysis.

Method used

The entity information of the comment statement is obtained by using an entity recognition model, including the commenter, the comment object, and the statement. The relation tuples of the relationship are obtained by using a relation extraction model, thereby determining the sentiment information of the comment statement.

Benefits of technology

It enables comprehensive sentiment analysis of comment statements, improves the efficiency of sentiment analysis, and reduces the need for secondary information processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115358238B_ABST
    Figure CN115358238B_ABST
Patent Text Reader

Abstract

The application discloses a kind of sentence sentiment analysis method, device, equipment and storage medium.The entity recognition model is used to carry out entity recognition to the comment sentence to be measured, and the entity of sentence is obtained, and the expression sentence contains sentiment tendency;Each sentence entity is carried out relationship extraction to obtain relationship tuple;According to relationship tuple, the sentiment information of the comment sentence to be measured is determined.Through entity model, the entity of the comment sentence to be measured is identified, and the entity of the comment sentence, the comment object and the expression sentence containing sentiment tendency can be directly obtained, so that the entity information obtained is more comprehensive, and the sentence entity containing correlation is obtained by relationship extraction to the sentence entity, and the sentiment information of the comment sentence to be measured is determined based on relationship tuple, so that not only the sentiment of the sentence can be analyzed comprehensively, and the efficiency of the sentence sentiment analysis is improved since secondary processing of information is not required.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, and in particular to a sentence sentiment analysis method, device and equipment and storage medium. BACKGROUND

[0002] In the information explosion era of the Internet, e-commerce is gradually changing people's work and life, and major e-commerce platforms have become the main sales channels for various goods. E-commerce websites usually allow customers to comment on the goods they purchase, and in these comments, there are evaluations of consumer product attributes and emotional opinions. In order to better understand the actual evaluation and improve product services, sentiment analysis needs to be performed on the comment sentences.

[0003] Currently, fine-grained sentiment analysis generally targets one or two sub-tasks in aspect information, sentiment polarity judgment and opinion extraction, so the extracted information is not comprehensive enough. If more comprehensive fine-grained sentiment information is needed, the remaining information in sentiment analysis needs to be derived based on the extracted information, which not only affects the comprehensiveness of sentence sentiment analysis but also affects the efficiency of sentence sentiment analysis. SUMMARY

[0004] The present application provides a sentence sentiment analysis method, device, equipment and storage medium to realize comprehensive sentiment analysis and analysis efficiency of the to-be-tested comment sentence.

[0005] According to an aspect of the present application, a sentence sentiment analysis method is provided, comprising: performing entity recognition on a to-be-tested comment sentence through an entity recognition model to obtain sentence entities, wherein the sentence entities include a comment issuer, a comment object and a statement sentence, and the statement sentence contains a sentiment tendency;

[0006] Performing relationship extraction on each of the sentence entities to obtain a relationship tuple, wherein the relationship tuple contains sentence entities having an association relationship;

[0007] Determining sentiment information of the to-be-tested comment sentence according to the relationship tuple.

[0008] According to another aspect of the present application, a sentence sentiment analysis device is provided, comprising: a sentence entity acquisition module configured to perform entity recognition on a to-be-tested comment sentence through an entity recognition model to obtain sentence entities, wherein the sentence entities include a comment issuer, a comment object and a statement sentence, and the statement sentence contains a sentiment tendency;

[0009] A relationship tuple acquisition module configured to perform relationship extraction on each of the sentence entities to obtain a relationship tuple, wherein the relationship tuple contains sentence entities having an association relationship;

[0010] determining a sentiment information of the to-be-tested review sentence according to the relation tuple.

[0011] According to another aspect of the present application, an electronic device is provided, which comprises:

[0012] at least one processor; and

[0013] a memory connected with the at least one processor in communication; wherein,

[0014] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method according to any one of the embodiments of the present application.

[0015] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the method according to any one of the embodiments of the present application when executed.

[0016] The technical solution of the embodiments of the present application can directly obtain the entity review issuer, the review object and the expression sentence containing the sentiment tendency of the review sentence by performing entity recognition on the to-be-tested review sentence through the entity model, so that the obtained entity information is more comprehensive, and the sentence entities containing the existing correlation can be obtained by performing relation extraction on the sentence entities, and the sentiment information of the to-be-tested review sentence is determined based on the relation tuple, so that the review sentence can be comprehensively analyzed, and the efficiency of the review sentence sentiment analysis is improved due to the fact that the information does not need to be processed twice.

[0017] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0019] Figure 1 is a flowchart of a sentence sentiment analysis method provided according to an embodiment of the present application;

[0020] Figure 2is a flow chart of another sentence sentiment analysis method provided according to an embodiment of the present application;

[0021] Figure 3 is a flow chart of a sentence sentiment analysis method provided according to an embodiment two of the present application;

[0022] Figure 4 is a structural schematic diagram of a sentence sentiment analysis device provided according to an embodiment three of the present application;

[0023] Figure 5 is a structural schematic diagram of an electronic device provided according to an embodiment four of the present application. DETAILED DESCRIPTION

[0024] In order to make the person skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0025] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0026] Embodiment one

[0027] Figure 1 A flow chart of a sentence sentiment analysis method is provided for the embodiment one of the present application. The present embodiment can be applied to the case of analyzing the sentiment of a sentence. The method can be executed by a sentence sentiment analysis device, which can be realized in the form of hardware and / or software. As shown in the figure, the method comprises: Figure 1

[0028] In step S101, the entity recognition model is used to perform entity recognition on the to-be-tested review sentence to obtain the sentence entity.

[0029] ​Optionally, before the entity recognition model is used to recognize the entities in the to-be-tested review sentence, the method further includes: obtaining a sample review sentence, wherein the sample review sentence is marked with sample sentence entities matching the review sentence; and training the model using the sample review sentence to obtain the entity recognition model.

[0030] Specifically, in this embodiment, fine-grained sentiment information extraction technology is mainly used to extract structured sentiment information from the review information of the user, including the reviewer, the review object, the expression sentence and the sentiment tendency, wherein the sentiment tendency is attached to the expression sentence, and the reviewer, the review object and the expression sentence are regarded as sentence entities. In this embodiment, the entity recognition model is used to recognize the entities in the to-be-tested review sentence, and before the entity extraction, the model is trained using sample reviews to obtain the entity recognition model. During the model training, the sample review sentence is obtained, and the sample review sentence is marked with sample sentence entities matching the review sentence. For example, in the sample review sentence "Xiaoming says that this restaurant must be given a good review", "Xiaoming" is marked as the reviewer, "restaurant" is marked as the review object, and "good review" is marked as the expression sentence. Since the expression sentence is divided into three categories: positive expression sentence, neutral expression sentence and negative expression sentence, and "good review" is a positive expression sentence, the sentiment tendency can be determined as positive through the expression sentence, so that the extraction task of the four-tuple is converted into the extraction task of the three-tuple, which is consistent with the common sense that the sentiment tendency of the review is generally reflected by the expression sentence of the review. Of course, this embodiment only uses a sample review sentence containing a positive expression sentence as an example, and in actual application, a large number of marked review sentences are generally required, such as sample review sentences containing neutral expression sentences and sample review sentences containing negative expression sentences. The number and type of sample review sentences are not limited in this embodiment. The model is trained using the obtained sample review sentence to obtain the entity recognition model.

[0031] Optionally, the entity recognition model is used to recognize the entities in the to-be-tested review sentence, including: performing denoising processing on the to-be-tested review sentence to obtain a processed to-be-tested review sentence; and using the entity recognition model to recognize the processed to-be-tested review sentence to obtain the sentence entities.

[0032] Specifically, in this embodiment, upon obtaining a comment statement to be tested, such as "The environment is excellent; my friend said this cinema deserves a five-star review," an entity recognition model is used to identify the comment statement. The obtained statement entities include five entities: "environment," "excellent," "friend," "cinema," and "five-star review." Among them, "friend" is the commenter, "environment" and "cinema" are the objects of the comment, and "excellent" and "five-star review" are positive statements, containing a positive sentiment. Of course, this embodiment is merely an example and does not limit the content and number of obtained statement entities.

[0033] It should be noted that if no descriptive statements are identified in the comment to be tested, no further relationship determination is needed. Conversely, if no descriptive statements are identified in the comment, but the commenter or the recipient is identified, then the entity recognition model has made an error, and no further relationship determination is necessary. Furthermore, for cases of recognition errors, the comment to be tested can be collected as examples, and the reasons for the errors can be analyzed. Based on the analysis results, the entity recognition model can be optimized to improve its subsequent recognition performance.

[0034] Step S102: Extract relational tuples from each statement entity.

[0035] Among them, such as Figure 2 The diagram shown is a flowchart of another sentiment analysis method in this embodiment. Figure 2 The following provides a detailed explanation of step S102, which may include steps S1021-S1023:

[0036] Step S1021: Determine whether the number of statement entities is the specified value. If yes, proceed to step S1022; otherwise, proceed to step S1023.

[0037] Specifically, this implementation uses different methods to obtain relation tuples based on the number of statement entities. Each relation tuple contains statement entities with related relationships. For example, when the number of statements is determined to be one, or when the number of statements is greater than one but the number of commenters or comment recipients is one, relation extraction is directly performed on each statement entity to obtain relation tuples. However, when the number of statements is greater than one, and the total number of commenters or comment recipients is greater than one, the relationships between entities are more complex. Therefore, a pre-trained relation extraction model is needed to extract relations from each statement entity to obtain relation tuples.

[0038] Step S1022: Directly establish the relationship between the commenter, the comment object, and the statement to obtain the relation tuple.

[0039] Optionally, the association relationship between the comment issuer, the comment object and the expression sentence is directly established, including: when the number of expression sentences is one, an association relationship between one expression sentence and the comment issuer and the comment object is directly established; or when the number of expression sentences is greater than one, but the number of comment issuers or comment objects is one, an association relationship between each expression sentence and one comment issuer or comment object is directly established.

[0040] In one specific implementation, when the identified sentence entity includes one positive expression sentence "very clear", one comment issuer "Xiaohong" and one comment object "course", the positive expression sentence can be directly associated with the comment issuer and the comment object to obtain a relationship tuple (Xiaohong, course, very clear, positive). Of course, the number of identified comment issuers and comment objects is not limited in this embodiment.

[0041] In another specific implementation, when the identified sentence entity includes multiple expression sentences, for example, two positive expression sentences "very clear" and "very good", but only one comment object "course", the two positive expression sentences are both associated with the one comment object to obtain relationship tuples (None, course, very clear, positive) and (None, course, very good, positive). Of course, this embodiment only takes the case of containing one comment object as an example, and the relationship establishment method when there is only one comment issuer is roughly the same, which will not be described in detail in this embodiment.

[0042] In step S1023, the relationship extraction model is used to extract the relationship tuples from the sentence entities.

[0043] Optionally, the sentiment information of the to-be-tested comment sentence is determined according to the relationship tuples, including: obtaining the sentiment tendency contained in the expression sentence of the relationship tuple; and determining the sentiment information of each relationship tuple in the to-be-tested comment sentence according to the sentiment tendency.

[0044] Specifically, when the number of expression sentences in the identified sentence entity is greater than one, and the sum of the number of comment issuers and the number of comment objects is greater than one, the relationship extraction model is used to extract the relationship tuples from the sentence entities. Before the relationship extraction model is used to extract the relationship tuples from the sentence entities, the model needs to be trained to obtain the relationship extraction model, so that the trained relationship extraction model can accurately identify the relationship between the entities, and focus on identifying the association relationship between each expression sentence and the comment issuer and the comment object, i.e., determining who the expression sentence is commented by and who the expression sentence is commented for.

[0045] For example, when the identified sentence entities include five entities of "environment", "very good", "friend", "cinema", and "five-star good comment", wherein the "friend" is the comment issuer, the "environment" and "cinema" are the comment objects, and the "very good" and "five-star good comment" are positive expression sentences, therefore the sentiment tendency contained in the positive expression sentences is positive. Then the relationship tuples obtained by the relationship extraction model for each sentence entity include (None, environment, very good, positive) and (friend, cinema, five-star good comment, positive).

[0046] In step S103, the sentiment information of the to-be-tested comment sentence is determined according to the relationship tuples.

[0047] Specifically, for each to-be-tested comment sentence, the number of relationship tuples obtained by entity recognition and relationship extraction can be multiple, and each relationship tuple contains sentence entities having a correlation relationship, and also contains sentiment tendency in the expression sentence entity. Therefore, the sentiment tendency of the to-be-tested sentence, i.e., whether the sentiment tendency is positive or negative, and the corresponding relationship between the comment issuer and the comment object, i.e., who evaluates which objects, can be determined according to the obtained relationship tuples.

[0048] In the embodiment, after obtaining the relationship tuples, the sentiment information of the to-be-tested comment sentence can be determined according to the relationship tuples. For example, the obtained relationship tuples include (None, environment, very good, positive) and (friend, cinema, five-star good comment, positive), and the sentiment information of the to-be-tested comment sentence can be determined according to the relationship tuples, i.e., the two comment objects "environment" and "cinema" are respectively positively evaluated.

[0049] It should be noted that by performing sentiment analysis on the to-be-tested comment sentence, the relationship between the comment issuer, the comment object, and the expression sentence, and the sentiment tendency and other related sentiment information can be determined, which can facilitate the user to perform subsequent service improvement or product improvement according to the determined sentiment information. Of course, the embodiment is only an example and does not limit the specific application scenarios of the sentence sentiment analysis result. In the embodiment, when performing sentence entity, the comment issuer, the comment object, the expression sentence, and the sentiment tendency and other information can be extracted together by the pre-trained entity recognition model, and the remaining information does not need to be deduced by extracting a small amount of other information, thereby further improving the efficiency of the sentence sentiment analysis.

[0050] The embodiment of the present application can directly obtain the entity comment issuer, the comment object and the expression sentence containing the emotional tendency of the comment sentence through entity recognition on the comment sentence to be tested by the entity model, so that the obtained entity information is more comprehensive, and the sentence entity containing the existing correlation can be obtained through relationship extraction on the sentence entity, and the emotional information of the comment sentence to be tested is determined based on the relationship tuple, so that not only the emotional analysis of the sentence can be comprehensively performed, and the efficiency of the emotional analysis of the sentence is improved due to the fact that the information does not need to be processed twice.

[0051] Embodiment two

[0052] Figure 3 A flowchart of a sentence emotional analysis method provided by the second embodiment of the present application, the present embodiment mainly specifically describes the training process of the relationship extraction model before the relationship extraction model extracts the relationship tuple from each sentence entity in the first embodiment. As shown in the figure, Figure 3 The method comprises the following steps:

[0053] In step S301, an entity relationship data set is obtained.

[0054] The entity relationship data set includes positive example samples of the relationship between the sentence entities and negative example samples of the relationship between the sentence entities. The positive example samples represent that the entities belong to the same tuple, and the negative example samples represent that the entities do not belong to the same tuple. The expression sentence entity, the comment issuer entity and the comment object entity in the same tuple are constructed into a positive example. If the text contains multiple tuples, the expression sentence entity, the comment issuer entity and the comment object entity in other tuples are constructed into a negative example. It needs to be noted that it is necessary to judge whether the entities in other tuples are the same. If the expression sentence entities in two tuples are the same, a negative example cannot be constructed. For example, “the lobby and the room are very clean” contains two tuples: (None, the lobby, very clean, positive) and (None, the room, very clean, positive). If the expression sentence entities in two tuples are different, it is necessary to further judge whether the comment issuer and the comment object are the same. If they are the same, a negative example cannot be constructed. If they are different, a negative example can be constructed. For example, “the environment is very good, and my friend said that this cinema must be given five-star praise.” The entity relationship data set is shown in Table 1.

[0055] Table 1

[0056] Ambience Very good Friends Cinema Five stars Ambience None 1 None None 0 Very good 1 None 0 0 None Friends None 0 None None 1 Cinema None 0 None None 1 Five stars 0 None 1 1 None

[0057] Wherein, None indicates that the relationship between entities does not need to be judged, such as "environment" and "movie theater" are both comment object entities, and no relationship judgment is needed between them; 0 indicates that the relationship between entities is a negative example, and the negative example indicates that the entities do not belong to the same tuple, such as "five-star praise" is the evaluation of "movie theater", and the relationship between "environment" is a negative example; 1 indicates that the relationship between entities is a positive example, and the positive example indicates that the entities belong to the same tuple, such as the relationship between "five-star praise" and "movie theater".

[0058] Step S302, model training is performed through the entity relationship data set to obtain a relationship extraction model.

[0059] Wherein, after the construction of the entity relationship data set is completed, the model training can be performed through the entity relationship data to obtain the relationship extraction model. Here, the pre-trained model is used as a feature extraction tool. Taking "environment is very good, friends say that this movie theater must be given five-star praise" as an example, after completing entity information extraction, the text is processed into "[CLS] <target>Ambience< / target> <expression>Very good< / expression> , <holder>Friends< / holder> say that this <target>Cinema< / target> must be given <expression>Five stars< / expression> ." Wherein [CLS] is the token required by the class BERT pre-training model, and the start and end positions of each entity and the entity category are labeled. h s and h e represent the vector representation at the start and end labels respectively. The entity vector can be represented by two vectors. Here, h s , h e , h s -h e and h s +h e are concatenated as the vector representation of the entity. Then the dot product of the entity vectors is calculated and the sigmoid is used for relationship calculation. Here, cross-entropy is used as the loss function. When calculating the loss function, the mask matrix is used to cover the entity pairs that do not exist. The mask matrix can be obtained from the upper triangular matrix and the positions of the None relationship, so that the relationship extraction model is obtained through the above calculation process.

[0060] It should be noted that in the present embodiment, the vector processing is performed according to the entity relationship data set, the vector operation is performed, and the relationship extraction model is trained by minimizing the loss function. Of course, the present embodiment is only an example and does not limit the specific training process of the relationship extraction model. As long as the relationship extraction model can be accurately obtained, it is within the protection scope of the present application.

[0061] The entity model is used for entity recognition on the to-be-tested comment sentence, so that the entity comment issuer, the comment object and the expression sentence containing the emotional tendency of the comment sentence can be directly obtained, the obtained entity information is more comprehensive, the sentence entity is subjected to relationship extraction, the sentence entities containing the existing correlation relationship can be obtained, and the emotional information of the to-be-tested comment sentence is determined based on the relationship tuple, so that the sentence can be comprehensively subjected to emotional analysis, and the efficiency of the sentence emotional analysis is improved due to the fact that the information is not subjected to secondary processing. The relationship extraction model is obtained by training the model based on the obtained entity relationship data set, so that the obtained relationship extraction model is more accurate, and the accuracy of the relationship tuple is improved.

[0062] Embodiment three

[0063] Figure 4 A structural schematic diagram of a sentence emotional analysis device provided by the embodiment three of the application is shown in FIG. 4. Figure 4 As shown in the figure, the device comprises a sentence entity obtaining module 410, a relationship tuple obtaining module 420 and an emotional information determining module 430.

[0064] The sentence entity obtaining module 410 is configured to obtain the sentence entity by subjecting the to-be-tested comment sentence to entity recognition based on the entity recognition model, wherein the sentence entity comprises the comment issuer, the comment object and the expression sentence, and the expression sentence contains the emotional tendency.

[0065] The relationship tuple obtaining module 420 is configured to obtain the relationship tuple by subjecting the sentence entity to relationship extraction.

[0066] The emotional information determining module 430 is configured to determine the emotional information of the to-be-tested comment sentence based on the relationship tuple.

[0067] Optionally, the device further comprises an entity recognition model training module configured to obtain the sample comment sentence, wherein the sample comment sentence is marked with the sample sentence entity matching the comment sentence.

[0068] The entity recognition model is obtained by training the model based on the sample comment sentence.

[0069] Optionally, the sentence entity obtaining module is configured to perform denoising processing on the to-be-tested comment sentence to obtain the processed to-be-tested comment sentence.

[0070] The sentence entity is obtained by subjecting the processed to-be-tested comment sentence to recognition based on the entity recognition model.

[0071] Optionally, the relationship tuple obtaining module is configured to determine whether the number of the sentence entities is a specified value, and if yes, the correlation relationship among the comment issuer, the comment object and the expression sentence is directly established to obtain the relationship tuple.

[0072] Otherwise, the relationship tuples are obtained by performing relationship extraction on the entities of each sentence through the relationship extraction model.

[0073] Optionally, the relationship tuple obtaining module is configured to, when the number of expression sentences is one, directly establish an association relationship between the expression sentence and the comment issuer and the comment object.

[0074] Alternatively,

[0075] When the number of expression sentences is greater than one, but the number of comment issuers or comment objects is one, an association relationship is directly established between each expression sentence and one comment issuer or comment object.

[0076] Optionally, the device further comprises a relationship extraction model training module configured to obtain an entity relationship data set, wherein the entity relationship data set comprises positive samples of the existence of a relationship between sentence entities and negative samples of the non-existence of a relationship between sentence entities.

[0077] The relationship extraction model is obtained by training the model through the entity relationship data set.

[0078] Optionally, the sentiment information determining module is configured to obtain the sentiment tendency contained in the expression sentence of the relationship tuple.

[0079] The sentiment information of each relationship tuple in the to-be-tested comment sentence is determined according to the sentiment tendency.

[0080] The sentence sentiment analysis device provided in the embodiments of the present application can execute the sentence sentiment analysis method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.

[0081] Embodiment 5

[0082] Figure 5 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.

[0083] As Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded into the random access memory (RAM) 13 from the storage unit 18. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0084] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0085] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the sentence sentiment analysis method.

[0086] In some embodiments, the sentence sentiment analysis method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the sentence sentiment analysis method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the sentence sentiment analysis method by any other appropriate means, such as by means of firmware.

[0087] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0088] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine or entirely on a remote machine or server.

[0089] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0090] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0091] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0092] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0093] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in sequence, or executed in a different order, as long as the desired results of the present disclosure are achieved, and the present disclosure is not limited herein.

[0094] The specific embodiments described above are not intended to be limiting, and persons skilled in the art will appreciate that various modifications, combinations, sub-combinations and alternatives can be made to the specific embodiments without departing from the spirit and principles of the disclosure. Accordingly, the disclosure is not limited to the specific embodiments described above, but only by the scope of the appended claims.

Claims

1. A method for sentence sentiment analysis, characterized in that, The method comprises the following steps: performing entity recognition on the to-be-tested comment sentence by an entity recognition model to obtain sentence entities, wherein the sentence entities include a comment issuer, a comment object, and a statement sentence, and the statement sentence contains an emotional tendency; performing relationship extraction on each of the sentence entities to obtain a relationship tuple, wherein the relationship tuple contains sentence entities having a correlation relationship; determining emotional information of the to-be-tested comment sentence according to the relationship tuple; the relationship extraction on each of the sentence entities to obtain the relationship tuple comprises: determining whether the number of the sentence entities is a specified value, if yes, directly establishing a correlation relationship among the comment issuer, the comment object, and the statement sentence to obtain the relationship tuple, otherwise, performing relationship extraction on each of the sentence entities by a relationship extraction model to obtain the relationship tuple; the directly establishing a correlation relationship among the comment issuer, the comment object, and the statement sentence comprises: when the number of the statement sentences is one, directly establishing a correlation relationship between one of the statement sentences and the comment issuer and the comment object; or, when the number of the statement sentences is greater than one, but the number of the comment issuers or the comment objects is one, directly establishing a correlation relationship between each of the statement sentences and one of the comment issuers or the comment objects.

2. The method of claim 1, wherein, Before the entity recognition on the to-be-tested comment sentence by the entity recognition model to obtain the sentence entities, the method further comprises: obtaining a sample comment sentence, wherein the sample comment sentence is labeled with sample sentence entities matching the comment sentence; training a model by using the sample comment sentence to obtain the entity recognition model.

3. The method of claim 1, wherein, The entity recognition on the to-be-tested comment sentence by the entity recognition model to obtain the sentence entities comprises: performing denoising processing on the to-be-tested comment sentence to obtain a processed to-be-tested comment sentence; performing recognition on the processed to-be-tested comment sentence by the entity recognition model to obtain the sentence entities.

4. The method of claim 1, wherein, Before the relationship extraction on each of the sentence entities by the relationship extraction model to obtain the relationship tuple, the method further comprises: obtaining an entity relationship data set, wherein the entity relationship data set includes positive samples of sentence entities having a relationship and negative samples of sentence entities not having a relationship; training a model by using the entity relationship data set to obtain the relationship extraction model.

5. The method of claim 1, wherein, The determination of the emotional information of the to-be-tested comment sentence according to the relationship tuple comprises: obtaining an emotional tendency contained in a statement sentence of the relationship tuple; determining emotional information of each of the relationship tuples in the to-be-tested comment sentence according to the emotional tendency.

6. A device for sentiment analysis of a sentence, the device comprising: The method comprises the following steps: a sentence entity obtaining module is configured to perform entity recognition on a to-be-tested comment sentence by an entity recognition model to obtain sentence entities, wherein the sentence entities include a comment issuer, a comment object, and a statement sentence, and the statement sentence contains an emotional tendency; a relationship tuple obtaining module is configured to perform relationship extraction on each of the sentence entities to obtain a relationship tuple, wherein the relationship tuple contains sentence entities having a correlation relationship; and a relationship tuple determining module is configured to determine emotional information of the to-be-tested comment sentence according to the relationship tuple. The emotional information determination module is configured to determine emotional information of the to-be-tested comment sentence according to the relationship tuple. The relationship tuple acquisition module is configured to determine whether the number of sentence entities is a specified value, and if yes, directly establish an association relationship among the comment issuer, the comment object and the expression sentence to acquire the relationship tuple. Otherwise, the relationship extraction model is used to extract the relationship tuple from each sentence entity. The relationship tuple acquisition module is configured to, when the number of expression sentences is one, directly establish an association relationship among one expression sentence, the comment issuer and the comment object. Alternatively, When the number of expression sentences is greater than one, but the number of comment issuers or comment objects is one, directly establish an association relationship among each expression sentence and one comment issuer or comment object.

7. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to execute the method of any one of claims 1-5 when executed.

Citation Information

Patent Citations

  • Service quality evaluation method and device based on merchant comments, equipment and medium

    CN114037485A