CN110555204A - emotion judgment method and device - Google Patents
emotion judgment method and device Download PDFInfo
- Publication number
- CN110555204A CN110555204A CN201810552484.9A CN201810552484A CN110555204A CN 110555204 A CN110555204 A CN 110555204A CN 201810552484 A CN201810552484 A CN 201810552484A CN 110555204 A CN110555204 A CN 110555204A
- Authority
- CN
- China
- Prior art keywords
- text
- data
- array
- determining
- machine language
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000008451 emotion Effects 0.000 title claims abstract description 124
- 238000000034 method Methods 0.000 title claims abstract description 42
- 239000013598 vector Substances 0.000 claims description 53
- 238000003491 array Methods 0.000 claims description 52
- 238000011176 pooling Methods 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012935 Averaging Methods 0.000 claims description 8
- 230000000694 effects Effects 0.000 abstract description 16
- 230000011218 segmentation Effects 0.000 abstract description 12
- 230000006870 function Effects 0.000 description 15
- 238000010586 diagram Methods 0.000 description 14
- 238000012545 processing Methods 0.000 description 11
- 230000008569 process Effects 0.000 description 9
- 238000004422 calculation algorithm Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 4
- 238000013507 mapping Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000007635 classification algorithm Methods 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000008909 emotion recognition Effects 0.000 description 1
- 230000002996 emotional effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000036651 mood Effects 0.000 description 1
- 230000007935 neutral effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000017105 transposition Effects 0.000 description 1
Abstract
the invention discloses a method and a device for judging emotion, and relates to the technical field of computers. One embodiment of the method comprises: acquiring text data; performing encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data; and decoding the machine language data, and determining the emotion corresponding to the machine language data. The implementation mode overcomes the technical problem that the emotion judgment is negatively influenced by too complicated and inaccurate word segmentation in the prior art, and further achieves the technical effects of quickly and efficiently determining the emotion of the text, reducing word segmentation operation and improving the emotion judgment accuracy.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for judging emotion.
background
Emotion judgment belongs to text emotion recognition in the field of natural language. With the development of artificial intelligence, the prior art is mainly divided into two categories: traditional machine learning algorithms and neural network based text classification algorithms.
in the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the prior art can only judge the emotion of an independent scene, and the related algorithm is complex and is not suitable for judging the emotion of a dialog form text or short text data.
disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for emotion determination, which can achieve the technical effects of quickly and efficiently determining a text emotion, reducing word segmentation operations, and improving emotion determination accuracy.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of emotion judgment, including:
Acquiring text data;
Performing encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data;
And decoding the machine language data, and determining the emotion corresponding to the machine language data.
optionally, performing an encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data includes:
Performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data;
For each word in the text data, combining the text array corresponding to the word with the adjacent text array to determine an adjacent combined array;
Pooling the adjacent combined arrays, and determining pooled data;
and performing linear coding according to the pooled data, and determining machine language data corresponding to the text data.
Optionally, performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data, includes:
Setting each word in the text data as a vector;
assigning values to the vectors and determining all text arrays;
wherein, the value of each dimension of the vector is a random number between-1 and 1.
optionally, the number of dimensions of the vector is determined according to sparsity of distribution of the adjacent combination arrays in the dimension space.
Optionally, the upper limit number of text arrays participating in determining the adjacent combination array is two, or three, or four, or five.
optionally, pooling each adjacent combined array, determining pooled data, comprising:
if the adjacent combined array comprises a plurality of text arrays, averaging all the text arrays in the adjacent combined array, and determining the pooled data corresponding to the adjacent combined array;
if the adjacent combination array only contains one text array, the text array is reserved, and the pooled data corresponding to the adjacent combination array is determined.
Optionally, decoding the machine language data to determine an emotion corresponding to the machine language data, including:
layering Softmax according to the machine language data;
determining the probability of all emotions corresponding to the machine language data according to the result of the layered Softmax;
and setting the emotion with the maximum probability as the emotion corresponding to the machine language data according to the probabilities of all the emotions.
according to still another aspect of an embodiment of the present invention, there is provided an apparatus for emotion judgment, including:
The text data acquisition module is used for acquiring text data;
the encoding module is used for performing encoding operation on each word and adjacent words in the text data and determining machine language data corresponding to the text data;
and the decoding module is used for decoding the machine language data and determining the emotion corresponding to the machine language data.
Optionally, in the encoding module, performing an encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data includes:
performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data;
for each word in the text data, combining the text array corresponding to the word with the adjacent text array to determine an adjacent combined array;
pooling the adjacent combined arrays, and determining pooled data;
and performing linear coding according to the pooled data, and determining machine language data corresponding to the text data.
Optionally, performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data, includes:
Setting each word in the text data as a vector;
assigning values to the vectors and determining all text arrays;
wherein, the value of each dimension of the vector is a random number between-1 and 1.
optionally, the number of dimensions of the vector is determined according to sparsity of distribution of the adjacent combination arrays in the dimension space.
optionally, the upper limit number of text arrays participating in determining the adjacent combination array is two, or three, or four, or five.
Optionally, pooling each adjacent combined array, determining pooled data, comprising:
if the adjacent combined array comprises a plurality of text arrays, averaging all the text arrays in the adjacent combined array, and determining the pooled data corresponding to the adjacent combined array;
if the adjacent combination array only contains one text array, the text array is reserved, and the pooled data corresponding to the adjacent combination array is determined.
optionally, decoding the machine language data to determine an emotion corresponding to the machine language data, including:
Layering Softmax according to the machine language data;
Determining the probability of all emotions corresponding to the machine language data according to the result of the layered Softmax;
and setting the emotion with the maximum probability as the emotion corresponding to the machine language data according to the probabilities of all the emotions.
According to another aspect of the embodiments of the present invention, there is provided an electronic device for emotion judgment, including:
One or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of emotion determination of the present invention.
according to another aspect of embodiments of the present invention, there is provided a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements the method of emotion judgment of the present invention.
One embodiment of the above invention has the following advantages or benefits:
1. because the technical means of determining the emotion in the encoding-decoding operation mode is adopted, the text data is converted into a vector with a fixed length, and then the emotion is output, so that the technical effect of quickly and efficiently determining the emotion of the text data is achieved;
2. because the technical means of determining the adjacent combined array according to the adjacent text array is adopted, the negative influence of inaccurate word segmentation on emotion judgment is overcome, and the technical effects of reducing word segmentation operation and improving emotion judgment accuracy are further achieved;
3. Because the technical means of linear coding is adopted, the technical problem that the algorithm adopted in the prior art is too complex is solved, and the technical effects of simple processing mode and high efficiency are further achieved;
4. because the layered Softmax is adopted to determine the emotion corresponding to the machine language, the technical problems of slow emotion judgment speed and inaccuracy in the prior art are solved, and the technical effects of supporting multiple languages and determining the emotion quickly and efficiently are achieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
Fig. 1 is a schematic diagram of a main flow of a method of emotion judgment according to an embodiment of the present invention;
FIG. 2 is a block diagram of an encoding-decoding operation employed in accordance with an embodiment of the present invention;
fig. 3 is a schematic diagram of the main steps of the encoding operation in a specific embodiment of a method of emotion judgment according to an embodiment of the present invention;
Fig. 4 is a schematic diagram of main steps of a decoding operation in a specific embodiment of a method of emotion judgment according to an embodiment of the present invention;
Fig. 5 is a schematic diagram of the main blocks of an apparatus for emotion judgment according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
Fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
fig. 1 is a schematic diagram of a main flow of a method of emotion judgment according to an embodiment of the present invention, as shown in fig. 1,
S101, acquiring text data;
step S102, coding each word and adjacent words in the text data, and determining machine language data corresponding to the text data;
and S103, decoding the machine language data and determining the emotion corresponding to the machine language data.
The text data includes: short dialog text or chat text, comment text with an independent scene, and the like, which are not specifically limited herein. The content of the text data is not limited to the chinese text data, and may include other language text data.
the encoding operation refers to a process of converting text data into machine language data through an algorithm. Wherein the algorithm may include, but is not limited to: and performing convolution on the text data and performing Fourier transform on the text data.
the machine language data refers to data which is obtained after processing and can be used for subsequent processing of a computer. Specifically, the machine language data may be data obtained by performing an encoding operation on each word and adjacent words in the text data.
The emotions can be divided into three categories of positive, negative and neutral according to actual needs, and each emotion can be further refined. Optionally, the emotional refinements that often occur in customer service's conversations with the user are summarized in table 1. Specifically, three emotion categories related to the present technical solution are listed in column 1 of table 1; column 2 is a refinement of the emotions listed in the first column; column 3 defines the respective refined emotions; column 4 specifically illustrates the refined emotion. The emotions summarized in table 1 are merely examples, and do not limit the present invention.
TABLE 1 Emotion refinement summary sheet
After the text data is obtained, the emotion is determined by adopting a coding-decoding operation mode, so that the text data is firstly generated into machine language data through coding operation, and then the machine language data is decoded, and the emotion corresponding to the text data is determined.
Optionally, performing an encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data includes:
performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data;
For each word in the text data, combining the text array corresponding to the word with the adjacent text array to determine an adjacent combined array;
Pooling the adjacent combined arrays, and determining pooled data;
And performing linear coding according to the pooled data, and determining machine language data corresponding to the text data.
the word embedding operation refers to a process of mapping text data to a real number vector. Text data that is difficult for a computer to process is converted into a vector that is easier for the computer to process by a word embedding operation. Wherein the vector is typically a multi-dimensional vector.
The text array is a vector generated from a word embedding operation. The proximity combination array is determined from the text array, and the proximity combination array is a vector. At the same time, the pooled data and the machine language data are also vectors. In the text data, the possibility that emotion can be expressed between adjacent text arrays is higher. Therefore, the adjacent text arrays are combined, the emotion accuracy expressed by the text data determined by the computer can be improved, word segmentation operation is reduced, the influence of inaccurate word segmentation on emotion judgment is avoided, and the emotion judgment accuracy is improved.
such pooling includes, but is not limited to: and averaging the text arrays in the adjacent combined arrays and taking the maximum value. Through pooling, the total number of vectors is reduced, the robustness of pooled data is improved, and the anti-interference capability of the pooled data is enhanced.
The linear coding further reduces the total number of vectors of the pooled data to obtain the final coded result: machine language data. In this embodiment, the linear coding may determine the machine language data by using a simple linear summation manner, or may determine the machine language data by using weighted summation, a regression function, and the like, which is not limited herein. By adopting the technical means of linear coding, the technical problem that the algorithm adopted in the prior art is too complex is solved, and the technical effects of simple processing mode and high efficiency are further achieved.
Optionally, performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data, includes:
setting each word in the text data as a vector;
assigning values to the vectors and determining all text arrays;
Wherein, the value of each dimension of the vector is a random number between-1 and 1.
the text data is set into a vector form, so that the computer can conveniently process the text data, and further the emotion can be conveniently determined subsequently;
for example, the "me" word is set as a 128-dimensional vector (a 1, a 2, a 3, … a n), wherein the dimension n of the vector can be changed according to actual conditions, and the values of a 1, a 2, a 3, … a n are random numbers between-1 and 1.
Optionally, the number of dimensions of the vector is determined according to sparsity of distribution of the adjacent combination arrays in the dimension space.
the vector dimension is determined according to the sparsity of the adjacent combined arrays distributed in the dimension space, so that the technical effects of flexibly setting the vector dimension and enabling the vector dimension to be more suitable for text data are achieved. Alternatively, when setting the dimension value of the vector, the predetermined fixed numerical value suitable for the vector may be set according to the sparsity of the adjacent combination array distributed in the dimension space.
because adjacent text data have the possibility of expressing meanings, the adjacent text arrays are adopted to determine the adjacent combination arrays, so that the technical effects of reducing word segmentation operation and avoiding the influence of inaccurate word segmentation operation on the generation of machine language data can be achieved. Since the number of text arrays included in the adjacent text arrays capable of expressing meanings does not exceed five in general, the upper limit number of the text arrays participating in the adjacent combination operation can be selected to be two, three, four or five;
For example, taking "i love eating orange" as an example, when the upper limit number of text arrays participating in determining the adjacent combination array is two, the number of text arrays corresponding to the adjacent combination array includes one or two. Specifically, the method comprises the following steps: the text array corresponding to the Chinese characters of ' I ', ' I love ', ' love eating ', ' orange ', ' and ' child '. When the upper limit number of the text array participating in the determination of the adjacent combination array is three, the method further comprises the following steps in addition to the adjacent combination array: the adjacent combination arrays corresponding to 'I love eating', 'love eating orange' and 'eating orange' are provided. Similarly, when the upper limit number of the text array is four or five, the adjacent combination array is determined as described above.
optionally, pooling each adjacent combined array, determining pooled data, comprising:
If the adjacent combined array comprises a plurality of text arrays, averaging all the text arrays in the adjacent combined array, and determining the pooled data corresponding to the adjacent combined array;
If the adjacent combination array only contains one text array, the text array is reserved, and the pooled data corresponding to the adjacent combination array is determined.
the adjacent combined array may contain a plurality of adjacent text arrays, and averaging each text array can achieve a better compression effect, and the obtained adjacent text array is more accurate. When the generated adjacent combination array only contains one text array, the text array is not required to be averaged, and the text array is only required to be reserved as the pooled data. In the embodiment, by adopting the technical means of determining the adjacent combined array according to the adjacent text array, the negative influence of inaccurate text array combination on emotion judgment is overcome, and the technical effects of reducing word segmentation operation and improving emotion judgment accuracy are further achieved.
Optionally, decoding the machine language data to determine an emotion corresponding to the machine language data, including:
layering Softmax according to the machine language data;
determining the probability of all emotions corresponding to the machine language data according to the result of the layered Softmax;
and setting the emotion with the maximum probability as the emotion corresponding to the machine language data according to the probabilities of all the emotions.
The decoding part mainly solves the problem of determining the corresponding emotion of the text data according to the coded result, namely finding the mapping relation between the coded result and the corresponding emotion. The decoding part mainly applies a layered Softmax mode to determine the final emotion. The mode of layering Softmax mainly comprises two parts: a Softmax function part and a hierarchy part. The Softmax function part and the layering part are described below, respectively:
the Softmax function part is a normalized exponential function:
and mapping an n-dimensional machine language data vector (a 1, a 2, a 3, … a n) into a constant vector (b 1, b 2, b 3, … b i) containing i 0-1 by the Softmax function, and then carrying out a multi-classification task according to the size of b i to obtain a dimension with the largest weight.
The hierarchical part is to construct a Huffman tree (Huffman tree or optimal binary tree) structure according to the frequency distribution of the tags, the flattened Softmax function is replaced by a hierarchical relation, and each leaf node represents a mood. In the present embodiment, the Softmax function is processed as a huffman tree structure, and each emotion tag represents a leaf node. In the process of determining the emotion, only a search along a path leading to the branch node is needed, and other leaf nodes do not need to be considered;
specifically, when traversing the huffman tree, the probability value of the left branch or the right branch needs to be calculated. The nodes of each branch are assigned a parameter vector. The parameter vector used by the hierarchical Softmax method is almost the same as that used by the conventional Softmax method. Given the information passed down, the probability of branching to the right of branch node m can be calculated. Wherein, the probability of m right side branches is:
p(right|m,c)=σ(cT.v′m)
The method includes the steps that m is a branch node number, c is information which is transmitted downwards corresponding to an m-1 branch node, V is a parameter of a corresponding node, c T represents transposition of c, V ' m is a derivative of the parameter of the node m, therefore, the probability value of a right branch of the m node needs to calculate an inner product sigma (c T. V ' m) of a vector V ' n of the c and each node, and since the total probability of the m node is 1 and the probability value p (right | m, c) of the right branch of the m node is 1-p (right | n, c), optionally, according to the calculated probability of each leaf node, the emotion represented by the leaf node with the highest probability is selected to be output, and a final result is obtained.
the technical solution of the present invention is described in detail by a specific embodiment as follows:
Fig. 2 is a block diagram of an encoding-decoding operation employed in an embodiment in accordance with the present invention. Text data input by a user is converted into machine language data through a coding operation. Wherein X1, X2 … … Xn correspond to each word in the text data, respectively. The method and the system can be used for assisting the customer service to identify the emotion of the user when the customer service communicates with the user. Where the text data is user input. In the figure, "Embedding" represents a text array generated after a word Embedding operation, and is only an optional technical means for user input in an encoding operation, and is used for assisting understanding of the encoding operation. After the encoding operation, the emotion corresponding to the machine language data is output according to the decoding operation in the embodiment of the method. Where "Softmax" denotes the Softmax function, only an optional technical means for determining emotion labels in the decoding operation. In the figure, Y1 and Y2 … … Yn are machine responses, i.e., emotions judged in the present embodiment.
specifically, the technical scheme of the invention is explained in detail by taking 'love orange' as text data.
after the text data "love orange me" is obtained, as shown in fig. 3, the "love orange me" is encoded. First for each word in the text data: "I", "love", "orange" and "son" are respectively assigned with 128-dimensional vectors, and each 128-dimensional vector is a text array. Then, each text array and the adjacent text array are combined, so that the aim of determining the adjacent combination array is fulfilled. In this embodiment, the upper limit number of the text arrays in the selected adjacent combined array is 2, so the generated adjacent text array may include one text array or two text arrays: the adjacent combination array corresponding to the Chinese characters of 'I', 'I love', 'love orange', 'orange' and 'child'. Thereafter, the adjacent combination arrays are pooled. In this embodiment, the pooling is an average of the text arrays in each adjacent array of combinations, resulting in an average of each adjacent array of combinations, denoted by "Avg" in the figure. And finally, performing linear summation operation on the pooled adjacent combined arrays, and expressing the obtained result by using 'SUM', thereby determining machine language data and finishing the encoding operation.
As shown in fig. 4, the decoding operation is as follows:
according to the encoding operation of 'i love orange', a 128-dimensional vector c is obtained as the input of the decoding operation, wherein the 128-dimensional vector c is machine language data, according to the frequency of emotion occurrence, a Huffman tree is constructed, a specific tree structure is assumed to be shown in FIG. 4, and corresponding parameters of a branch node 1, a branch node 2 and a branch node 3 are set to be vectors v 1, v 2 and v 3, so that the following steps are obtained:
For branch node 1, the probability of its emotion being emotion 1 is p 1 ═ σ (c T. v 1).
for the branch node 2, the probability that the emotion is emotion 2 is p 2 ═ σ (c T. v 2) × (1-p 1).
For the branch node 3, the probability of its emotion being emotion 3 is p 3 ═ σ (c T. v 3) × (1-p 1) × (1-p 2), and the probability of its emotion being emotion 4 is p 4 ═ 1-p 3.
wherein, the probability value sigma (c T. v 2) x (1-p 1) corresponding to the emotion 2 is the maximum, so the emotion value corresponding to the sentence "i love orange" is emotion 2.
According to still another aspect of the embodiments of the present invention, there is provided an apparatus 500 for emotion judgment, including:
The module 501, a text data obtaining module, are used to obtain text data;
The module 502 and the encoding module are used for performing encoding operation on each word and adjacent words in the text data and determining machine language data corresponding to the text data;
The module 503 is a decoding module, configured to decode the machine language data, and determine an emotion corresponding to the machine language data.
Optionally, in the encoding module, performing an encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data includes:
Performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data;
for each word in the text data, combining the text array corresponding to the word with the adjacent text array to determine an adjacent combined array;
pooling the adjacent combined arrays, and determining pooled data;
and performing linear coding according to the pooled data, and determining machine language data corresponding to the text data.
Optionally, performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data, includes:
Setting each word in the text data as a vector;
assigning values to the vectors and determining all text arrays;
Wherein, the value of each dimension of the vector is a random number between-1 and 1.
Optionally, the number of dimensions of the vector is determined according to sparsity of distribution of the adjacent combination arrays in the dimension space.
Optionally, the upper limit number of text arrays participating in determining the adjacent combination array is two, or three, or four, or five.
Optionally, pooling each adjacent combined array, determining pooled data, comprising:
if the adjacent combined array comprises a plurality of text arrays, averaging all the text arrays in the adjacent combined array, and determining the pooled data corresponding to the adjacent combined array;
If the adjacent combination array only contains one text array, the text array is reserved, and the pooled data corresponding to the adjacent combination array is determined.
optionally, decoding the machine language data to determine an emotion corresponding to the machine language data, including:
layering Softmax according to the machine language data;
determining the probability of all emotions corresponding to the machine language data according to the result of the layered Softmax;
and setting the emotion with the maximum probability as the emotion corresponding to the machine language data according to the probabilities of all the emotions.
fig. 6 shows an exemplary system architecture 600 to which the emotion judging method or emotion judging apparatus of the embodiment of the present invention can be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
it should be noted that the emotion determining method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the emotion determining apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
as shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
it should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not form a limitation on the modules themselves in some cases, and for example, the sending module may also be described as a "module sending a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
acquiring text data;
performing encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data;
And decoding the machine language data, and determining the emotion corresponding to the machine language data.
According to the technical scheme of the embodiment of the invention, the following beneficial effects are achieved:
1. because the emotion is determined by adopting the encoding-decoding operation mode, the text data is converted into a vector with a fixed length, and then the emotion is output, thereby achieving the technical effect of quickly and efficiently determining the emotion of the text;
2. Because the technical means of determining the adjacent combined array according to the adjacent text array is adopted, the negative influence of inaccurate word segmentation on emotion judgment is overcome, and the technical effects of reducing word segmentation operation and improving emotion judgment accuracy are achieved;
3. because the technical means of linear coding is adopted, the technical problem that the algorithm adopted in the prior art is too complex is solved, and the technical effects of simple processing mode and high efficiency are further achieved;
4. because the layered Softmax is adopted to determine the emotion corresponding to the machine language, the technical problems of slow emotion judgment speed and inaccuracy in the prior art are solved, and the technical effects of supporting multiple languages and determining the emotion quickly and efficiently are achieved.
the above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate 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 invention should be included in the protection scope of the present invention.
Claims (16)
1. A method of emotion determination, comprising:
Acquiring text data;
Performing encoding operation on each word and adjacent words in the text data, and determining machine language data corresponding to the text data;
and decoding the machine language data, and determining the emotion corresponding to the machine language data.
2. the method of claim 1, wherein encoding each word and adjacent words in the text data to determine machine language data corresponding to the text data comprises:
Performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data;
For each word in the text data, combining the text array corresponding to the word with the adjacent text array to determine an adjacent combined array;
pooling the adjacent combined arrays, and determining pooled data;
and performing linear coding according to the pooled data, and determining machine language data corresponding to the text data.
3. the method of claim 2, wherein performing a word embedding operation based on the text data to determine a text array corresponding to each word in the text data comprises:
setting each word in the text data as a vector;
assigning values to the vectors and determining all text arrays;
Wherein, the value of each dimension of the vector is a random number between-1 and 1.
4. the method of claim 3, wherein the number of dimensions of the vector is determined according to the sparsity of the distribution of the adjacent array of combinations in the dimensional space.
5. the method of claim 2, wherein the upper limit number of text arrays involved in determining the adjacent combination array is two, or three, or four, or five.
6. The method of claim 2, wherein pooling each adjacent combined array and determining pooled data comprises:
If the adjacent combined array comprises a plurality of text arrays, averaging all the text arrays in the adjacent combined array, and determining the pooled data corresponding to the adjacent combined array;
If the adjacent combination array only contains one text array, the text array is reserved, and the pooled data corresponding to the adjacent combination array is determined.
7. the method of claim 1, wherein decoding the machine language data to determine the emotion corresponding to the machine language data comprises:
Layering Softmax according to the machine language data;
Determining the probability of all emotions corresponding to the machine language data according to the result of the layered Softmax;
and setting the emotion with the maximum probability as the emotion corresponding to the machine language data according to the probabilities of all the emotions.
8. an apparatus for emotion judgment, comprising:
the text data acquisition module is used for acquiring text data;
the encoding module is used for performing encoding operation on each word and adjacent words in the text data and determining machine language data corresponding to the text data;
and the decoding module is used for decoding the machine language data and determining the emotion corresponding to the machine language data.
9. The apparatus of claim 8, wherein the encoding module performs an encoding operation on each word and adjacent words in the text data to determine machine language data corresponding to the text data, and comprises:
performing word embedding operation according to the text data, and determining a text array corresponding to each word in the text data;
For each word in the text data, combining the text array corresponding to the word with the adjacent text array to determine an adjacent combined array;
pooling the adjacent combined arrays, and determining pooled data;
and performing linear coding according to the pooled data, and determining machine language data corresponding to the text data.
10. The apparatus of claim 9, wherein performing a word embedding operation based on the text data to determine a text array corresponding to each word in the text data comprises:
Setting each word in the text data as a vector;
Assigning values to the vectors and determining all text arrays;
wherein, the value of each dimension of the vector is a random number between-1 and 1.
11. the apparatus of claim 10, wherein the number of dimensions of the vector is determined according to sparsity of distribution of neighboring array of combinations in a dimensional space.
12. the apparatus of claim 9, wherein the upper limit number of text arrays involved in determining the adjacent combination array is two, or three, or four, or five.
13. The apparatus of claim 9, wherein pooling each adjacent combined array and determining pooled data comprises:
if the adjacent combined array comprises a plurality of text arrays, averaging all the text arrays in the adjacent combined array, and determining the pooled data corresponding to the adjacent combined array;
if the adjacent combination array only contains one text array, the text array is reserved, and the pooled data corresponding to the adjacent combination array is determined.
14. the apparatus of claim 8, wherein decoding the machine language data to determine the emotion corresponding to the machine language data comprises:
layering Softmax according to the machine language data;
determining the probability of all emotions corresponding to the machine language data according to the result of the layered Softmax;
And setting the emotion with the maximum probability as the emotion corresponding to the machine language data according to the probabilities of all the emotions.
15. An electronic device for emotion determination, comprising:
one or more processors;
A storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
16. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810552484.9A CN110555204A (en) | 2018-05-31 | 2018-05-31 | emotion judgment method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810552484.9A CN110555204A (en) | 2018-05-31 | 2018-05-31 | emotion judgment method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110555204A true CN110555204A (en) | 2019-12-10 |
Family
ID=68733815
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810552484.9A Pending CN110555204A (en) | 2018-05-31 | 2018-05-31 | emotion judgment method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110555204A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112002329A (en) * | 2020-09-03 | 2020-11-27 | 深圳Tcl新技术有限公司 | Physical and mental health monitoring method and device and computer readable storage medium |
CN112699964A (en) * | 2021-01-13 | 2021-04-23 | 成都链安科技有限公司 | Model construction method, system, device, medium and transaction identity identification method |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110040155A1 (en) * | 2009-08-13 | 2011-02-17 | International Business Machines Corporation | Multiple sensory channel approach for translating human emotions in a computing environment |
CN104536953A (en) * | 2015-01-22 | 2015-04-22 | 苏州大学 | Method and device for recognizing textual emotion polarity |
CN106057200A (en) * | 2016-06-23 | 2016-10-26 | 广州亿程交通信息有限公司 | Semantic-based interaction system and interaction method |
CN106598948A (en) * | 2016-12-19 | 2017-04-26 | 杭州语忆科技有限公司 | Emotion recognition method based on long-term and short-term memory neural network and by combination with autocoder |
CN107958433A (en) * | 2017-12-11 | 2018-04-24 | 吉林大学 | A kind of online education man-machine interaction method and system based on artificial intelligence |
CN108009297A (en) * | 2017-12-27 | 2018-05-08 | 广州市云润大数据服务有限公司 | Text emotion analysis method and system based on natural language processing |
-
2018
- 2018-05-31 CN CN201810552484.9A patent/CN110555204A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110040155A1 (en) * | 2009-08-13 | 2011-02-17 | International Business Machines Corporation | Multiple sensory channel approach for translating human emotions in a computing environment |
CN104536953A (en) * | 2015-01-22 | 2015-04-22 | 苏州大学 | Method and device for recognizing textual emotion polarity |
CN106057200A (en) * | 2016-06-23 | 2016-10-26 | 广州亿程交通信息有限公司 | Semantic-based interaction system and interaction method |
CN106598948A (en) * | 2016-12-19 | 2017-04-26 | 杭州语忆科技有限公司 | Emotion recognition method based on long-term and short-term memory neural network and by combination with autocoder |
CN107958433A (en) * | 2017-12-11 | 2018-04-24 | 吉林大学 | A kind of online education man-machine interaction method and system based on artificial intelligence |
CN108009297A (en) * | 2017-12-27 | 2018-05-08 | 广州市云润大数据服务有限公司 | Text emotion analysis method and system based on natural language processing |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112002329A (en) * | 2020-09-03 | 2020-11-27 | 深圳Tcl新技术有限公司 | Physical and mental health monitoring method and device and computer readable storage medium |
CN112002329B (en) * | 2020-09-03 | 2024-04-02 | 深圳Tcl新技术有限公司 | Physical and mental health monitoring method, equipment and computer readable storage medium |
CN112699964A (en) * | 2021-01-13 | 2021-04-23 | 成都链安科技有限公司 | Model construction method, system, device, medium and transaction identity identification method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10650102B2 (en) | Method and apparatus for generating parallel text in same language | |
US20190163742A1 (en) | Method and apparatus for generating information | |
CN109376234B (en) | Method and device for training abstract generation model | |
CN108628830B (en) | Semantic recognition method and device | |
US11741094B2 (en) | Method and system for identifying core product terms | |
CN111930894B (en) | Long text matching method and device, storage medium and electronic equipment | |
CN111159409A (en) | Text classification method, device, equipment and medium based on artificial intelligence | |
CN113268560A (en) | Method and device for text matching | |
CN111368551A (en) | Method and device for determining event subject | |
CN111639162A (en) | Information interaction method and device, electronic equipment and storage medium | |
CN111368697A (en) | Information identification method and device | |
CN110555204A (en) | emotion judgment method and device | |
CN110852057A (en) | Method and device for calculating text similarity | |
CN116127925B (en) | Text data enhancement method and device based on destruction processing of text | |
CN113761174A (en) | Text generation method and device | |
CN114065784B (en) | Training method, translation method, device, electronic equipment and storage medium | |
CN114707638A (en) | Model training method, model training device, object recognition method, object recognition device, object recognition medium and product | |
CN111274383B (en) | Object classifying method and device applied to quotation | |
CN113806541A (en) | Emotion classification method and emotion classification model training method and device | |
CN113779186A (en) | Text generation method and device | |
CN114792086A (en) | Information extraction method, device, equipment and medium supporting text cross coverage | |
CN112364657A (en) | Method, device, equipment and computer readable medium for generating text | |
CN111275476A (en) | Logistics storage service quotation method and device | |
CN110929512A (en) | Data enhancement method and device | |
CN113407851B (en) | Method, device, equipment and medium for determining recommended information based on double-tower model |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |