A text classification method, device, computer equipment and storage medium

Through the text classification method based on word embedding vector technology, the problems of low efficiency and high cost of traditional short text classification methods are solved, and more efficient text classification performance and resource utilization are achieved.

CN111414474BActive Publication Date: 2024-09-13CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010133657.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-28
Publication Date
2024-09-13
Estimated Expiration
2040-02-28

AI Technical Summary

Technical Problem

Traditional short text classification methods have low efficiency, high cost, and low work efficiency, mainly because manual extraction of structured features requires a lot of human participation.

Method used

Using a method based on word embedding vector technology, by receiving text classification requests, text data mapping, maximum value operations and splicing are performed, and input into the probability distribution model to obtain prediction results, reducing costs and improving efficiency.

Benefits of technology

It improves the performance of text classification, reduces costs, improves work efficiency, and reduces dependence on human resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111414474B
    Figure CN111414474B
Patent Text Reader

Abstract

The embodiment of the present application belongs to the field of artificial intelligence, and relates to a text classification method based on word embedding vector technology, including: receiving a text classification request sent by a user terminal, the text classification request carries at least original text data; responding to the text classification request, mapping the original text data to obtain unit vector data; performing an extremum operation on the unit vector data to obtain extremum vector data, the extremum vector data includes maximum value vector data and minimum value vector data; performing a splicing operation on the unit vector data and the extremum vector data to obtain a target text vector; inputting the target text vector into a preset probability distribution model to obtain a probability prediction result; outputting the probability prediction result to the user terminal. The present application also provides a text classification device, a computer device, and a storage medium based on word embedding vector technology. The present application can improve the performance of text classification, reduce costs, and improve work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text classification method, apparatus, computer equipment and storage medium. Background Art

[0002] Text classification is the most basic and commonly used task in the field of natural language processing. Its goal is to classify a piece of text into a specific category system and label it with a category. The main application scenarios include article topic classification, conversation intent classification, sentiment classification, opinion mining, spam filtering, etc. In the text classification scenario, the length of the text can affect the difficulty and performance of text classification, and short texts become a difficulty in text classification because they contain limited semantic information. Currently, common short texts include microblogs, tweets, chat conversations, article titles, text messages, etc.

[0003] There is a short text classification method that manually processes unstructured text information to extract text feature information, such as the commonly used term frequency-inverse document frequency (tf-idf) information. After extracting structured features from the text, traditional machine learning methods are used to train the FastText model to obtain a text classification model to achieve the purpose of text classification.

[0004] However, traditional short text classification methods are generally inefficient. The manual extraction of structured features requires the participation of experts in this field and a large amount of manpower to participate in the early feature engineering, which leads to high costs and low work efficiency. Summary of the invention

[0005] The purpose of the embodiment of the present application is to propose a text classification method based on word embedding vector technology, aiming to solve the problems that traditional short text classification methods are generally low in efficiency, high in cost, and low in work efficiency.

[0006] In order to solve the above technical problems, the embodiment of the present application provides a text classification method based on word embedding vector technology, which adopts the following technical solution:

[0007] Receiving a text classification request sent by a user terminal, wherein the text classification request carries at least original text data;

[0008] In response to the text classification request, a mapping operation is performed on the original text data to obtain unit vector data;

[0009] Performing an extremum operation on the unit vector data to obtain extremum vector data, wherein the extremum vector data includes maximum value vector data and minimum value vector data;

[0010] Performing a splicing operation on the unit vector data and the maximum value vector data to obtain a target text vector;

[0011] Inputting the target text vector into a preset probability distribution model to obtain a probability prediction result;

[0012] Output the probability prediction result to the user terminal.

[0013] In order to solve the above technical problems, the embodiment of the present application also provides a text classification device based on word embedding vector technology, which adopts the following technical solution:

[0014] A request receiving module, used for receiving a text classification request sent by a user terminal, wherein the text classification request carries at least original text data;

[0015] A text mapping module, used to respond to the text classification request, perform a mapping operation on the original text data, and obtain unit vector data;

[0016] A vector maximum value module, used for performing a maximum value operation on the unit vector data to obtain maximum value vector data, wherein the maximum value vector data includes maximum value vector data and minimum value vector data;

