A neural network word segmentation method and device for energy e-commerce field
By applying neural network word segmentation method in the field of energy e-commerce, using convolutional neural networks and bidirectional recurrent neural networks to process text information recognized by OCR, the difficulties of traditional word segmentation methods in dealing with ambiguity and unlogged words are solved, and higher word segmentation accuracy and lower system overhead are achieved.
Patent Information
- Application Number
- CN202111181744.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-11
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-10-11
AI Technical Summary
In the field of energy e-commerce, traditional mechanical word segmentation is difficult to deal with ambiguity and unlogged words, while statistics-based word segmentation methods require the support of large-scale annotation corpus, which has a large system overhead.
The neural network word segmentation method for energy e-commerce is adopted. After identifying text through OCR technology, the text information is input into the pre-trained convolutional neural network word segmentation model for word segmentation processing. The two-way recurrent neural network and Viterbi algorithm are used for encoding and decoding to improve the accuracy of word segmentation results.
This method not only optimizes the accuracy of OCR recognition results, but also significantly improves the accuracy of word segmentation results, and can effectively deal with unknown words and ambiguity without the need for a large number of corpus support.
Smart Images

Figure CN113901814B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of energy e-commerce, and in particular to a neural network word segmentation method and device for the field of energy e-commerce. Background Art
[0002] In the field of energy e-commerce, a large amount of data needs to be processed. In some scenarios, after the text is recognized by OCR technology, the recognized text needs to be segmented.
[0003] Traditional mechanical word segmentation methods rely heavily on dictionaries and have difficulty dealing with ambiguity and unregistered words. Although statistical word segmentation methods have strong capabilities in distinguishing ambiguity and discovering new words, they require the support of large-scale annotated corpora and have high system overhead. Summary of the invention
[0004] In view of this, an embodiment of the present invention discloses a neural network word segmentation method for the energy e-commerce field, which not only further optimizes the accuracy of OCR recognition results, but also improves the accuracy of word segmentation results.
[0005] The embodiment of the present invention discloses a neural network word segmentation method for the energy e-commerce field, including:
[0006] The image to be identified is identified through OCR technology to obtain text information;
[0007] Inputting the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result;
[0008] The word segmentation model is obtained by training a convolutional neural network model to be trained with the text in the field of energy e-commerce as training samples, with the purpose of outputting word segmentation results close to standard word segmentation results.
[0009] Optionally, also include:
[0010] The hyperparameters of the hidden layers of the convolutional neural network are set so that different hidden layers of the convolutional neural network learn different features.
[0011] Optionally, the text information is input into a pre-trained word segmentation model for word segmentation processing, including:
[0012] A bidirectional recurrent neural network BiLSTM is used to process the text information from the beginning and the end of the text information respectively;
[0013] Encoding context information of the text information;
[0014] Use Viterbi algorithm to encode and output the encoding result;
[0015] The encoding result is decoded to obtain a word segmentation result.
[0016] Optionally, the training process of the word segmentation model includes:
[0017] Build a convolutional neural network model;
[0018] Obtaining training samples; the training samples are text information in the field of energy e-commerce;
[0019] The training samples are input into a convolutional neural network model, and the convolutional neural network model is trained with the purpose of outputting word segmentation results for the training samples by the convolutional neural network model close to standard word segmentation results.
[0020] Optionally, also include:
[0021] In the process of training the convolutional neural network, the parameters of the convolutional neural network are trained through an iterative method to obtain the optimal parameters.
[0022] The embodiment of the present invention discloses a neural network word segmentation device for the energy e-commerce field, including:
[0023] A recognition unit, used for recognizing the image to be recognized by using OCR technology to obtain text information;
[0024] A word segmentation unit is used to input the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result;
[0025] The word segmentation model is obtained by training a convolutional neural network model to be trained with the text in the field of energy e-commerce as training samples, with the purpose of outputting word segmentation results close to standard word segmentation results.
[0026] Optionally, also include:
[0027] A setting unit is used to set the hyperparameters of the hidden layer of the convolutional neural network so that different hidden layers of the convolutional neural network learn different features.
[0028] Optionally, the word segmentation unit includes:
[0029] A first processing unit is used to process the text information from the beginning and the end of the sentence respectively using a bidirectional recurrent neural network BiLSTM;
[0030] A first encoding unit, used to encode the context information of the text information;
[0031] The second encoding unit is used to perform encoding using a Viterbi algorithm and output an encoding result;
[0032] The decoding unit is used to decode the encoding result to obtain a word segmentation result.
[0033] Optionally, also include:
[0034] Training unit for:
[0035] Obtaining training samples; the training samples are text information in the field of energy e-commerce;
[0036] The training samples are input into a convolutional neural network model, and the convolutional neural network model is trained with the purpose of making the output word segmentation results of the convolutional neural network model for the training samples close to the standard word segmentation results.
[0037] An embodiment of the present invention discloses an electronic device, including:
[0038] Memory and processor;
[0039] The memory is used to store programs, and the processor is used to execute the above-mentioned neural network word segmentation method for the energy e-commerce field.
[0040] The embodiment of the present invention discloses a neural network word segmentation method and device for the energy e-commerce field, the method comprising: recognizing an image to be recognized by OCR technology to obtain text information, and performing word segmentation processing on the text information based on a pre-trained word segmentation model to obtain a word segmentation result, wherein the word segmentation model is obtained by training a convolutional neural network model to be trained with the text in the energy e-commerce field as a training sample, with the output word segmentation result being close to the standard word segmentation result. Therefore, the word segmentation of the text information by the convolutional neural network can further optimize the accuracy of the OCR recognition result and improve the accuracy of the word segmentation result. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0042] Figure 1 A schematic diagram of a process flow of a neural network word segmentation method for the energy e-commerce field provided by an embodiment of the present invention is shown;
[0043] Figure 2 A schematic diagram of the process of training a convolutional neural network is shown;
[0044] Figure 3A schematic diagram of the structure of a neural network word segmentation device for the energy e-commerce field provided by an embodiment of the present invention is shown;
[0045] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] In the field of energy e-commerce, when customer service automatically replies to users' questions, if an image is received, the image needs to be recognized and the recognized text needs to be segmented, so as to reply based on the segmentation result. The segmentation method used in the prior art has two problems. The dictionary-based segmentation method is difficult to handle ambiguity and unknown words, and the statistical-based segmentation method requires large-scale annotated corpus support, and the system overhead is large.
[0048] In order to solve the above problems, after the OCR recognizes the text information, the embodiment of the present invention performs word segmentation on the recognized text information based on a pre-trained convolutional neural network model (expressed as a word segmentation model), wherein the word segmentation model uses the text in the field of energy e-commerce as a training sample, and trains the convolutional neural network model to be trained with the purpose of outputting word segmentation results close to the standard word segmentation results.
[0049] Therefore, the pre-trained convolutional neural network model not only has the ability to segment words, but also does not require the support of a large amount of corpus. The trained convolutional neural network model can also recognize unknown words based on the learning function. In addition, it can recognize ambiguous words, thereby improving the accuracy of the word segmentation results.
[0050] refer to Figure 1 , shows a schematic diagram of a process of a neural network word segmentation method for the energy e-commerce field provided by an embodiment of the present invention. In this embodiment, the method includes:
[0051] S101: Recognize the image to be recognized by using OCR technology to obtain text information;
[0052] In this embodiment, OCR (Chinese full name: Optical Character Recognition, English full name: Optical Character Recognition) technology can recognize text from an image. Among them, OCR can be roughly divided into dedicated OCR for recognizing specific scenes and general OCR for recognizing multiple scenes. Up to now, OCR technology has been widely used in various fields.
[0053] S102: Inputting the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result;
[0054] The word segmentation model is obtained by training a convolutional neural network model using texts in the energy e-commerce field as training samples.
[0055] In this embodiment, reference Figure 2 , the training process of the word segmentation model includes:
[0056] S201: Build a convolutional neural network model;
[0057] S202: Acquire training samples; the training samples are text information in the field of energy e-commerce;
[0058] S203: Input the training samples into the convolutional neural network model, and train the convolutional neural network model with the goal of making the word segmentation results output by the convolutional neural network model for the training samples close to the standard word segmentation results.
[0059] In this embodiment, the constructed convolutional neural network model can be any convolutional neural network model. Optionally, the constructed convolutional neural network model can include: a bidirectional recurrent neural network BiLSTM, a coding layer, and a CRF layer.
[0060] Among them, the bidirectional recurrent neural network (BiLSTM) is composed of two unidirectional recurrent neural networks, one of which is forward over time and the other is reverse over time. The implementation of the reverse network essentially reverses the input sequence and then inputs it into the forward network.
[0061] In this embodiment, in the CRF layer, the Viterbi algorithm is used for encoding to obtain a global optimal solution.
[0062] Based on the network constructed above, the processing process of the convolutional neural network includes:
[0063] A bidirectional recurrent neural network BiLSTM is used to process the text information from the beginning and the end of the text information respectively;
[0064] Encoding context information of the text information;
[0065] Use Viterbi algorithm to encode and output the encoding result;
[0066] The encoding result is decoded to obtain a word segmentation result.
[0067] In addition, before training the convolutional neural network, the hyperparameters of the hidden layer of the convolutional neural network are set in advance, so that different hidden layers of the convolutional neural network can learn different features.
[0068] It can be seen that the setting of the hyperparameters of the hidden layer of the convolutional neural network is set with the purpose of enabling different hidden layers of the convolutional neural network to learn different features. Optionally, the hyperparameters of each hidden layer can be set by a technician or determined through simulation based on preset rules.
[0069] In this embodiment, the constructed convolutional neural network model adds hidden layer neuron nodes, each layer learns different features in the data, integrates different features, and thus obtains complex features.
[0070] In this embodiment, during the training process of the entire neural network, each hidden layer of the neural network learns different features of the text in the field of energy e-commerce to fully reflect the advantages and essence of deep learning. The entire training process can be divided into two stages. First, the bidirectional recurrent neural network BiLSTM is used to process the input from the beginning and end of the sentence respectively, and the context information is encoded to improve the prediction effect. Then, a CRF layer is added to the entire model, and the Viterbi algorithm is used for encoding to obtain the global optimal solution, avoid the local optimal solution, and finally complete the entire word segmentation process.
[0071] In addition, before training the convolutional neural network, initial parameters need to be set, where the initial parameters can be set by technicians based on experience or obtained through simulation.
[0072] The initial parameters are set based on the following rules: shorten the training time.
[0073] In this embodiment, in order to shorten the training time as much as possible, in this embodiment, when training the convolutional neural network, the initial parameters are continuously adjusted, thereby achieving the purpose of shortening the training time.
[0074] In addition, in the process of training the convolutional neural network, the convolutional neural network is trained through an iterative method to obtain the optimal parameters.
[0075] The trained convolutional neural network model is represented as a word segmentation model. The text information recognized by the OCR technology is input into the word segmentation model. The processing process of the word segmentation model includes:
[0076] A bidirectional recurrent neural network BiLSTM is used to process the text information from the beginning and the end of the text information respectively;
[0077] Encoding context information of the text information;
[0078] Use Viterbi algorithm to encode and output the encoding result;
[0079] The encoding result is decoded to obtain a word segmentation result.
[0080] In this embodiment, the image to be recognized is recognized by OCR technology to obtain text information, and the text information is segmented based on a pre-trained word segmentation model to obtain a word segmentation result, wherein the word segmentation model is obtained by training the convolutional neural network model to be trained with the text in the field of energy e-commerce as a training sample, with the output word segmentation result approaching the standard word segmentation result. Therefore, the convolutional neural network can further optimize the accuracy of the OCR recognition result by performing word segmentation on the text information, and improve the accuracy of the word segmentation result.
[0081] refer to Figure 3 , shows a schematic diagram of the structure of a neural network word segmentation device for the energy e-commerce field provided by an embodiment of the present invention. In this embodiment, the device includes:
[0082] The recognition unit 301 is used to recognize the image to be recognized by using OCR technology to obtain text information;
[0083] The word segmentation unit 302 is used to input the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result;
[0084] The word segmentation model is obtained by training a convolutional neural network model to be trained with the text in the field of energy e-commerce as training samples, with the purpose of outputting word segmentation results close to standard word segmentation results.
[0085] Optionally, also include:
[0086] The hyperparameters of the hidden layers of the convolutional neural network are set so that different hidden layers of the convolutional neural network learn different features.
[0087] Optionally, the word segmentation unit includes:
[0088] A first processing unit is used to process the text information from the beginning and the end of the sentence respectively using a bidirectional recurrent neural network BiLSTM;
[0089] A first encoding unit, used to encode the context information of the text information;
[0090] The second encoding unit is used to perform encoding using a Viterbi algorithm and output an encoding result;
[0091] The decoding unit is used to decode the encoding result to obtain a word segmentation result.
[0092] Optionally, also include:
[0093] Training unit for:
[0094] Obtaining training samples; the training samples are text information in the field of energy e-commerce;
[0095] The training samples are input into a convolutional neural network model, and the convolutional neural network model is trained with the purpose of making the output word segmentation results of the convolutional neural network model for the training samples close to the standard word segmentation results.
[0096] The device of this embodiment recognizes the image to be recognized by OCR technology to obtain text information, and performs word segmentation processing on the text information based on a pre-trained word segmentation model to obtain a word segmentation result, wherein the word segmentation model is obtained by training the convolutional neural network model to be trained with the text in the field of energy e-commerce as a training sample, with the output word segmentation result being close to the standard word segmentation result. Therefore, the word segmentation of the text information by the convolutional neural network can further optimize the accuracy of the OCR recognition result and improve the accuracy of the word segmentation result.
[0097] refer to Figure 4 , shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, including:
[0098] Memory 401 and processor 402;
[0099] The memory is used to store programs, and the processor is used to execute the following neural network word segmentation method for the energy e-commerce field:
[0100] The image to be identified is identified through OCR technology to obtain text information;
[0101] Inputting the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result;
[0102] The word segmentation model is obtained by training a convolutional neural network model to be trained with the text in the field of energy e-commerce as training samples, with the purpose of outputting word segmentation results close to standard word segmentation results.
[0103] Optionally, also include:
[0104] The hyperparameters of the hidden layers of the convolutional neural network are set so that different hidden layers of the convolutional neural network learn different features.
[0105] Optionally, the text information is input into a pre-trained word segmentation model for word segmentation processing, including:
[0106] A bidirectional recurrent neural network BiLSTM is used to process the text information from the beginning and the end of the text information respectively;
[0107] Encoding context information of the text information;
[0108] Use Viterbi algorithm to encode and output the encoding result;
[0109] The encoding result is decoded to obtain a word segmentation result.
[0110] Optionally, the training process of the word segmentation model includes:
[0111] Build a convolutional neural network model;
[0112] Obtaining training samples; the training samples are text information in the field of energy e-commerce;
[0113] The training samples are input into a convolutional neural network model, and the convolutional neural network model is trained with the purpose of outputting word segmentation results for the training samples by the convolutional neural network model close to standard word segmentation results.
[0114] Optionally, also include:
[0115] In the process of training the convolutional neural network, the parameters of the convolutional neural network are trained through an iterative method to obtain the optimal parameters.
[0116] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0117] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A neural network word segmentation method for the energy e-commerce field, characterized in that: include: The image to be identified is identified through OCR technology to obtain text information; Inputting the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result; The word segmentation model is obtained by training a convolutional neural network model to be trained with the text in the field of energy e-commerce as a training sample, with the output word segmentation results approaching the standard word segmentation results; The step of inputting the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result includes: A bidirectional recurrent neural network BiLSTM is used to process the text information from the beginning and the end of the text information respectively; Encoding context information of the text information; Use Viterbi algorithm to encode and output the encoding result; Decoding the encoding result to obtain a word segmentation result; The method further includes: setting hyperparameters of the hidden layers of the convolutional neural network so that different hidden layers of the convolutional neural network learn different features; The method also includes: in the process of training the convolutional neural network, training the parameters of the convolutional neural network by an iterative method to obtain optimal parameters.
2. The method according to claim 1, characterized in that The training process of the word segmentation model includes: Build a convolutional neural network model; Obtaining training samples; the training samples are text information in the field of energy e-commerce; The training samples are input into a convolutional neural network model, and the convolutional neural network model is trained with the purpose of outputting word segmentation results for the training samples by the convolutional neural network model close to standard word segmentation results.
3. A neural network word segmentation device for the energy e-commerce field, characterized in that: include: A recognition unit, used for recognizing the image to be recognized by using OCR technology to obtain text information; A word segmentation unit is used to input the text information into a pre-trained word segmentation model for word segmentation processing to obtain a word segmentation result; The word segmentation model is obtained by training a convolutional neural network model to be trained with the text in the field of energy e-commerce as a training sample, with the output word segmentation results approaching the standard word segmentation results; The word segmentation unit comprises: A first processing unit is used to process the text information from the beginning and the end of the sentence respectively using a bidirectional recurrent neural network BiLSTM; A first encoding unit, used to encode the context information of the text information; The second encoding unit is used to perform encoding using a Viterbi algorithm and output an encoding result; A decoding unit, used to decode the encoding result to obtain a word segmentation result; The device also includes: a setting unit, configured to set the hyperparameters of the hidden layer of the convolutional neural network so that different hidden layers of the convolutional neural network learn different features; The device also includes: a training unit, which is used to train the parameters of the convolutional neural network through an iterative method during the training of the convolutional neural network to obtain optimal parameters.
4. The device according to claim 3, characterized in that Also includes: Training unit for: Obtaining training samples; the training samples are text information in the field of energy e-commerce; The training samples are input into a convolutional neural network model, and the convolutional neural network model is trained with the purpose of making the output word segmentation results of the convolutional neural network model for the training samples close to the standard word segmentation results.
5. An electronic device, characterized in that: include: Memory and processor; The memory is used to store programs, and the processor is used to execute the methods described in claims 1-2.
Citation Information
Patent Citations
Method and device for detecting text information in video and electronic equipment
CN110019817A
Chinese word segmentation method, electronic device and readable storage medium
CN110287961A