A method and apparatus for processing information

By optimizing the classification model using contrastive learning tools, generating and clustering negative text pairs, and combining the contrastive learning loss to optimize the model, the problem of low recognition accuracy caused by the sentiment polarity drift of negative words is solved, thereby improving the accuracy and efficiency of text sentiment type recognition.

CN116450816BActive Publication Date: 2025-12-19BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210013067.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-06
Publication Date
2025-12-19
Estimated Expiration
2042-01-06

AI Technical Summary

Technical Problem

Existing technologies suffer from low accuracy in identifying text sentiment types, especially in dealing with the sentiment polarity shift of negative words. Existing methods such as rule reversal and annotation enhancement have failed to effectively solve the problem of low accuracy in identifying unannotated negative sentences.

Method used

A contrastive learning tool is used to optimize the classification model. By generating pairs of negative and non-negative texts, clustering and deduplication are performed using a general sentence encoding model. The contrastive learning loss is then combined to optimize the classification model and improve the model's ability to distinguish negative texts.

Benefits of technology

It improves the accuracy of text sentiment type recognition, reduces annotation costs, overcomes the problem of low recognition rate caused by negative sentiment polarity drift, and improves the efficiency and accuracy of information processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116450816B_ABST
    Figure CN116450816B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for processing information, and relates to the field of artificial intelligence. A specific embodiment of the method comprises the following steps: determining a target classification model by using a contrast learning tool; identifying the sentiment type of to-be-processed information by using the target classification model; and processing the to-be-processed information according to the identified sentiment type, so that the accuracy of the sentiment type corresponding to the processed information is improved, and thus the efficiency and accuracy of the processed information are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of artificial intelligence, and in particular to a method and device for processing information. BACKGROUND

[0002] Internet applications usually provide users with the function of submitting feedback information, and the provider of the application can improve the user experience of the application by processing user feedback information, and can also achieve evaluation of target objects by identifying the emotional type contained in the feedback information of the target objects.

[0003] When identifying the emotional type (for example: positive emotion or negative emotion) from the feedback information, since there is no complete corresponding relationship between negative words and negative emotions in the emotional type, using the existing classification model often causes the problem of low accuracy in identifying the emotional type. SUMMARY

[0004] Therefore, the embodiments of the present application provide a method and device for processing information, which can determine a target classification model by using a contrast learning tool, identify the emotional type of the information to be processed by using the target classification model, and process the information to be processed according to the identified emotional type, thereby improving the accuracy of the emotional type corresponding to the processed information, and improving the efficiency and accuracy of the processed information.

[0005] To achieve the above-mentioned purpose, according to an aspect of an embodiment of the present application, a method for processing information is provided, characterized in that it comprises: determining a target classification model, wherein the target classification model is obtained by optimizing a preset classification model by a preset contrast learning tool combined with training text, and the contrast learning tool is used to add a contrast learning loss to the classification loss of the classification model; receiving information to be processed, and identifying the emotional type of the processed information by using the target classification model; and processing the information to be processed according to the identified emotional type.

[0006] Optionally, the method for processing information further comprises:

[0007] obtaining training original text; selecting negative text containing negative words from the training original text, and generating corresponding non-negative text for the negative text, and forming a text pair by combining the negative text and the corresponding non-negative text; and using a plurality of text pairs to form the training text.

[0008] Optionally, the method for processing information further comprises, after the step of selecting negative text containing negative words from the training original text:

[0009] obtaining a text semantic vector of each of the negative texts by using a general sentence encoding model, clustering each of the negative texts based on distances between a plurality of the text semantic vectors, and forming a plurality of negative text groups;

[0010] For each of the negative text groups, performing: deduplicating text pairs corresponding to negative texts included in the negative text group;

[0011] The training text is composed of the deduplicated text pairs.

[0012] Optionally, the method for processing information, characterized in that the deduplicating the text pairs corresponding to the negative texts included in the negative text group comprises:

[0013] filtering similar negative texts that meet a preset similarity condition from the negative texts;

[0014] removing text pairs corresponding to the similar negative texts.

[0015] Optionally, the method for processing information, characterized in that it further comprises:

[0016] selecting a reference text that does not contain a negative word from the training original texts,

