A text processing method, device, server and storage medium
By attenuating and weighting the attribute words in the target text encoding, the problem of low accuracy of existing emotion detection methods is solved, and more accurate emotion word judgment and emotion polarity analysis are achieved.
Patent Information
- Application Number
- CN202210151525.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-02-18
AI Technical Summary
Existing emotion detection methods have low accuracy and cannot meet the platform's needs for emotion detection.
By obtaining the target text encoding, based on the preset mechanism, the representation values of the attribute words outside the preset range before and after the target text encoding are attenuated and/or ignored, the target optimized text encoding is obtained, and each character is calculated according to the preset rules weight, thereby selecting the word with the highest weight as the emotional word to determine the emotional polarity.
It improves the accuracy of emotional word judgment, can pay more attention to attribute words and their nearby words, and enhances the accuracy of emotion detection.
Smart Images

Figure CN114510934B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software technology, and in particular to a text processing method, device, server and storage medium. Background Art
[0002] Many software platforms have comment functions, where users can comment on resources (such as audio, video, etc.) provided on the platform. In order to better optimize the platform according to user needs, it is necessary to perform sentiment analysis on user comments.
[0003] However, the existing emotion detection methods have low accuracy and often fail to achieve the emotion detection accuracy expected by the platform. Therefore, how to improve the accuracy of emotion detection methods is an urgent problem to be solved. Summary of the invention
[0004] The objectives of the present invention include, for example, providing a text processing method, device, server and storage medium, which can at least partially solve the above-mentioned technical problems.
[0005] The embodiments of the present invention can be implemented as follows:
[0006] In a first aspect, an embodiment of the present invention provides a text processing method, which is applied to a server, and the method includes:
[0007] Obtaining a target text code, wherein the target text code includes attribute words, and each word in the target text code corresponds to a representation value;
[0008] Based on a preset mechanism, the representation values of the characters of the attribute word outside the preset range before and after the target text code are attenuated and / or ignored to obtain the target optimized text code;
[0009] According to a first preset rule, the representation value of each word in the target optimized text code is calculated to obtain the weight of each word in the target optimized text code;
[0010] Based on the weight of each word in the target optimized text code, a word with the highest weight is selected from the target optimized text code as the sentiment word of the attribute word.
[0011] Optionally, the step of obtaining the target text encoding includes:
[0012] Obtaining an original text, performing attribute extraction and encoding on the original text, and obtaining an original text encoding;
[0013] Extracting attribute words from the original text code to obtain at least one attribute word;
[0014] Each of the attribute words is added to a preset position in the original text, and the original text after the attribute words are added is subjected to sentiment discrimination encoding to obtain at least one set of target text encodings.
[0015] Optionally, the server includes a BERT model, and the attribute extraction encoding of the original text includes:
[0016] Obtain the model length of the BERT model;
[0017] Starting from the first word of the original text, the original text is input into the BERT model in sequence;
[0018] If the text length of the original text is greater than the model length, the portion of the original text exceeding the model length is truncated;
[0019] The attribute extraction encoding is performed on the remaining part of the original text in the BERT model to obtain the original text encoding.
[0020] Optionally, the calculating, according to the first preset rule, the representation value of each word in the target optimized text encoding to obtain the weight of each word in the target optimized text encoding includes:
[0021] Based on the Cancat function, the representation value of each word in the target optimized text encoding is merged with the first preset vector to obtain a first matrix;
[0022] activating the first matrix based on a tanh function;
[0023] Based on the Softmax function, the product of the activated first matrix and the second preset vector is output to obtain the weight of each word in the target optimized text encoding.
[0024] Optionally, after selecting the words with the highest weight from the target optimized text code based on the weight of each word in the target optimized text code as the sentiment words of the attribute words, the method further comprises:
[0025] Calculate the product of the weight of each word in the sentiment word and the representation value;
[0026] The products are summed to obtain an output value, and the sentiment polarity of the sentiment word is determined according to the output value.
[0027] Optionally, the method further comprises:
[0028] The sentiment polarity includes positive, negative, and indifferent / neutral.
[0029] Optionally, the server further includes a joint learning training model, and the method further includes:
[0030] Based on the joint learning training model, model training is performed on the first preset vector and the second preset vector through a back propagation algorithm.
[0031] In a second aspect, an embodiment of the present invention provides a text processing device, which is applied to a server, and the text processing device includes:
[0032] A target text code acquisition unit is used to acquire a target text code, wherein the target text code includes attribute words, and each word in the target text code corresponds to a representation value;
[0033] The target optimized text code acquisition unit attenuates and / or ignores the representation values of the characters of the attribute word outside the preset range before and after the target text code based on a preset mechanism to obtain the target optimized text code;
[0034] A target optimized text encoding weight calculation unit, used to calculate the representation value of each word in the target optimized text encoding according to a first preset rule to obtain the weight of each word in the target optimized text encoding;
[0035] The sentiment word acquisition unit selects the words with the highest weight from the target optimized text code as the sentiment words of the attribute words based on the weight of each word in the target optimized text code.
[0036] In a third aspect, the present invention provides a server, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above methods when executing the program.
[0037] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a computer program, and when the computer program is executed, the server where the computer-readable storage medium is located is controlled to implement the steps of any one of the above-mentioned methods.
[0038] The beneficial effects of the embodiments of the present invention include, for example:
[0039] Through a preset mechanism, the representation values of characters outside the preset range before and after the attribute word in the target text encoding are attenuated and / or ignored to obtain the target optimized text encoding, so that more attention can be paid to the attribute word and the words nearby, and thus the sentiment word judgment can be performed more accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0041] Figure 1 A schematic diagram of the structure of a server provided in an embodiment of the present invention;
[0042] Figure 2 A flowchart of a text processing method provided by an embodiment of the present invention;
[0043] Figure 3 A sub-step flow chart of a text processing method provided by an embodiment of the present invention;
[0044] Figure 4 A flow chart of sub-steps for calculating the weight of each word in a text encoding for optimizing the calculation target provided by an embodiment of the present invention;
[0045] Figure 5 A schematic diagram of a text processing device provided by an embodiment of the present invention.
[0046] Icon: 100 - server; 110 - memory; 120 - processor; 130 - communication module; 300 - text processing device; 301 - target text encoding acquisition unit; 302 - target optimized text encoding acquisition unit; 303 - target optimized text encoding weight calculation unit; 304 - sentiment word acquisition unit. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0048] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0050] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.
[0051] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0052] Please refer to Figure 1 , is a block diagram of a server 100 provided by the present application, including a memory 110, a processor 120 and a communication module 130. The memory 110, the processor 120 and the communication module 130. Each component is directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0053] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0054] The processor 120 is used to read / write data or programs stored in the memory and execute corresponding functions.
[0055] The communication module 130 is used to establish a communication connection between the server and other communication terminals through the network, and to send and receive data through the network.
[0056] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the server 100. The server 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown, for example, the server may also include a BERT model, a joint training model, etc. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0057] See also Figure 2 , is a flow chart of a text processing method provided in this embodiment, the method is applied to a server, and includes the following steps:
[0058] Step S120: Obtain a target text code, wherein the target text code includes attribute words, and each word in the target text code corresponds to a representation value.
[0059] Step S130: Based on a preset mechanism, the representation values of the characters outside the preset range before and after the attribute word in the target text code are attenuated and / or ignored to obtain the target optimized text code.
[0060] Step S140: According to the first preset rule, the representation value of each word in the target optimized text code is calculated to obtain the weight of each word in the target optimized text code.
[0061] Step S150: Based on the weight of each word in the target optimized text code, a word with the highest weight is selected from the target optimized text code as the sentiment word of the attribute word.
[0062] User feedback on products is often achieved by making comments in the comment area below a software product or platform. As a product provider / platform operator, it is a common method to further improve products or platforms by obtaining user feedback on products. Among the numerous comments, there are many positive, negative, and irrelevant / neutral emotional colors. How to judge the emotional polarity of these comments in batches and efficiently has always been a technical point that needs to be continuously improved and optimized. The present invention provides a text processing method to achieve accurate emotional polarity analysis of user comments.
[0063] In step S120, the target text encoding can be obtained by encoding the user's comments and other text information (i.e., the target text) through a language model. After encoding the target text, a set of vectors can be obtained, in which the vectors correspond to the characters in the target text one by one, and the vector length of each vector is the representation value of each character. The target text can include attribute words, which can be nouns in the target text, such as "anchor", "sound", etc.; or verbs, such as "speak", "write", "say", etc.
[0064] Alternatively, if Figure 3 As shown, step S120 may include the following sub-steps:
[0065] Sub-step S121: obtaining the original text, performing attribute extraction and encoding on the original text, and obtaining the original text encoding.
[0066] Sub-step S122: extracting attribute words from the original text code to obtain the attribute words.
[0067] Sub-step S123: adding the attribute word to a preset position in the original text, performing sentiment discrimination encoding on the original text after adding the attribute word, and obtaining the target text encoding.
[0068] The original text can be the text entered by the user in the software product review area or other interfaces through interactive devices such as PCs and mobile phones. After the server obtains the original text, it can extract attributes from the original text through the language model to obtain the original text encoding. The original text encoding is also a set of vectors, each of which corresponds to a word in the original text.
[0069] In an optional embodiment, the original text can be attribute extracted and encoded through the BERT model. After obtaining the original text, the content of the original text is input into the BERT model in sequence. If the length of the original text exceeds the model length of the BERT model, the exceeding part is truncated, and the remaining part of the original text input into the BERT model is attribute extracted and encoded to obtain the original text encoding.
[0070] Taking the original text content "I really like your show hahahaha" as an example, if the model length of the BERT model can accommodate 8 sub-characters, it starts with [CLS], enter "I really like your show" in sequence, and then end with [SEP] to truncate "hahahaha"; perform attribute extraction and encoding on "I really like your show" in the BERT model to obtain the original text encoding.
[0071] After obtaining the original text code, attribute words can be extracted from it. As an optional embodiment, attribute words can be extracted from the original text code through the NER entity extraction model. After obtaining the attribute words, the attribute words are added to the preset position in the original text, and the original text after the attribute words are added is subjected to sentiment discrimination encoding to obtain the target text code. If there are multiple attribute words extracted during attribute extraction, each attribute word is added to the preset position in the original text, and the original text after the attribute words are added is subjected to sentiment discrimination encoding, and each attribute word corresponds to a set of target text codes.
[0072] After obtaining the original text encoding, each position of each vector in the original text encoding can be classified and discriminated, and the original text encoding can be classified into at least one entity through labels. Here, the entity is the attribute word. Optionally, the labels can be set as "B-A, I-A", "S", "O", where "S" can be a single-character label. For example, the label of the text "person" can be S; for a phrase composed of multiple characters, the first character in the phrase can be marked as B-A, and the remaining characters can be marked as I-A, with the last I-A marking the last character in the phrase. For example, the label of the text "audiobook" can be B-A, I-A, I-A, I-A; and "O" can be used to mark meaningless characters. For example, the label of [CLS] at the beginning of the BERT model encoding can be O.
[0073] Still taking the above original text content as an example, the original text encoding is "[CLS] I like your program very much [SEP]", and its label can be "O, O, O, B-A, I-A, O, B-A, I-A". The obtained entities are "your" and "program", so the extracted attribute words are "your" and "program". After obtaining the attribute words, the attribute words are added to a preset position in the original text for sentiment discrimination encoding. The preset position can be the beginning position of the original text.
[0074] As an optional implementation manner, taking the BERT model to perform sentiment discrimination encoding on the above text as an example, starting with [CLS], input the attribute word "your", separated by [SEP], and then input "I like your program very much hahahaha" in sequence. Similarly, if the length of the original text part exceeds the model length of the BERT model, the exceeded part is truncated, and sentiment discrimination encoding is performed on the remaining part in the BERT model to obtain the target text encoding. Then, the same operation is performed on the extracted attribute word "program" in the same way to obtain another set of target text encoding.
[0075] In step S130, the preset mechanism can be an attenuation mechanism and / or a masking mechanism. After obtaining the target text encoding, the representation values of the characters outside the preset range before and after the attribute word in the target text encoding can be attenuated and / or ignored to optimize the target text encoding, and then the target optimized text encoding is obtained.
[0076] As an optional embodiment, if there are 10 vectors in the target text encoding, from the first vector to the last vector, the vector length (i.e., representation value) of each position is: 0.1, 0.2, 0.2, 0.3, 0.5, 0.6, 0.4, 0.7, 0.8, 0.4, the attribute words are the characters corresponding to the 4th to 6th vectors, the preset range is 2 characters, and the preset mechanism is a masking mechanism. Then the lengths of all vectors except the two vectors before and after the 4th to 6th vectors are set to 0, and the target optimized text is encoded as "0, 0.2, 0.2, 0.3, 0.5, 0.6, 0.4, 0.7, 0, 0"; if the preset mechanism is the attenuation mechanism, the ratio of the distance from each vector to the center position vector of the attribute word to the number of vectors is used as the attenuation coefficient, and the representation value of each word outside the attribute word is multiplied by "1-attenuation coefficient", and the target optimized text is encoded as "0.06, 0.14, 0.16, 0.30, 0.50, 0.60, 0.32, 0.49, 0.48, 0.20". Optionally, the attenuation mechanism can be used in combination with the masking mechanism to obtain the target optimized text encoding. The above-mentioned masking mechanism and attenuation mechanism are only one of many embodiments. In the specific implementation process, the staff can set it according to the actual situation, and this embodiment does not make specific limitations on this.
[0077] After obtaining the target optimized text code, step S140 is executed to calculate the representation value of each word in the target optimized text code according to the first preset rule to obtain the weight of each word in the target optimized text code. Figure 4 The step shown may include the following sub-steps:
[0078] Sub-step S141: Based on the Cancat function, the representation value of each word in the target optimized text encoding is merged with the first preset vector to obtain a first matrix.
[0079] Sub-step S142: activating the first matrix based on the tanh function.
[0080] Sub-step S143: Based on the Softmax function, output the product of the activated first matrix and the second preset vector to obtain the weight of each word in the target optimized text code.
[0081] The first preset vector and the second preset vector can be a randomly initialized learning vector. After each text processing, the first preset vector can be adjusted and optimized according to the error of the text processing result. Assume that the first matrix is M, and the representation value of each word in the target optimized text encoding is H i , the learning vector is W, then the expression of the first matrix can be:
[0082] M=Concat(H i*W)
[0083] After obtaining the first matrix M, M is activated by the activation function tanh, and the expression is:
[0084] M=Tanh(M)
[0085] The product of the activated first matrix M and the second preset vector is calculated by the Softmax function to obtain the weight of each word in the target optimized text code. If the second preset vector is ω, the weight of each word in the target optimized text code is α i , then α i The expression is:
[0086] α i =Softmax(M*ω)
[0087] After obtaining the weight of each character in the target optimized text code, step S150 is executed: based on the weight of each character in the target optimized text code, the word with the highest weight is selected from the target optimized text code as the sentiment word of the attribute word.
[0088] For example, if the text is "I like your program very much, and hope it gets better and better!", and the attribute word is "program", after calculation, the weight of the vector corresponding to each word is shown in the following table:
[0089]
[0090] It can be seen that the word with the highest weight is "like it very much", so "like it very much" is used as the sentiment word of the attribute word "program".
[0091] After obtaining the sentiment word, it is also necessary to determine the sentiment polarity of the sentiment word, that is, determine the sentiment tendency of the sentiment word. As an optional embodiment, the product of the weight of each word in the sentiment word and the representation value can be calculated, and all products can be summed to obtain the output value. If the output value is logits, its expression can be:
[0092]
[0093] After obtaining the output value logits, multiply logits by a preset learnable variable to obtain a vector of 1*number of categories, and select the category with the maximum value, which is the sentiment polarity of the sentiment word. Sentiment polarity can include: positive, negative, and neutral / irrelevant.
[0094] Optionally, the server may also include a joint learning training model. After each text processing, the server may perform model training on the first preset vector and the second preset vector based on the joint learning training model through a back propagation algorithm to optimize the first preset vector and the second preset vector, thereby further improving the accuracy of the text processing method.
[0095] Based on the same inventive concept, Figure 5 As shown, an embodiment of the present invention provides a text processing device 300, which is applied to a server. The text processing device 300 includes:
[0096] The target text code acquisition unit 301 is used to acquire the target text code, wherein the target text code includes attribute words, and each word in the target text code corresponds to a representation value;
[0097] The target optimized text code acquisition unit 302 attenuates and / or ignores the representation values of the characters of the attribute word outside the preset range before and after the target text code based on a preset mechanism to obtain the target optimized text code;
[0098] The target optimized text encoding weight calculation unit 303 is used to calculate the representation value of each word in the target optimized text encoding according to the first preset rule to obtain the weight of each word in the target optimized text encoding;
[0099] The sentiment word acquisition unit 304 selects a word with the highest weight from the target optimized text code as the sentiment word of the attribute word based on the weight of each word in the target optimized text code.
[0100] Regarding the above-mentioned text processing device 300, the specific functions of each unit therein have been described in detail in the embodiment of the text processing method provided in this specification, and will not be elaborated here.
[0101] Based on the same inventive concept, an embodiment of the present invention specification provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of any method of the foregoing text processing method are implemented.
[0102] By adopting the above solution in the embodiment of the present invention, the following effects can be achieved at least in part:
[0103] 1. Through a preset mechanism, the representation values of the characters outside the preset range before and after the attribute word in the target text encoding are attenuated and / or ignored to obtain the target optimized text encoding, so that more attention can be paid to the attribute word and the words nearby, and then the sentiment word judgment can be performed more accurately.
[0104] 2. Since a joint learning training model is set up, based on the joint learning training model, the first preset vector and the second preset vector are trained by the back propagation algorithm, the first vector and the second preset vector are optimized, so that the accuracy of text processing is further improved.
[0105] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0106] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0107] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0108] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A text processing method, characterized in that: Applied to a server, the method comprises: Obtain a target text code, wherein the target text code includes attribute words, and each word in the target text code corresponds to a representation value; the step of obtaining the target text code includes: obtaining an original text, performing attribute extraction encoding on the original text, and obtaining an original text code; performing attribute word extraction on the original text code, and obtaining at least one attribute word; adding each attribute word to a preset position in the original text, and performing sentiment discrimination encoding on the original text after adding the attribute word, and obtaining at least one set of target text codes; Based on a preset mechanism, the representation values of the characters of the attribute word outside the preset range before and after the target text code are attenuated and / or ignored to obtain the target optimized text code; According to a first preset rule, the representation value of each word in the target optimized text code is calculated to obtain the weight of each word in the target optimized text code; Based on the weight of each word in the target optimized text code, a word with the highest weight is selected from the target optimized text code as the sentiment word of the attribute word.
2. The text processing method according to claim 1, characterized in that: The server includes a BERT model, and the attribute extraction encoding of the original text includes: Obtain the model length of the BERT model; Starting from the first word of the original text, the original text is input into the BERT model in sequence; If the text length of the original text is greater than the model length, the portion of the original text exceeding the model length is truncated; The attribute extraction encoding is performed on the remaining part of the original text in the BERT model to obtain the original text encoding.
3. The text processing method according to claim 1, characterized in that: The step of calculating the representation value of each word in the target optimized text encoding according to the first preset rule to obtain the weight of each word in the target optimized text encoding includes: Based on the Cancat function, the representation value of each word in the target optimized text encoding is merged with the first preset vector to obtain a first matrix; activating the first matrix based on a tanh function; Based on the Softmax function, the product of the activated first matrix and the second preset vector is output to obtain the weight of each word in the target optimized text encoding.
4. The text processing method according to claim 1, characterized in that: After selecting the words with the highest weight from the target optimized text code as the sentiment words of the attribute words based on the weight of each word in the target optimized text code, the method further includes: Calculate the product of the weight of each word in the sentiment word and the representation value; The products are summed to obtain an output value, and the sentiment polarity of the sentiment word is determined according to the output value.
5. The text processing method according to claim 4, characterized in that: The method further comprises: The sentiment polarity includes positive, negative, and indifferent / neutral.
6. The text processing method according to claim 3, characterized in that: The server also includes a joint learning training model, and the method also includes: Based on the joint learning training model, model training is performed on the first preset vector and the second preset vector through a back propagation algorithm.
7. A text processing device, characterized in that: Applied to a server, the text processing device comprises: The target text code acquisition unit is used to acquire the target text code, wherein the target text code includes attribute words, and each word in the target text code corresponds to a representation value; the step of acquiring the target text code includes: acquiring the original text, performing attribute extraction encoding on the original text, and obtaining the original text code; performing attribute word extraction on the original text code, and obtaining at least one attribute word; adding each attribute word to a preset position in the original text, and performing sentiment discrimination encoding on the original text after adding the attribute word, and obtaining at least one set of the target text code; The target optimized text code acquisition unit attenuates and / or ignores the representation values of the characters of the attribute word outside the preset range before and after the target text code based on a preset mechanism to obtain the target optimized text code; A target optimized text encoding weight calculation unit, used to calculate the representation value of each word in the target optimized text encoding according to a first preset rule to obtain the weight of each word in the target optimized text encoding; The sentiment word acquisition unit selects the words with the highest weight from the target optimized text code as the sentiment words of the attribute words based on the weight of each word in the target optimized text code.
8. A server, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a computer program, and when the computer program is executed, the server where the computer-readable storage medium is located is controlled to implement the steps of the method according to any one of claims 1 to 6.