[0017] A vector concatenation module, used for concatenating the unit vector data and the maximum value vector data to obtain a target text vector;

[0018] A probability prediction module, used to input the target text vector into a preset probability distribution model to obtain a probability prediction result; and

[0019] A result output module is used to output the probability prediction result to the user terminal.

[0020] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0021] The invention comprises a memory and a processor, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the text classification method based on the word embedding vector technology as described above are implemented.

[0022] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0023] The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the text classification method based on the word embedding vector technology as described above are implemented.

[0024] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0025] The present invention application provides a text classification method based on word embedding vector technology, receiving a text classification request sent by a user terminal, the text classification request at least carries original text data; responding to the text classification request, performing a mapping operation on the original text data to obtain unit vector data; performing a maximum value operation on the unit vector data to obtain maximum value vector data, the maximum value vector data includes maximum value vector data and minimum value vector data; performing a splicing operation on the unit vector data and the maximum value vector data to obtain a target text vector; inputting the target text vector into a preset probability distribution model to obtain a probability prediction result; outputting the probability prediction result to the user terminal. The original text data is embedded with vector data through word embedding vector technology, and the text of the embedded vector data is input into the probability distribution model to obtain a probability prediction result, thereby achieving the purpose of text classification, which can effectively improve the performance of text classification, reduce the cost, and effectively improve work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0027] Figure 1 This is a flowchart of the implementation of the text classification method based on word embedding vector technology provided in the first embodiment of the present invention;

[0028] Figure 2 yes Figure 1 Implementation flow chart of step S102;

[0029] Figure 3 This is a flowchart of another text classification method based on word embedding vector technology provided in the first embodiment of the present invention;

[0030] Figure 4 is a structural diagram of a text classification device based on word embedding vector technology provided in Embodiment 2 of the present invention;

[0031] Figure 5 yes Figure 4 A structural schematic diagram of a specific implementation of the text mapping module shown;

[0032] Figure 6 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0034] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0035] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0036] The text classification method based on word embedding vector technology provided in the embodiment of the present invention embeds vector data into original text data through word embedding vector technology, and inputs the text of the embedded vector data into a probability distribution model to obtain a probability prediction result, thereby achieving the purpose of text classification, which can effectively improve the performance of text classification, reduce costs, and effectively improve work efficiency.

[0037] Embodiment 1

[0038] Figure 1 A flowchart for implementing a text classification method based on word embedding vector technology provided in Embodiment 1 of the present invention is shown. For ease of explanation, only the parts related to the present invention are shown.

[0039] In step S101, a text classification request sent by a user terminal is received, where the text classification request at least carries original text data.

[0040] In the embodiment of the present invention, the original text data refers to the short text data applied to the present invention. As an example, the short text data may be microblogs, tweets, chat conversations, article titles, short messages, etc. It should be understood that the examples of short text data here are only for the convenience of understanding and are not used to limit the present invention.

[0041] In step S102, in response to the text classification request, a mapping operation is performed on the original text data to obtain unit vector data.

[0042] In the embodiment of the present invention, the mapping operation refers to displaying the original text data in the form of a vector in a numerical vector space.

[0043] In the embodiment of the present invention, the unit vector data refers to the data displayed in the numerical vector space in the form of a vector obtained after the original text data is subjected to the above-mentioned mapping operation.

[0044] In step S103, an extremum operation is performed on the unit vector data to obtain extremum vector data, wherein the extremum vector data includes maximum value vector data and minimum value vector data.

[0045] In an embodiment of the present invention, the maximum value operation refers to the maximum and minimum value processing of the word average vector after the introduction of max / min on the Embedding layer. As an example, assuming that the input short text is "Ping An Property Insurance", word-embedding is actually a matrix. Assuming that the number of all words is V, and each word is represented by a D-dimensional vector, then word-embedding is a matrix with V rows and D columns, and each row corresponds to a word vector. Assuming that the four words "Ping An Property Insurance" correspond to the 1st, 3rd, 5th, and 10th row vectors of the word-embedding matrix, each vector length is 3 (ie, D = 3), and the corresponding vectors are assumed to be as follows:

[0046] v 平 =[0.1 -0.2 0.5]

[0047] v 安 =[0.22 -0.34 0.17]

[0048] v 产 =[-0.8 -0.4 -0.6]

[0049] v 险 =[0.2 -0.8 0.7]

[0050] The short text vectors obtained by averaging, maxing, and mining are as follows:

[0051]

[0052] v max =[max(0.1,0.22,-0.8,0.2) max(-0.2,-0.34,-0.4,-0.8) max(0.5,0.17,-0.6,0.7)]

[0053] =[0.22 -0.2 0.7]

[0054] v min =[min(0.1,0.22,-0.8,0.2) min(-0.2,-0.34,-0.4,-0.8) min(0.5,0.17,-0.6,0.7)]

[0055] =[-0.8 -0.8 -0.6]

[0056] In step S104, a concatenation operation is performed on the unit vector data and the maximum value vector data to obtain a target text vector.

[0057] In the embodiment of the present invention, the splicing operation refers to splicing the above-mentioned unit vector data, maximum value vector data and minimum value vector data into a set of vector data. As an example, the short text vectors obtained by averaging, maxing and mining are as follows:

[0058]

[0059] v max =[max(0.1,0.22,-0.8,0.2) max(-0.2,-0.34,-0.4,-0.8) max(0.5,0.17,-0.6,0.7)]

[0060] =[0.22 -0.2 0.7]

[0061] v min =[min(0.1,0.22,-0.8,0.2) min(-0.2,-0.34,-0.4,-0.8) min(0.5,0.17,-0.6,0.7)]

[0062] =[-0.8 -0.8 -0.6]

[0063] Then, after splicing, we get:

[0064] v concate =concate(v ave ,v max ,v min )

[0065] =[-0.07 -0.435 0.1925 0.22 -0.2 0.7 -0.8 -0.8 -0.6]

[0066] In an embodiment of the present invention, Max / min processing is performed on each dimension of all word vectors, and the maximum / minimum values ​​of each dimension of all word vectors are extracted and spliced ​​into two additional vectors. The dimensions of these two vectors and the averaged vector are consistent with the dimensions of the word vectors and are not affected by the number of words in the input layer. The three vectors obtained are finally spliced ​​row by row to obtain the final embedding vector, that is, the above-mentioned target text vector.

[0067] In step S105, the target text vector is input into a preset probability distribution model to obtain a probability prediction result.

[0068] In the embodiment of the present invention, the probability distribution model is used to output the predicted probability distribution of each category.

[0069] In step S106, the probability prediction result is output to the user terminal.

[0070] In an embodiment of the present invention, a text classification method based on word embedding vector technology is provided, receiving a text classification request sent by a user terminal, the text classification request carrying at least original text data; in response to the text classification request, mapping operation is performed on the original text data to obtain unit vector data; maximum value operation is performed on the unit vector data to obtain maximum value vector data, the maximum value vector data includes maximum value vector data and minimum value vector data; splicing operation is performed on the unit vector data and the maximum value vector data to obtain a target text vector; the target text vector is input into a preset probability distribution model to obtain a probability prediction result; and the probability prediction result is output to the user terminal. The original text data is embedded into vector data through word embedding vector technology, and the text of the embedded vector data is input into the probability distribution model to obtain a probability prediction result, thereby achieving the purpose of text classification, which can effectively improve the performance of text classification, reduce the cost, and effectively improve work efficiency.

[0071] Continue to refer Figure 2 , showing Figure 1 For the sake of convenience, only the part related to the present invention is shown in the implementation flow chart of step S102.

[0072] As some optional implementations of the first embodiment, the above step S102 specifically includes: step S201 and step S202.

[0073] In step S201, the original text data is segmented to obtain unit text data.

[0074] In the embodiment of the present invention, the word segmentation operation refers to dividing the text of the original text data into single characters or word units.

[0075] In step S202, the unit text data is imported into the Embedding layer and the Chinese language model to obtain the unit vector data, which at least carries a semantic vector and word order information.

[0076] In the embodiment of the present invention, the Embedding layer can realize vector mapping; the Chinese language model can add word order feature information to a single character or word unit.

[0077] In the embodiment of the present invention, considering that the input of a single character or word does not capture the order information in the original text sequence, the word order information is supplemented by introducing N-gram features, that is, by utilizing the collocation information between adjacent words in the context of the original text, the collocation information is imported into the Chinese language model to obtain the word order feature information, thereby increasing the feature data of the original text data, which can effectively improve the performance of text classification.

[0078] As some optional implementations of the first embodiment, the above step S202 specifically includes the following steps:

[0079] The Chinese language model is de-stored based on a hashing method.

[0080] In the embodiment of the present invention, the hashing method refers to hashing, which is a method of converting a character string composed of characters into a numerical value or index value of a fixed length (generally a shorter length), which can effectively reduce the storage size of the Chinese language model.

[0081] In some optional implementations of the first embodiment, the above-mentioned probability distribution model is calculated based on a normalized exponential function, and the calculation is accelerated by constructing a Huffman coding tree.

[0082] In the embodiment of the present invention, the normalized exponential function refers to a softmax function.

[0083] In practical applications, when the number of categories is large, the exponential calculation in the original softmax function will affect the speed of model training. Therefore, a Huffman coding tree is constructed to speed up the calculation of the softmax layer.

[0084] Among them, the function of the Softmax layer is to output the probability of each category. According to the calculation formula of softmax:

[0085]

[0086] In order to calculate the j-th category c j The probability p(c j ), the denominator needs to be The exponential operation is very time-consuming. Therefore, if the number of categories C is large, C exponential operations need to be performed, resulting in a large amount of calculation in the denominator.

[0087] In order to reduce p(c j ) is calculated, and a Huffman coding tree is constructed with C categories as leaf nodes. On average, the height of the Huffman tree of C leaf nodes is log(C). There is a unique path from the root node to the leaf node corresponding to a certain category, and the path length is log(C). The values ​​corresponding to the non-leaf nodes along the way are multiplied and used as p(c j ), we can see that only log(C) product calculations are required, which is much less than C exponential operations.

[0088] Continue to refer Figure 3 , shows an implementation flow chart of another text classification method based on word embedding vector technology provided in Example 1 of the present invention. For the sake of convenience of explanation, only the parts related to the present invention are shown.

[0089] As some optional implementations of the first embodiment, after the above step S105, the following are further included: step S301 and step S302.

[0090] In step S301, the probability prediction result is optimized based on the cross entropy loss function to obtain a probability optimization result.

[0091] In step S302, the probability optimization result is output to the user terminal.

[0092] In the embodiment of the present invention, in order to measure the difference between the predicted probability distribution and the actual probability distribution, Cross-Entropy is selected as the loss function, and Adam is selected as the corresponding optimization algorithm.

[0093] In some optional implementations of the first embodiment, the cross entropy loss function includes an L2 regularization term.

[0094] In the embodiment of the present invention, the L2 regularization term refers to adding The square of the norm of parameter W.

[0095] In the embodiment of the present invention, considering that the model is prone to overfitting, an L2 regularization term is added to the loss function to avoid the occurrence of high weight values.

[0096] In summary, the present invention provides a text classification method based on word embedding vector technology, receiving a text classification request sent by a user terminal, the text classification request at least carrying original text data; responding to the text classification request, performing a mapping operation on the original text data to obtain unit vector data; performing an extremum operation on the unit vector data to obtain extremum vector data, the extremum vector data including maximum value vector data and minimum value vector data; performing a splicing operation on the unit vector data and the extremum vector data to obtain a target text vector; inputting the target text vector into a preset probability distribution model to obtain a probability prediction result; and outputting the probability prediction result to the user terminal. By embedding vector data into the original text data through word embedding vector technology, and inputting the text of the embedded vector data into the probability distribution model, a probability prediction result is obtained, thereby achieving the purpose of text classification, which can effectively improve the performance of text classification, reduce the cost, and effectively improve work efficiency. At the same time, considering that the input of a single character or word does not capture the sequential information in the original text sequence, the word order information is supplemented by introducing N-gram features, that is, by utilizing the collocation information between adjacent words in the context of the original text, the collocation information is imported into the Chinese language model to obtain the word order feature information, thereby increasing the feature data of the original text data and effectively improving the performance of text classification; based on the hashing method, the Chinese language model is de-stored, which can effectively reduce the storage size of the Chinese language model; and the L2 regularization term is added to the loss function to avoid the appearance of high weight values.