[0017] constructing a text pair with an empty negative text by using the reference text, and adding the text pair with the empty negative text to the training text.

[0018] Optionally, the method for processing information, characterized in that,

[0019] The training text comprises a plurality of text pairs, wherein each of the text pairs is composed of a negative text item and a non-negative text item.

[0020] Further comprising: determining a first text pair input into the classification model;

[0021] For a case where the negative text item of the first text pair is not empty, respectively calculating a first positive vector similarity of the first text pair itself, a negative vector similarity of the first text pair, and second positive vector similarities of the first text pair and a plurality of second text pairs in the training text; inputting the first positive vector similarity, the negative vector similarity, and the second positive vector similarities into the contrast learning tool to obtain a first contrast learning loss of the classification model; and optimizing the classification model by using the contrast learning loss.

[0022] Optionally, the method for processing information, characterized in that,

[0023] The first text pair is calculated for self-negative vector similarity, including: calculating the negative vector similarity of the non-negative text and the corresponding negative text included in the first text pair;

[0024] And / or, the first text pair is calculated for self-vector similarity, including:

[0025] The positive vector similarity of the non-negative text or the negative text in the first text pair is calculated.

[0026] Optionally, the method for processing information, characterized in that, further comprising:

[0027] For the case that the negative text item of the first text pair is empty,

[0028] The third positive vector similarity of the first text pair itself and the fourth positive vector similarity of the text pair and the plurality of second text pairs in the training text are calculated respectively; the third positive vector similarity and the fourth positive vector similarity are input into the contrast learning tool to obtain a second contrast learning loss of the classification model; and the second contrast learning loss is used to optimize the classification model.

[0029] To achieve the above object, according to the second aspect of the embodiment of the present application, a device for processing information is provided, characterized in that, comprising: a determination model module and an emotion recognition module; wherein,

[0030] The determination model module is configured to determine a target classification model, wherein the target classification model is obtained by combining a preset contrast learning tool with a training text to optimize a preset classification model, and the contrast learning tool is configured to add a contrast learning loss to a classification loss of the classification model;

[0031] The emotion recognition module is configured to receive information to be processed, recognize the emotional type of the information to be processed by using the target classification model, and process the information to be processed according to the recognized emotional type.

[0032] To achieve the above object, according to the third aspect of the embodiment of the present application, an electronic device for processing information is provided, characterized in that, comprising: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned methods for processing information.

[0033] To achieve the above object, according to the fourth aspect of the embodiment of the present application, a computer readable medium is provided, which stores a computer program, characterized in that, when the program is executed by a processor, the method of any of the above-mentioned methods for processing information is implemented.

[0034] An embodiment of the above application has the advantages or beneficial effects as follows: a target classification model can be determined by using a contrast learning tool; a sentiment type of to-be-processed information is identified by using the target classification model; and the to-be-processed information is processed according to the identified sentiment type; the accuracy of the sentiment type corresponding to the processed information is improved, thereby improving the efficiency and accuracy of processing the information.

[0035] Further effects of the above non-conventional optional mode will be described in the following in combination with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0036] The accompanying drawings are used to better understand the present application and do not constitute undue limitations on the present application. Among them:

[0037] Figure 1 is a flowchart of a method for processing information provided by an embodiment of the present application;

[0038] Figure 2 is a flowchart of training a target classification model provided by an embodiment of the present application;

[0039] Figure 3 is a structural diagram of a device for processing information provided by an embodiment of the present application;

[0040] Figure 4 is an exemplary system architecture diagram to which embodiments of the present application can be applied;

[0041] Figure 5 is a structural diagram of a computer system of a terminal device or a server suitable for implementing embodiments of the present application. DETAILED DESCRIPTION

[0042] The exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to help understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Also, for the sake of clarity and conciseness, the description below omits the description of well-known functions and structures.

[0043] In processing the text information of an application, a classification model needs to be used to identify the sentiment type contained in the text information for multiple application scenarios, for example, it is necessary to identify whether the evaluation of one or more commodities in an e-commerce application by a user corresponds to positive sentiment or negative sentiment, that is, it is necessary to identify the identified sentiment type of the user feedback text (especially negative sentiment) to further process the corresponding commodity information based on the feedback information. In the process of identifying the sentiment type, there may be a problem of negative sentiment polarity shifting, that is, when a negation word appears in the text, the sentiment category indicated by the text will change, which will cause the problem of inaccurate sentiment recognition; for example, the text contains "earphone has no noise" (positive sentiment) and "earphone has noise" (negative sentiment) respectively, that is, the negation word and the sentiment type do not have a complete corresponding relationship, and because the difference between the negation sentence and the corresponding non-negation sentence is small, the identification of the sentiment type by the deep learning model may cause identification errors, thereby causing the problem of low identification accuracy.

[0044] For the problem of negative sentiment polarity shifting, the existing method currently adopted is to use a set rule to set that if a negation word appears in a short sentence, the sentiment type of the text is reversed; this method reverses the sentiment type of the text through the rule, which will cause some sentences without the problem of negative polarity shifting to be incorrectly identified in terms of sentiment, thereby reducing the accuracy of text sentiment recognition. Alternatively, a method of adding labels to negation sentences is adopted to strengthen the identification of negation sentences by the deep learning model; however, this method cannot fully utilize the difference between negation sentences and non-negation sentences for modeling, and can only improve the identification accuracy of the content of existing negation sentences that have been labeled, and there is a problem of low identification accuracy for new negation texts that have not been labeled.

[0045] In view of this, as shown in the Figure 1 The embodiment of the present application provides a method for processing information, which can include the following steps:

[0046] Step S101: determining a target classification model, wherein the target classification model is obtained by optimizing a preset classification model by a preset contrast learning tool combined with training text, and the contrast learning tool is used to add a contrast learning loss to the classification loss of the classification model.

[0047] Specifically, the target classification model is a model for identifying the sentiment type of the processed information; wherein the processed information can be various types of text information, for example: user evaluation of an application, user evaluation of a commodity associated with an application, after-sales text, customer service text, etc., and the number of processed information can be one hundred thousand or one million; the specific content and quantity of the processed information are not limited by the present application.

[0048] Further, the target classification model is obtained by optimizing a preset classification model by a preset contrast learning tool combined with training texts, the contrast learning tool is used to add a contrast learning loss to a classification loss of the classification model; wherein, the preset classification model can be composed of an encoder and a classifier, the encoder is used to encode text information into a text vector, and the classifier is used to calculate a classification (such as a sentiment type) probability of the text based on the text vector; wherein, the encoder can be based on a convolutional neural network model or a pre-trained BERT (Bidirectional Encoder Representations from Transformers) model, etc., and the classifier can be composed of a fully connected layer and a logistic regression layer (such as a softmax layer); further, the preset classification model can output a probability of a sentiment type of the to-be-processed information to achieve the effect of identifying the sentiment type; and the preset contrast learning tool is a code module (such as a script or a function) encapsulated based on the calculation logic of the classification loss (such as a formula of a classification loss function) and the contrast learning loss (such as a formula of a contrast learning loss function).

[0049] Further, there are two methods to determine the target classification model:

[0050] The first method: select a target classification model from a plurality of classification models that have been trained by a contrast learning tool, as a target classification model for identifying the sentiment type of the text information, that is, to determine the target classification model.

[0051] The second method: take an existing preset classification model as a basis, and optimize the preset classification model by a preset contrast learning tool combined with training texts, the description and steps of optimizing the preset classification model by the preset contrast learning tool combined with the training texts are consistent with the description of steps S201-S204, and will not be repeated here.

[0052] Step S102: receiving to-be-processed information, identifying the sentiment type of the to-be-processed information by the target classification model; and processing the to-be-processed information according to the identified sentiment type.

[0053] Specifically, receiving to-be-processed information, identifying the sentiment type of the to-be-processed information by the determined target classification model; for example, the to-be-processed information is a text "earphone has no noise", and the sentiment type of the text is "positive sentiment" according to the sentiment type probability identified by the target classification model; for another example, the to-be-processed information is a text "earphone has noise", and the sentiment type of the text is "negative sentiment" according to the sentiment type probability identified by the target classification model.

[0054] Further, after identifying the sentiment type, process the information to be processed; the processing methods include, for example: clustering the information corresponding to positive sentiment or negative sentiment; counting the number of information corresponding to negative sentiment based on the information of negative sentiment, and further analyzing the information of the object (such as application, product, video, service, etc.) corresponding to negative sentiment, so as to use the object information to achieve the effect of evaluating the object (such as risk control of product sales, etc.), and it is also possible to analyze the factors (such as reasons, scenarios, etc.) associated with negative sentiment based on the information; thus, by further processing the information of the sentiment type, the user experience of the application can be improved.

[0055] As Figure 2 shown, an embodiment of the present invention provides a method for determining a target classification model, and the method may include the following steps:

[0056] Step S201: Obtain the original training text; select the negative text containing negative words from the original training text, generate the corresponding non - negative text for the negative text, and form a text pair with the negative text and the corresponding non - negative text; use multiple text pairs to form the training text.

[0057] Specifically, for the text for training the target classification model, the original training text can be user evaluations of an application, user evaluations of products associated with the application, after - sales texts, customer service texts, etc. The present invention does not limit the specific form and content of the training text.

[0058] Select the negative text containing negative words from the original training text, and generate the corresponding non - negative text for the negative text; among them, the negative words are, for example: no, not, without, never, non, do not, etc.; among them, the negative text containing negative words is, for example, the negative text describing the earphone (product object) "The earphone has no noise", "The noise is not very loud", "There is no noise at all", "The earphone has no noise", etc.; the negative text containing negative words can be selected from the original training text by using the string matching method of searching for negative word keywords, or by using the method of the Natural Language Processing (NLP) model to select the negative text containing negative words from the original training text.

[0059] Further, the corresponding non-negative text is generated for the negative text, and the corresponding non-negative text of the negative text is the text without containing negative words, for example, the non-negative text generated for the negative text "earphone has no noise" is "earphone has noise"; further, the negative text and the corresponding non-negative text are composed into a text pair, for example, the text pair containing the negative text and the corresponding non-negative text is represented as ("earphone has no noise", "earphone has noise"), ("noise is not very large", "noise is very large"), etc.; further, the plurality of text pairs are used to compose the training text; that is, the training text for training the target classification model is composed of multiple text pairs.

[0060] Preferably, after the negative text containing negation words is selected from the training original file, further comprising: obtaining the text semantic vector of each negative text by using a universal sentence encoding model, clustering each negative text based on the distance between a plurality of text semantic vectors to form a plurality of negative text groups; for each negative text group, performing: deduplicating the text pairs corresponding to the negative texts included in the negative text group; and using the deduplicated text pairs to form the training text. Specifically, in various application scenarios, there is a problem that the similarity of negative texts corresponding to the same object (application, commodity, service, etc.) is high. Moreover, in the process of processing the training text, the sentiment type needs to be labeled for the negative text and the corresponding non-negative text, so the high similarity of the texts increases the labor and time cost of labeling. Therefore, preferably, the text pairs corresponding to the negative texts included in the negative text group are deduplicated (deduplication means removing text pairs that meet the preset similarity condition); and the deduplicated text pairs are used to form the training text; wherein the method for determining the removable negative is: obtaining the text semantic vector of each negative text by using a universal sentence encoding model (Universal Sentence Encoder, USE), clustering each negative text based on the distance between a plurality of text semantic vectors to form a plurality of negative text groups; it can be understood that if the negative texts included in the negative text group have high semantic similarity, it is judged whether the preset semantic similarity threshold is reached, i.e., whether the similar negative texts that meet the preset similarity condition are reached, wherein the semantic similarity is calculated by the distance between the text semantic vectors using the universal sentence encoding model USE, and the clustering model (for example: K-means model) can be used to cluster each negative text by the distance between the text semantic vectors. For example, the negative text group includes: "earphones have no noise", "noise is not very large", "noise is not too large", "there is no noisy sound", etc. After judging that the negative text group includes negative texts that can be deduplicated, the text pairs corresponding to the negative texts included in the negative text group are deduplicated (i.e., the text pairs corresponding to the similar negative texts are removed); and the deduplicated text pairs are used to form the training text; for example: for "earphones have no noise", "noise is not very large", "noise is not too large", "there is no noisy sound", the similar negative texts after deduplication are exemplarily "earphones have no noise" and "there is no noisy sound"; further, based on the deduplicated negative texts, text pairs are generated ("earphones have no noise", "earphones have noise"), ("there is no noisy sound", "there is a little noisy sound"); that is, the similar negative texts that meet the preset similarity condition are selected from each negative text included in the negative text group; and the text pairs corresponding to the similar negative texts are removed.