[0097] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0098] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0099] Embodiment 2

[0100] Further references Figure 4 , as a response to the above Figure 1 The present application provides a text classification device based on word embedding vector technology, and the device embodiment is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0101] like Figure 4 As shown, the text classification device 100 based on word embedding vector technology provided in the second embodiment of the present invention includes: a request receiving module 101, a text mapping module 102, a vector maximum value module 103, a vector concatenation module 104, a probability prediction module 105 and a result output module 106. Among them:

[0102] The request receiving module 101 is used to receive a text classification request sent by a user terminal, wherein the text classification request at least carries original text data;

[0103] A text mapping module 102, configured to respond to the text classification request, perform a mapping operation on the original text data, and obtain unit vector data;

[0104] A vector maximum value module 103 is used to perform a maximum value operation on the unit vector data to obtain maximum value vector data, wherein the maximum value vector data includes maximum value vector data and minimum value vector data;

[0105] A vector concatenation module 104 is used to concatenate the unit vector data and the maximum value vector data to obtain a target text vector;

[0106] A probability prediction module 105, configured to input the target text vector into a preset probability distribution model to obtain a probability prediction result; and

[0107] The result output module 106 is used to output the probability prediction result to the user terminal.

[0108] In the embodiment of the present invention, the original text data refers to the short text data applied to the present invention. As an example, the short text data may be microblogs, tweets, chat conversations, article titles, short messages, etc. It should be understood that the examples of short text data here are only for the convenience of understanding and are not used to limit the present invention.

[0109] In the embodiment of the present invention, the mapping operation refers to displaying the original text data in the form of a vector in a numerical vector space.

[0110] In the embodiment of the present invention, the unit vector data refers to the data displayed in the numerical vector space in the form of a vector obtained after the original text data is subjected to the above-mentioned mapping operation.

[0111] In an embodiment of the present invention, the maximum value operation refers to the maximum and minimum value processing of the word average vector after the introduction of max / min on the Embedding layer. As an example, assuming that the input short text is "Ping An Property Insurance", word-embedding is actually a matrix. Assuming that the number of all words is V, and each word is represented by a D-dimensional vector, then word-embedding is a matrix with V rows and D columns, and each row corresponds to a word vector. Assuming that the four words "Ping An Property Insurance" correspond to the 1st, 3rd, 5th, and 10th row vectors of the word-embedding matrix, each vector length is 3 (ie, D = 3), and the corresponding vectors are assumed to be as follows:

[0112] v 平 =[0.1 -0.2 0.5]

[0113] v 安 =[0.22 -0.34 0.17]

[0114] v 产 =[-0.8 -0.4 -0.6]

[0115] v 险 =[0.2 -0.8 0.7]

[0116] The short text vectors obtained by averaging, maxing, and mining are as follows:

[0117]

[0118] v max =[max(0.1,0.22,-0.8,0.2) max(-0.2,-0.34,-0.4,-0.8) max(0.5,0.17,-0.6,0.7)]

[0119] =[0.22 -0.2 0.7]

[0120] v min =[min(0.1,0.22,-0.8,0.2) min(-0.2,-0.34,-0.4,-0.8) min(0.5,0.17,-0.6,0.7)]

[0121] =[-0.8 -0.8 -0.6]

[0122] In the embodiment of the present invention, the splicing operation refers to splicing the above-mentioned unit vector data, maximum value vector data and minimum value vector data into a set of vector data. As an example, the short text vectors obtained by averaging, maxing and mining are as follows:

[0123]

[0124] v max =[max(0.1,0.22,-0.8,0.2) max(-0.2,-0.34,-0.4,-0.8) max(0.5,0.17,-0.6,0.7)]

[0125] =[0.22 -0.2 0.7]

[0126] v min =[min(0.1,0.22,-0.8,0.2) min(-0.2,-0.34,-0.4,-0.8) min(0.5,0.17,-0.6,0.7)]

[0127] =[-0.8 -0.8 -0.6]

[0128] Then, after splicing, we get:

[0129] v concate =concate(v ave ,v max ,v min )

[0130] =[-0.07 -0.435 0.1925 0.22 -0.2 0.7 -0.8 -0.8 -0.6]

[0131] In an embodiment of the present invention, Max / min processing is performed on each dimension of all word vectors, and the maximum / minimum values ​​of each dimension of all word vectors are extracted and spliced ​​into two additional vectors. The dimensions of these two vectors and the averaged vector are consistent with the dimensions of the word vectors and are not affected by the number of words in the input layer. The three vectors obtained are finally spliced ​​row by row to obtain the final embedding vector, that is, the above-mentioned target text vector.

[0132] In the embodiment of the present invention, the probability distribution model is used to output the predicted probability distribution of each category.

[0133] In an embodiment of the present invention, a text classification device based on word embedding vector technology is provided. The original text data is embedded into vector data through the word embedding vector technology, and the text of the embedded vector data is input into a probability distribution model to obtain a probability prediction result, thereby achieving the purpose of text classification, which can effectively improve the performance of text classification, reduce costs, and effectively improve work efficiency.

[0134] In some optional implementations of the second embodiment of the present invention, such as Figure 5 As shown, the text mapping module 102 includes: a text segmentation submodule 1021 and a text mapping submodule 1022. Among them:

[0135] The text segmentation submodule 1021 is used to perform a segmentation operation on the original text data to obtain unit text data;

[0136] The text mapping submodule 1022 is used to import the unit text data into the Embedding layer and the Chinese language model to obtain the unit vector data, which at least carries the semantic vector and word order information.

[0137] In the embodiment of the present invention, the word segmentation operation refers to dividing the text of the original text data into single characters or word units.

[0138] In the embodiment of the present invention, the Embedding layer can realize vector mapping; the Chinese language model can add word order feature information to a single character or word unit.

[0139] In the embodiment of the present invention, considering that the input of a single character or word does not capture the order information in the original text sequence, the word order information is supplemented by introducing N-gram features, that is, by utilizing the collocation information between adjacent words in the context of the original text, the collocation information is imported into the Chinese language model to obtain the word order feature information, thereby increasing the feature data of the original text data, which can effectively improve the performance of text classification.

[0140] In some optional implementations of the second embodiment of the present invention, the text mapping submodule 1022 includes: a storage reduction submodule. Among them:

[0141] The storage reduction submodule is used to perform storage reduction operation on the Chinese language model based on the hashing method.

[0142] In the embodiment of the present invention, the hashing method refers to hashing, which is a method of converting a character string composed of characters into a numerical value or index value of a fixed length (generally a shorter length), which can effectively reduce the storage size of the Chinese language model.

[0143] In some optional implementations of the second embodiment of the present invention, the above-mentioned probability distribution model is calculated based on a normalized exponential function, and the calculation is accelerated by constructing a Huffman coding tree.

[0144] In some optional implementations of the second embodiment of the present invention, the above-mentioned text classification device 100 based on word embedding vector technology further includes: an optimization operation submodule and a probability optimization result output submodule.

[0145] in:

[0146] An optimization operation submodule, used to perform an optimization operation on the probability prediction result based on a cross entropy loss function to obtain a probability optimization result;

[0147] The probability optimization result output submodule is used to output the probability optimization result to the user terminal.

[0148] In some optional implementations of the second embodiment of the present invention, the cross entropy loss function includes an L2 regularization term.

[0149] In the embodiment of the present invention, the L2 regularization term is added to the loss function to avoid the occurrence of high weight values.

[0150] In summary, the text classification device based on word embedding vector technology provided by the present invention embeds vector data into the original text data through word embedding vector technology, and inputs the text of the embedded vector data into the probability distribution model to obtain the probability prediction result, thereby achieving the purpose of text classification, which can effectively improve the performance of text classification, reduce the cost, and effectively improve work efficiency. At the same time, considering that the input of a single character or word does not capture the order information in the original text sequence, the word order information is supplemented by introducing N-gram features, that is, by utilizing the collocation information between adjacent words in the context of the original text, the collocation information is imported into the Chinese language model to obtain the word order feature information, thereby increasing the feature data of the original text data, which can effectively improve the performance of text classification; based on the hashing method, the Chinese language model is reduced in storage, which can effectively reduce the storage size of the Chinese language model; the L2 regularization term is added to the loss function to avoid the appearance of high weight values.