[0061] Therefore, by generating text pairs (negative text + non-negative text) and removing duplicates for negative text with high similarity, the cost of text pair labeling is reduced, and by labeling the sentiment type of the text pair, the accuracy of the sentiment type corresponding to the training text is improved, thereby overcoming the problem of low recognition rate caused by negative sentiment polarity shifting.

[0062] Step S202: Selecting reference texts not containing negative words from the training original texts, constructing text pairs with empty negative texts using the reference texts, and adding the text pairs with empty negative texts to the training texts.

[0063] Specifically, the training original texts contain multiple texts (i.e., reference texts) not containing negative words, wherein the reference texts can correspond to sentiment types; for example, the reference text "mobile phone is good" represents a positive sentiment, and the reference text "clothes are seriously fading" represents a negative sentiment.

[0064] Further, the reference texts are used to construct text pairs with empty negative texts, for example: the reference text is "mobile phone is good", the constructed text pair with empty negative text is ("", "mobile phone is good"), and the text pair with empty negative text is added to the training texts, and the text pairs composed of negative sentences and non-negative sentences are added to the training texts to train the target classification model through the training texts.

[0065] It can be understood that the order of steps S201 and S202 is only an example, and the order of steps S201 and S202 can be interchanged.

[0066] Step S203: training the target classification model using the training texts: the target classification model is obtained by optimizing a preset classification model using a preset contrast learning tool and training texts, and the contrast learning tool is used to add a contrast learning loss to the classification loss of the classification model.

[0067] Specifically, the target classification model is obtained by optimizing a preset classification model using a preset contrast learning tool and training texts, wherein the preset contrast learning tool is a code module (e.g., a script, a function, etc.) encapsulated by combining the calculation logic code of the classification loss function and the contrast learning loss function; further, the contrast learning tool is used to add a contrast learning loss to the classification loss of the classification model.

[0068] For example, the classification loss of the preset classification model corresponds to formula (1) as follows:

[0069] -y i ·logp i -(1-y i) log(1-p i ) (1)

[0070] The company (1) represents the cross-entropy calculated for each training text by the probability distribution output by the encoder, the classifier, and the true sentiment type label; wherein, p i represents the probability that the training text is identified as any one of the sentiment types, y i represents the label of the sentiment type of the training text (for example: 0 represents negative, 1 represents non-negative).

[0071] Exemplarily, the formula (2) corresponding to the contrastive learning loss is as follows:

[0072]

[0073] Wherein, f is a similarity function, and the formula (3) corresponding to f is as follows:

[0074]

[0075] Wherein, v a ,v b represent the text vectors of a text pair, and f(v i ,v′ i ) in formula (2) corresponds to the positive vector similarity of the first text pair itself; corresponds to the negative vector similarity of the first text pair; f(v i ,v j ) corresponds to the second positive vector similarity of the first text pair and multiple second text pairs in the training text, wherein the second text pair is other than the first text pair in a batch of training text pairs. It can be understood that the first text pair is the training text pair currently input into the target classification model.

[0076] Further, there are two methods for determining the contrastive learning loss of the classification model using the contrastive learning tool:

[0077] The first method: for the case that the negation text item of the first text pair is not empty.

[0078] The training text includes multiple text pairs, each of which is composed of a negation text item and a non-negation text item; further comprising: determining a first text pair input into the classification model; for the case that the negation text item of the first text pair is not empty (the case that the negation text item is not empty is that the text pair contains a negation text and a corresponding non-negation text to form a text pair), then based on the contrastive learning loss shown in formula (2), using the contrastive learning tool to calculate the first positive vector similarity (i.e., f(v i ,v′i ) and the second positive vector similarity of the first text pair and a plurality of second text pairs in the training texts (i.e., f(v ) and the second positive vector similarity of the first text pair and a plurality of second text pairs in the training texts (i.e., f(v i ,v j ), preferably, further calculating the sum of the second positive vector similarity (i.e., ).

[0079] The positive vector similarity is calculated based on the text vectors (v i ,v′ i ) of the text pair, (v i ,v′ i ) represents a pair of text vectors generated by the first text pair itself; for example, based on the non-negative text (or negative text) in the first text pair, the BERT model is used to perform twice encoding on the negative text or non-negative text contained in the first text pair to obtain similar text vectors (the similar text vectors are not completely identical text vectors, that is, a pair of text vectors generated by any one text of the text pair itself), preferably, performing twice encoding to obtain similar text vectors is due to setting the "dropout" operation in the training model process, which can automatically generate text vectors for calculating the positive vector similarity without manual annotation, reducing the consumption of human and time costs, further, the first positive vector similarity of the first text pair itself is calculated by using the similarity calculation function; that is, calculating the vector similarity of the first text pair itself includes: calculating the positive vector similarity of the non-negative text or negative text in the first text pair (the positive vector similarity of a pair of text vectors itself), and the method for calculating the text similarity is shown in formula (3).

[0080] represent a pair of text vectors generated based on the negative text and the non-negative text contained in the first text pair, and further calculating the negative vector similarity that is, calculating the negative vector similarity of the first text pair includes: calculating the negative vector similarity of the non-negative text and the corresponding negative text included in the first text pair. Preferably, the hyperparameter a in formula (2) is used to determine the weight of the negative vector similarity term, for example, setting a as a number greater than 1 can increase the weight of the negative vector similarity term.

[0081] (v i ,v j) represents a text vector of the first text pair with a plurality of second text pairs in the training text, wherein the second text pair is other than the first text pair in a batch of training texts; for example: the text vector of the non-negative text in the non-negative text and any other text pair in a batch of training texts other than itself, and then calculate the cosine similarity (i.e. the second positive vector similarity) between the two, and further calculate the sum of each second positive vector similarity in a batch

[0082] Further, based on formula (2), the first positive vector similarity, the negative vector similarity, and the second positive vector similarity are input into the contrast learning tool to obtain a first contrast learning loss of the classification model; further, the classification model is optimized by using the contrast learning loss. The pre-set classification model is optimized, that is, the code module is used to superimpose the contrast learning loss function (such as formula (2)) on the basis of the classification loss function (such as formula (1)), so as to improve the distinguishing ability of the model for negative texts and their corresponding non-negative texts, improve the accuracy of identifying emotional types (especially negative emotional types), and achieve the beneficial effect of optimizing the classification model.

[0083] The second method is for the case that the negative text item of the first text pair is empty.

[0084] For the case that the negative text item of the first text pair is empty, the third positive vector similarity of the first text pair itself and the fourth positive vector similarity of the text pair with a plurality of second text pairs in the training text are calculated respectively; the third positive vector similarity and the fourth positive vector similarity are input into the contrast learning tool to obtain a second contrast learning loss of the classification model; the classification model is optimized by using the second contrast learning loss. Wherein, the case that the negative text item of the first text pair is empty is the case that the text pair contains the reference text, that is, the case that the text pair does not contain the negative text. It can be understood that in the case of not containing the negative text, the formula (4) corresponding to the second contrast learning loss generated based on formula (2) is as follows:

[0085]

[0086] The description of the similarity function f (taking formula (3) as an example) included in formula (4) is consistent with the description of the similarity function f in the first model, and will not be repeated here. Similarly, the specific description of calculating the third positive vector similarity of the first text pair itself is similar to the description of the first positive vector similarity of formula (2) in the first model, and will not be repeated here; the specific description of the fourth positive vector similarity of the text pair and multiple second text pairs in the training text is similar to the description of the second positive vector similarity of formula (2) in the first model, and will not be repeated here. Further, based on formula (4), the third positive vector similarity and the fourth positive vector similarity are input into the contrastive learning tool to obtain the second contrastive learning loss of the classification model; so as to optimize the classification model by using the second contrastive learning loss.

[0087] That is, the contrastive learning tool achieves the effect of optimizing the preset classification model and obtaining the target classification model by adding contrastive learning loss (e.g., the contrastive learning loss function shown in formula (2) or formula (4)) to the classification loss of the classification model (e.g., the classification loss function shown in formula (1)).

[0088] It is understandable that during the training of the target classification model, multiple batches of training text can be used, and steps S201-S203 can be executed for each batch of training text. By iterating through steps S201-S203, the target classification model is trained, which improves the output performance of the target classification model, thus obtaining the optimized target classification model.

[0089] Step S204: Use the target classification model to identify the sentiment type of the processed information.

[0090] Specifically, based on the description of steps S201-S203 of training the target classification model, the preset classification model is optimized to form a target classification model; furthermore, the description of using the target classification model to identify the sentiment type of the processed information is consistent with the description of step S102, and will not be repeated here.

[0091] like Figure 3 As shown, this embodiment of the invention provides an information processing device 300, including: a model determination module 301 and an emotion recognition module 302; wherein,

[0092] The model determination module 301 is used to determine the target classification model, wherein the target classification model is obtained by optimizing the preset classification model with a preset contrastive learning tool in combination with training text, and the contrastive learning tool is used to add contrastive learning loss to the classification loss of the classification model;

[0093] The emotion recognition module 302 is used to receive information to be processed, identify the emotion type of the information to be processed using the target classification model, and process the information to be processed according to the identified emotion type.

[0094] This invention also provides an electronic device for processing information, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.

[0095] This invention also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in any of the above embodiments.

[0096] Figure 4 An exemplary system architecture 400 is shown, in which a method or apparatus for processing information can be applied according to embodiments of the present invention.

[0097] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, and 403, a network 404, and a server 405. Network 404 serves as the medium for providing communication links between terminal devices 401, 402, and 403 and server 405. Network 404 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0098] Users can use terminal devices 401, 402, and 403 to interact with server 405 via network 404 to receive or send messages, etc. Various client applications can be installed on terminal devices 401, 402, and 403, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, etc.

[0099] Terminal devices 401, 402, and 403 can be various electronic devices with displays and supporting various client applications, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0100] Server 405 can be a server that provides various services, such as a backend management server that supports client applications used by users through terminal devices 401, 402, and 403. The backend management server can process received requests for processing sentiment type information and feed back the sentiment type obtained from the processing information to the terminal devices.

[0101] It should be noted that the information processing method provided in the embodiments of the present invention is generally executed by server 405, and correspondingly, the information processing device is generally disposed in server 405.

[0102] It should be appreciated that Figure 4 the number of terminal devices, networks and servers in

[0103] Reference will now be made to Figure 5 which shows a schematic configuration of a computer system 500 that is suitable for use in implementing the terminal device of an embodiment of the present application. Figure 5 The terminal device shown is merely an example and should not impose any limitation on the functions and the range of use of the embodiments of the present application.

[0104] As shown in Figure 5 the computer system 500 includes a central processing unit (CPU) 501 that can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 502 or programs loaded from a storage section 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502 and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0105] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as necessary. A removable media 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 510 as necessary, so that a computer program read therefrom is installed into the storage section 508 as necessary.