[0151] To solve the above technical problems, the present application also provides a computer device. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.

[0152] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 6 with components 61-63, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0153] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with the user terminal through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0154] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk equipped on the computer device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 61 can also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as the program code of the X method, etc. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or are to be output.

[0155] The processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run the program code stored in the memory 61 or process data, such as running the program code of the X method.

[0156] The network interface 63 may include a wireless network interface or a wired network interface. The network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.

[0157] The present application also provides another implementation manner, that is, providing a computer-readable storage medium, wherein the computer-readable storage medium stores an X program, and the X program can be executed by at least one processor to enable the at least one processor to perform the steps of the X method as described above.

[0158] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0159] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A text classification method based on word embedding vector technology, It is characterized in that The steps include: Receiving a text classification request sent by a user terminal, wherein the text classification request carries at least original text data; In response to the text classification request, a mapping operation is performed on the original text data to obtain unit vector data; Performing an extremum operation on the unit vector data to obtain extremum vector data, wherein the extremum vector data includes maximum value vector data and minimum value vector data; Performing a splicing operation on the unit vector data and the maximum value vector data to obtain a target text vector; Inputting the target text vector into a preset probability distribution model to obtain a probability prediction result, wherein the probability distribution model is calculated based on a normalized exponential function and accelerated by constructing a Huffman coding tree; Outputting the probability prediction result to the user terminal; The step of performing a mapping operation on the original text data to obtain unit vector data specifically includes the following steps: Perform word segmentation on the original text data to obtain unit text data; Importing the unit text data into the Embedding layer and the Chinese language model to obtain the unit vector data, where the unit vector data at least carries a semantic vector and word order information; After the step of importing the unit text data into the Embedding layer and the Chinese language model to obtain the unit vector data, the following steps are also included: Performing a storage reduction operation on the Chinese language model based on a hashing method; After the step of inputting the target text vector into a preset probability distribution model to obtain a probability prediction result, the following steps are also included: Performing an optimization operation on the probability prediction result based on a cross entropy loss function to obtain a probability optimization result, wherein the cross entropy loss function includes an L2 regularization term; Output the probability optimization result to the user terminal.

2. A text classification device based on word embedding vector technology, It is characterized in that include: A request receiving module for receiving a text classification request sent by a user terminal, wherein the text classification request carries at least original text data; A text mapping module, used to respond to the text classification request, perform a mapping operation on the original text data, and obtain unit vector data; A vector maximum value module, used for performing a maximum value operation on the unit vector data to obtain maximum value vector data, wherein the maximum value vector data includes maximum value vector data and minimum value vector data; A vector concatenation module, used for concatenating the unit vector data and the maximum value vector data to obtain a target text vector; A probability prediction module, used for inputting the target text vector into a preset probability distribution model to obtain a probability prediction result, wherein the probability distribution model is calculated based on a normalized exponential function and accelerated by constructing a Huffman coding tree; and A result output module, used to output the probability prediction result to the user terminal; The text mapping module includes: a text segmentation submodule and a text mapping submodule, wherein: The text segmentation submodule is used to perform a segmentation operation on the original text data to obtain unit text data; The text mapping submodule is used to import the unit text data into the Embedding layer and the Chinese language model to obtain the unit vector data, where the unit vector data at least carries a semantic vector and word order information; The text mapping submodule includes: a storage reduction submodule, wherein: The storage reduction submodule is used to perform a storage reduction operation on the Chinese language model based on a hashing method; The device further comprises: an optimization operation submodule and a probability optimization result output submodule, wherein: The optimization operation submodule is used to perform an optimization operation on the probability prediction result based on a cross entropy loss function to obtain a probability optimization result, wherein the cross entropy loss function includes an L2 regularization term; The probability optimization result output submodule is used to output the probability optimization result to the user terminal.

3. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the text classification method based on word embedding vector technology as described in claim 1 are implemented.

4. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the text classification method based on word embedding vector technology as claimed in claim 1 are implemented.