[0106] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to the embodiments disclosed herein. For example, the embodiments disclosed herein include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 509 and / or installed from the removable media 511. When the computer program is executed by the central processing unit (CPU) 501, the above-described functions defined in the system of the present application are performed.

[0107] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0108] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code containing one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and sometimes in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0109] The modules and / or units described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The described modules and / or units can be set in a processor, for example, can be described as: a processor includes a determination model module and an emotion recognition module. Among them, the name of these modules does not constitute a limitation to the module itself in some cases, for example, the emotion recognition module can also be described as: a module for identifying the sentiment type information of the text information by using the target classification model.

[0110] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, when the one or more programs are executed by the device, the device includes: determining a target classification model, wherein the target classification model is obtained by optimizing a preset classification model by a preset contrast learning tool combined with training text, and the contrast learning tool is used to add a contrast learning loss to a classification loss of the classification model; receiving to-be-processed information, and identifying the sentiment type of the to-be-processed information by using the target classification model; and processing the to-be-processed information according to the identified sentiment type.

[0111] The embodiments of the present application can determine a target classification model based on a contrast learning tool, identify the sentiment type of to-be-processed information by using the target classification model, and process the to-be-processed information according to the identified sentiment type, thereby improving the accuracy of the sentiment type corresponding to the processed information, and improving the efficiency and accuracy of processing information.

[0112] The above specific embodiments do not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modification, equivalent replacement and improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method of processing information, characterized by, The method comprises the following steps: determining a target classification model, wherein the target classification model is obtained by combining a preset contrast learning tool with training text to optimize a preset classification model, and the contrast learning tool is used to add a contrast learning loss to a classification loss of the classification model; receiving information to be processed, and identifying an emotional type of the information to be processed by using the target classification model; processing the information to be processed according to the identified emotional type; wherein the training text comprises a plurality of text pairs, and each text pair is composed of a negative text item and a non-negative text item; The method further comprises: determining a first text pair input into the classification model; in the case that the negative text item of the first text pair is not empty, respectively calculating a first positive vector similarity of the first text pair itself, a negative vector similarity of the first text pair, and a second positive vector similarity of the first text pair and a plurality of second text pairs in the training text; inputting the first positive vector similarity, the negative vector similarity, and the second positive vector similarity into the contrast learning tool to obtain a first contrast learning loss of the classification model; optimizing the classification model by using the contrast learning loss.

2. The method of claim 1, wherein, Further comprising: obtaining original training text; selecting negative text containing negative words from the original training text, and generating corresponding non-negative text for the negative text, and forming a text pair by combining the negative text and the corresponding non-negative text; using a plurality of text pairs to form the training text.

3. The method of claim 2, wherein, After selecting the negative text containing negative words from the original training file, further comprising: obtaining a text semantic vector of each negative text by using a general sentence encoding model, and clustering each negative text based on the distance between a plurality of text semantic vectors to form a plurality of negative text groups; for each negative text group, performing: removing duplicate text pairs corresponding to the negative text included in the negative text group; using the deduplicated text pairs to form the training text.

4. The method of claim 3, wherein, The method further comprises: selecting similar negative texts that meet a preset similarity condition from the negative texts; removing the text pairs corresponding to the similar negative texts.

5. The method according to any one of claims 2-4, characterized in that, Further comprising: selecting reference text not containing negative words from the original training text, constructing a text pair with empty negative text by using the reference text, and adding the text pair with empty negative text to the training text.

6. The method of claim 1, wherein calculating the negative vector similarity of the first text pair itself comprises: calculating the negative vector similarity of the non-negative text and the corresponding negative text included in the first text pair; and / or calculating the vector similarity of the first text pair itself comprises: calculating the positive vector similarity of the non-negative text or the negative text in the first text pair.

7. The method of claim 1, wherein, Further comprising: in the case that the negative text item of the first text pair is empty, respectively calculate a third positive vector similarity of the first text pair to itself and a fourth positive vector similarity of the text pair to a plurality of second text pairs in the training text; input the third positive vector similarity and the fourth positive vector similarity into the contrast learning tool to obtain a second contrast learning loss of the classification model; optimize the classification model by using the second contrast learning loss.

8. An apparatus for processing information, characterized by comprise: a determination model module and an emotion recognition module; wherein the determination model module is configured to determine a target classification model, wherein the target classification model is obtained by combining a preset contrast learning tool with a training text to optimize a preset classification model, and the contrast learning tool is configured to add a contrast learning loss to a classification loss of the classification model; the emotion recognition module is configured to receive to-be-processed information, recognize an emotion type of the to-be-processed information by using the target classification model, and process the to-be-processed information according to the recognized emotion type; wherein the training text comprises a plurality of text pairs, and each text pair is composed of a negative text item and a non-negative text item; the apparatus is further configured to: determine a first text pair input into the classification model; for a case that the negative text item of the first text pair is not empty, respectively calculate a first positive vector similarity of the first text pair to itself, a negative vector similarity of the first text pair, and a second positive vector similarity of the first text pair to a plurality of second text pairs in the training text; input the first positive vector similarity, the negative vector similarity, and the second positive vector similarity into the contrast learning tool to obtain a first contrast learning loss of the classification model; optimize the classification model by using the contrast learning loss.

9. An electronic device, comprising: comprise: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to any one of claims 1-7.

10. A computer readable medium having stored thereon a computer program, characterized in that, the program is executed by the processor to implement the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Text sentiment classification method and device, electronic device and storage medium

    CN110532386A

  • Unbalanced text classification method and device, equipment and storage medium

    CN113869398A