Text recognition method, device, electronic device and medium

The text recognition method enhances keyword extraction by using a deep learning model to determine attribute labels and context information, improving recognition accuracy through character and word granularity features.

CN111737455BActive Publication Date: 2024-12-03BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911218504.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-02
Publication Date
2024-12-03
Estimated Expiration
2039-12-02

AI Technical Summary

Technical Problem

Existing text recognition technologies face challenges in accurately obtaining keywords, leading to poor recognition accuracy due to difficulties in identifying attribute labels and context information in text information.

Method used

A text recognition method utilizing a deep learning model to determine attribute labels and context information, combined with a classification model using long short-term memory networks and feature vector fusion, to enhance keyword identification and improve recognition accuracy.

Benefits of technology

The method improves text recognition accuracy by refining keyword extraction through character and word granularity features, effectively distinguishing between spam and non-spam comments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111737455B_ABST
    Figure CN111737455B_ABST
Patent Text Reader

Abstract

The present disclosure provides a text recognition method, including: obtaining text information, the text information includes multiple characters, determining keywords in the text information, determining feature vectors based on the keywords, and inputting the feature vectors into a classification model, so as to analyze the feature vectors using the classification model to determine the recognition result for the text information. Wherein, obtaining keywords in the text information includes: inputting the text information into a deep learning model, so that the deep learning model determines a sequence of attribute labels of the multiple characters based on the multiple characters and the context information of each of the multiple characters. Wherein, the attribute label sequence includes multiple attribute labels, the attribute labels indicate the attribute information of the object to which the text is directed, the multiple attribute labels correspond one-to-one to the multiple characters, and attribute labels that meet preset conditions are determined from the attribute label sequence, and keywords in the text information are determined based on the attribute labels that meet the preset conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and more specifically, to a text recognition method and a text recognition device, electronic device and medium. Background Art

[0002] With the rapid development of artificial intelligence, automatic control, communication and computer technology, more and more people choose to post comments and opinions on the Internet. For example, users can post comments on a certain product on the Internet. However, many of the comments, opinions and other text information posted by users on the Internet are spam. For example, commenting on another object on the evaluation page of a certain object can greatly mislead users. Therefore, it is very important to identify the text posted by users.

[0003] In the related art, when identifying text information, it is usually necessary to segment the text information to obtain keywords in the text information, so as to determine whether the text is junk text information based on the keywords.

[0004] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following technical problems in the related art: it is difficult to accurately obtain keywords in text information, which leads to a technical problem of poor text recognition accuracy. Summary of the invention

[0005] In view of this, the present disclosure provides a text recognition method, a text recognition device, an electronic device, and a medium.

[0006] One aspect of the present disclosure provides a text recognition method, including: obtaining text information including multiple characters, determining keywords in the text information, determining a feature vector based on the keywords, and inputting the feature vector into a classification model, so as to analyze the feature vector using the classification model to determine the recognition result for the text information. Wherein, determining the keywords in the text information includes: inputting the text information into a deep learning model, so that the deep learning model determines a sequence of attribute labels of the multiple characters based on multiple characters and context information of each of the multiple characters. Wherein, the attribute label sequence includes multiple attribute labels, the attribute label indicates the attribute information of the object to which the text information is directed, and the multiple attribute labels correspond one-to-one to the multiple characters; and determining the attribute label that meets the preset conditions from the attribute label sequence, and determining the keywords in the text information based on the attribute label that meets the preset conditions.

[0007] According to an embodiment of the present disclosure, determining keywords in text information further includes: inputting the text information into a word segmentation model, and using the word segmentation model to segment the text information to obtain keywords.

[0008] According to an embodiment of the present disclosure, determining a feature vector of a keyword includes: determining a word granularity feature vector of the keyword; determining a character granularity feature vector of the keyword; and determining a feature vector by fusing the word granularity feature vector and the character granularity feature vector.

[0009] According to an embodiment of the present disclosure, the classification model analyzes the feature vector to determine the recognition result, including: the classification model includes multiple long short-term memory network layers, and feature vectors are extracted through the multiple long short-term memory network layers in sequence to obtain deep feature information; and based on the deep feature information, the text information is classified to determine the recognition result.

[0010] According to an embodiment of the present disclosure, the classification model also includes a constant mapping layer, a first fully connected layer and an output layer. Based on the deep feature information, classifying the text information to determine the recognition result includes: fusing the deep feature information and the output information by the constant mapping layer, wherein the output information is a feature vector obtained by processing the first long short-term memory network layer among multiple long short-term memory network layers; and inputting the output result of the constant mapping layer into the first fully connected layer so that the output result is analyzed by the first fully connected layer; and determining the recognition result via the output layer based on the analysis result of the first fully connected layer.

[0011] According to an embodiment of the present disclosure, the method also includes determining the category to which the object belongs, and determining whether the text information is related to the category, wherein determining the keywords in the text information includes: determining the keywords in the text information when the text information is related to the category.

[0012] According to an embodiment of the present disclosure, determining whether text information is related to a category includes: inputting a character vector of each of a plurality of characters into a bidirectional long short-term memory network layer, so that the bidirectional long short-term memory network layer performs feature extraction on the character vector; inputting an extraction result obtained by the feature extraction into a second fully connected layer, so that the second fully connected layer performs analysis on the extraction result to determine the category of the text information, wherein the category includes general text applicable to all categories, special text applicable only to the category, and intrusive text applicable to other categories; in the case where the text information is determined to be general text or special text, determining that the text information is related to the category, and in the case where the text information is determined to be intrusive text, determining that the text information is not related to the category.

[0013] Another aspect of the present disclosure provides a text recognition device, including: an acquisition module for acquiring text information, the text information including multiple characters; a first determination module for determining keywords in the text information; a second determination module for determining feature vectors based on the keywords; and an input module for inputting the feature vectors into a classification model, so as to analyze the feature vectors using the classification model to determine the recognition result for the text information. Wherein, determining the keywords in the text information includes: inputting the text information into a deep learning model, so that the deep learning model determines the attribute label sequence of the multiple characters according to the multiple characters and the context information of each of the multiple characters, wherein the attribute label sequence includes multiple attribute labels, the attribute labels indicate the attribute information of the object to which the text is directed, and the multiple attribute labels correspond to the multiple characters one by one; and determining the attribute labels that meet the preset conditions from the attribute label sequence, and determining the keywords in the text information according to the attribute labels that meet the preset conditions.

[0014] Another aspect of the present disclosure provides an electronic device, comprising one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute any one of the above methods.

[0015] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.

[0016] Another aspect of the present disclosure provides a computer program, which includes computer executable instructions, and the instructions are used to implement the method described above when executed.

[0017] According to the embodiments of the present disclosure, the problem of poor text recognition accuracy can be at least partially solved, and thus the technical effect of improving the accuracy of text recognition can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0019] Figure 1A A flowchart of a text recognition method according to an embodiment of the present disclosure is schematically shown;

[0020] Figure 1B A flowchart schematically illustrates an example method for determining keywords in text information;

[0021] Figure 1CA schematic diagram schematically shows a method of determining an attribute label sequence by a deep learning model BiLSTMCRF according to an embodiment of the present disclosure;

[0022] Figure 2A A schematic diagram schematically shows an example method for determining a feature vector of a keyword according to an embodiment of the present disclosure;

[0023] Figure 2B A schematic diagram schematically shows a method for determining a feature vector of a keyword according to an embodiment of the present disclosure;

[0024] Figure 3A A schematic diagram schematically shows a method of classifying text information based on deep feature information to determine a recognition result according to an embodiment of the present disclosure;

[0025] Figure 3B A schematic diagram of a classification model according to an embodiment of the present disclosure is schematically shown;

[0026] Figure 4 A flowchart of a method for text recognition according to another embodiment of the present disclosure is schematically shown;

[0027] Figure 5A A flowchart of an example method for determining whether text information is related to a category according to an embodiment of the present disclosure is schematically shown;

[0028] Figure 5B An example schematic diagram of a BiLSTM model according to an embodiment of the present disclosure is schematically shown;

[0029] Figure 6 A schematic diagram schematically shows a text recognition method according to another embodiment of the present disclosure;

[0030] Figure 7 A block diagram schematically shows a text recognition device according to an embodiment of the present disclosure; and

[0031] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0032] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0033] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0034] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.

[0035] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0036] An embodiment of the present disclosure provides a method for text recognition. The method includes: obtaining text information including multiple characters, determining keywords in the text information, determining a feature vector based on the keywords, and inputting the feature vector into a classification model to analyze the feature vector using the classification model to determine the recognition result for the text information. Wherein, obtaining the keywords in the text information includes: inputting the text information into a deep learning model, so that the deep learning model determines the attribute label sequence of the multiple characters based on the multiple characters and the context information of each of the multiple characters. Wherein, the attribute label sequence includes multiple attribute labels, the attribute label indicates the attribute information of the object to which the text is directed, the multiple attribute labels correspond one-to-one to the multiple characters, and the attribute labels that meet the preset conditions are determined from the attribute label sequence, and the keywords in the text information are determined based on the attribute labels that meet the preset conditions.

[0037] According to an embodiment of the present disclosure, the text recognition method can be used, for example, to recognize comment information. The comment information can be, for example, an evaluation of a certain product. In the following, the text recognition method according to an embodiment of the present disclosure is described by taking the recognition of comment information in an e-commerce as an example.

[0038] Figure 1A The flowchart of the text recognition method according to the embodiment of the present disclosure is schematically shown.

[0039] like Figure 1A As shown, the method includes operations S101 to S104.

[0040] In operation S101, text information is obtained, and the text information includes a plurality of characters. The text information may be, for example, a plurality of characters input by a user on a client device. The plurality of characters may include, for example, Chinese characters, English characters, etc. The text information may be, for example, text input for commenting on an object in an e-commerce website.

[0041] Specifically, the text information may be, for example, "The logistics is great, and it feels good to the touch." In the following description, this text information is used as an example to illustrate the text recognition method of the present disclosure.

[0042] In operation S102, keywords in the text information are determined. For example, in the above text information, keywords may include "great logistics", "good feel", etc.

[0043] Figure 1B The flowchart schematically shows an example method for determining keywords in text information in operation S102.

[0044] like Figure 1B As shown, the method may include operation S112 and operation S122.

[0045] In operation S112, the text information is input into a deep learning model, so that the deep learning model determines an attribute tag sequence of the multiple characters according to the multiple characters and context information of each of the multiple characters. The attribute tag sequence includes multiple attribute tags, the attribute tags indicate attribute information of the object targeted by the text information, and the multiple attribute tags correspond to the multiple characters one by one.

[0046] For example, the deep learning model determines the attribute label sequence in "The logistics is great, and it feels good to touch." The attribute label sequence can be, for example, B-TYPE_1, I-TYPE_1, I-TYPE_1, I-TYPE_1, O, O, O, B-TYPE_9, I-TYPE_9, B-TYPE_9, I-TYPE_9, O. Among them, the attribute label containing TYPE_1 represents the logistics information of the object to which the comment is directed, the attribute label containing TYPE_9 represents the physical feeling information of the object to which the comment is directed, and the attribute label of O represents that the character does not belong to the word used to describe the attributes of the object. Among them, the attribute label containing "B" can be, for example, the first character of a word, and the attribute label containing "I" can represent, for example, a non-first character of a word.

[0047] According to an embodiment of the present disclosure, the deep learning model can be, for example, a BiLSTMCRF model (Bidirectional Long Short-Term Memory Network and Conditional Random Field model).

[0048] Figure 1C A schematic diagram showing the determination of an attribute tag sequence by the deep learning model BiLSTMCRF according to an embodiment of the present disclosure is schematically illustrated.

[0049] As Figure 1C shown, the deep learning model BiLSTMCRF can include a bidirectional LSTM (i.e., a forward LSTM and a backward LSTM), a fusion output layer, and a CRF (Conditional Random Field) layer. Among them, LSTM (Long Short-Term Memory) is a long short-term memory network.

[0050] As Figure 1C shown, the initialization vectors of each character in the comment information (for example, X1 to X5) are respectively input into the forward LSTM and the backward LSTM according to the time sequence. The fusion output layer fuses the output results of the forward LSTM and the backward LSTM. For example, for the character "物", the feature H f,1 of "物" can be analyzed by the forward LSTM, and the feature H b,1 of "物" can be analyzed by the backward LSTM. The fusion output layer fuses the feature H f,1 and the feature H b,1 to obtain a vector P1. Among them, the fusion can be, for example, concatenating the feature H f,1 and the feature H b,1 . The vectors of multiple characters obtained after fusion (for example, P1 to P5) are respectively input into the CRF layer, and the CRF layer predicts and outputs the attribute tag corresponding to the character according to the context information.

[0051] For example, in the scenario shown in Figure 1C , the CRF layer predicts that the attribute tags of "物", "流", "很", "棒", and "," can be B-TYPE_1, I-TYPE_1, I-TYPE_1, I-TYPE_1, and O respectively. Among them, B-TYPE_1 can represent the first character of a word describing logistics information, and I-TYPE_1 can represent a non-first character of a word describing logistics information. O represents that the character does not describe the attribute of an object.

[0052] In operation S122, the attribute tags that meet the preset conditions are determined from the attribute tag sequence, and the keywords in the text information are determined according to the attribute tags that meet the preset conditions.

[0053] According to the embodiments of the present disclosure, the attribute labels that meet the preset conditions can be, for example, attribute labels set by those skilled in the art for words that can reflect the attributes of the object based on experience. Specifically, for example, the attribute labels set by those skilled in the art for words that reflect "logistics" can be TYPE_1, the attribute labels set for words that reflect "physical feeling" can be TYPE_9, etc., and the attribute labels for words that cannot reflect the attributes of the object can be set to "0".

[0054] In the above embodiment, the attribute tags that meet the preset conditions may include B-TYPE_1, I-TYPE_1, I-TYPE_1, I-TYPE_1 and B-TYPE_9, I-TYPE_9, B-TYPE_9, I-TYPE_9. Thus, according to these attribute tags, it is determined that the keywords in the review information include "great logistics" and "good feel".

[0055] Return to reference Figure 1A In operation S103, feature vectors are determined based on the keywords. For example, feature vectors of "great logistics" and "good feel" can be determined respectively.

[0056] In operation S104, the feature vector is input into a classification model, so as to analyze the feature vector using the classification model to determine a recognition result for the text information.

[0057] For example, the feature vectors of "good logistics" and "good feel" can be input into the classification model in sequence, and the classification model analyzes the feature vectors to determine whether the review information is a spam review. Spam reviews can be, for example, reviews that mislead potential consumers or reviews that fail to provide the characteristics of the reviewed object.

[0058] According to the embodiments of the present disclosure, the text recognition method uses a deep learning model to determine the attribute label of each word in the text information. The attribute label can be a word that is pre-summarized by a person skilled in the art to describe the attribute of an object, and the words describing the same attribute are classified into one category, and different attribute labels are assigned to each category of words, so as to extract keywords from the text information according to the attribute labels. Therefore, the text recognition method enhances the word granularity feature, thereby improving the accuracy of text recognition.

[0059] According to an embodiment of the present disclosure, in operation S102, determining the keywords in the text information may further include: inputting the text information into a word segmentation model, and performing word segmentation on the text information using the word segmentation model to obtain the keywords.

[0060] According to an embodiment of the present disclosure, the word segmentation model may be, for example, some word segmentation tools in the related art, and text information is input into the word segmentation tool to obtain keywords. In addition to the keywords obtained by the method of operation S102, the keywords determined by the method also include keywords obtained by segmenting the text information using the word segmentation tool.

[0061] Those skilled in the art can understand that using a word segmentation model to segment text information can easily lead to incorrect word segmentation, thereby destroying the integrity of the word. If only a word segmentation model is used to segment text information to obtain keywords, the obtained keywords are inaccurate, which will lead to inaccurate recognition of the text information. According to the technical solution of the present disclosure, keywords can be extracted from text information based on the attributes of each character, thereby enhancing the word granularity characteristics of the text information and improving the accuracy of text recognition.

[0062] According to the embodiments of the present disclosure, the words summarized by those skilled in the art for describing the attributes of an object are often incomplete, which may easily lead to incomplete keywords obtained in operation S102, thereby affecting the accuracy of text recognition. According to the embodiments of the present disclosure, the keywords obtained by the method of operation S102 and the keywords obtained by the word segmentation tool at the same time can enhance the word granularity characteristics of the text information while ensuring that comprehensive keywords are obtained, thereby further improving the accuracy of text recognition.

[0063] Figure 2A The following schematically shows a method for determining a feature vector of a keyword in operation S103 according to an embodiment of the present disclosure.

[0064] like Figure 2A As shown, the method may include operations S113 to S133.

[0065] In operation S113, a word granularity feature vector of the keyword is determined.

[0066] According to an embodiment of the present disclosure, a word granularity feature vector may be a vector used to represent the features of a keyword at the word granularity. For example, if the keyword is "logistics is great", the vector generated by initializing "logistics is great" may be used as the word granularity feature vector of "logistics is great". According to an embodiment of the present disclosure, for example, a word granularity feature vector of a keyword may be generated by initializing a neural network model.

[0067] In operation S123, a word granularity feature vector of the keyword is determined.

[0068] According to the embodiments of the present disclosure, the word-granularity feature vector may be a vector used to represent the features of a keyword at the word-granularity. For example, CNN (Convolutional Neural Networks) may be used to extract the word-granularity feature vector for each word. The word vectors generated by initializing each word in the keyword "logistics is great" are used as the input of CNN, the convolution layer of CNN extracts features, and the pooling layer of CNN extracts the main features, thereby obtaining the sub-granularity feature vector of "logistics is great".

[0069] In operation S133, a feature vector is determined by fusing the word granularity feature vector and the character granularity feature vector.

[0070] According to an embodiment of the present disclosure, the fusion may be, for example, concatenating the word granularity feature vector and the character granularity feature vector, and using the vector obtained by concatenating the word granularity feature vector and the character granularity feature vector as the feature vector of the keyword.

[0071] According to an embodiment of the present disclosure, fusion may be, for example, weighted averaging each dimensional element in the word granularity feature with the corresponding dimensional element in the character granularity feature vector to obtain the corresponding dimensional element in the feature vector of the keyword.

[0072] Figure 2B The following schematic diagram shows a method for determining a feature vector of a keyword according to an embodiment of the present disclosure.

[0073] like Figure 2B As shown, the word granularity feature vector 220 and the character granularity feature vector 230 of the keyword are respectively determined according to the keyword 210. The word granularity feature vector 220 and the character granularity feature vector 230 are fused and calculated to obtain the feature vector of the keyword 210.

[0074] According to the embodiments of the present disclosure, the feature vector of the keyword obtained by the method includes not only features at the word granularity but also features at the character granularity, thereby refining the granularity of the keyword and further improving the accuracy of text recognition.

[0075] According to an embodiment of the present disclosure, the classification model may include multiple long short-term memory network layers, and the classification model analyzes the feature vector to determine the recognition result, including: extracting features from the feature vector through multiple long short-term memory network layers in sequence to obtain deep feature information, and classifying the comment information based on the deep feature information to determine the recognition result.

[0076] According to the embodiments of the present disclosure, the text features of the comment information are more complex. For example, the comment information may include a lot of meaningless text (for example, "Well, okay, what are you talking about..."), some texts are complex and repeated, punctuation marks are used indiscriminately (for example, "Very good! Very good! Ah, ah ah, ah ah ah, ah ah ah ah ......"), and the text is too long, with too little effective information, and the whole text is a story (for example, "The quality of this product is too poor. It rotted just ten minutes after I put it on. Now, I really don’t know what to say... I am really very angry... but... Oh, forget it, but I won’t come to you again in the future. Although this incident was caused by me and was eventually resolved, I still don’t know what to say. It caused me a lot of trouble in the meantime. And I’m a little angry that you are always not actively contacting me, and always wait until I ask before telling me. I hope you won’t be like this to others in the future. Forget it, we are not destined to be together"), etc., which leads to complex text features. Therefore, in order to improve the recognition accuracy of the classification model for the above comment information, the present disclosure extracts more complex deep feature information in the comment information through a multi-layer LSTM, thereby classifying and identifying the comment information based on the deep feature information.

[0077] Figure 3A The schematic diagram schematically shows a method of classifying text information based on deep feature information to determine a recognition result according to an embodiment of the present disclosure.

[0078] like Figure 3A As shown, the method may include operations S301 to S303. In this embodiment, the classification model may further include a constant mapping layer, a first fully connected layer and an output layer.

[0079] In operation S301, the constant mapping layer fuses the deep feature information and the output information, wherein the output information is obtained by processing the feature vector through the first long short-term memory network layer among the plurality of long short-term memory network layers.

[0080] In operation S302, an output result of the constant mapping layer is input to a first fully connected layer, so that the output result is analyzed by the first fully connected layer.

[0081] In operation S303 , a recognition result is determined according to the analysis result of the first fully connected layer via the output layer.

[0082] Figure 3B A schematic diagram of a classification model according to an embodiment of the present disclosure is schematically shown.

[0083] Combine the following Figure 3B The classification model shown explains the above operations S301 to S303.

[0084] like Figure 3BAs shown, the classification model can include 3 long short-term memory network layers, a fully connected layer and an output layer.

[0085] The feature vectors of the keywords obtained in operation S103 are input into the first layer LSTM according to the order of the keywords in the text information. The keywords include those obtained through the word segmentation model and those obtained through operation S102. For example, the feature vectors of the keywords obtained through the word segmentation model can be first input into the first layer LSTM. After all the keywords obtained through the word segmentation model in the text information are input, the feature vectors of the keywords obtained through operation S102 are input into the first layer LSTM.

[0086] The LSTM of the first layer extracts features based on multiple feature vectors, and inputs the feature extraction results into the LSTM of the second layer, which further extracts features. The output results of the LSTM of the second layer are input into the LSTM of the third layer, which further extracts features to obtain deep feature information.

[0087] According to an embodiment of the present disclosure, the LSTM of the third layer can input the deep feature information into the pooling layer, so that the pooling layer can extract key feature information based on the deep feature information.

[0088] In operation S301, the constant mapping layer fuses the deep feature information and the output information, including fusing the key feature information extracted according to the deep feature information and the output information by the constant mapping layer. The output information is obtained by processing the feature vector via the first long short-term memory network LSTM layer of the multiple long short-term memory network LSTM layers.

[0089] Next, in operation S302, the output result of the constant mapping layer is input to the first fully connected layer. The first fully connected layer can, for example, calculate the probability of the comment information being a spam comment and the probability of being a non-spam comment based on the key feature information according to its own calculation model. The first fully connected layer inputs the calculation result to the output layer. Next, in operation S303, the output layer, for example, compares the probability that the comment information is a spam comment with the probability that the comment information is a non-spam comment, and takes the one with a larger probability as the recognition result of the comment.

[0090] Figure 4 A flowchart of a method for text recognition according to another embodiment of the present disclosure is schematically shown.

[0091] like Figure 4 As shown, the method may further include operation S401 and operation S402 based on operations S101 to S104 shown in Fig. 1. Operation S401 and operation S402 may be performed before operation S102, for example.

[0092] In operation S401, the category to which the object belongs is determined.

[0093] According to the embodiments of the present disclosure, those skilled in the art can classify objects into different categories based on experience. For example, when the text recognition method is applied to an e-commerce system, the objects targeted by the text can be commodities, and those skilled in the art can classify commodities into different categories. Specifically, the categories of commodities can include, for example, household appliances, fresh food, clothing, etc.

[0094] For example, if the text is about a piece of clothing, then the category to which the clothing belongs may be clothing.

[0095] In operation S402, it is determined whether the text information is related to the category.

[0096] According to an embodiment of the present disclosure, when it is determined that the text is related to the category, Figure 1A Operations S102 to S104 are shown. When it is determined that the text is irrelevant to the category, it is determined that the text may be junk text.

[0097] According to the embodiments of the present disclosure, in the related art, a trained recognition model is usually used to identify junk text, and the samples used to train the recognition model are often directly labeled samples of all categories. Therefore, the recognition model obtained in the related art cannot identify some non-junk texts but belong to other categories rather than this category. According to the method of the embodiments of the present disclosure, the category of the text information is detected before performing operations S102 to S104, so that the junk text that enters the category can be detected and processed, thereby improving the recognition accuracy of the text information.

[0098] According to an embodiment of the present disclosure, in operation S402, for example, a machine learning method may be used to determine whether the text information is related to the category. The text information is input into a trained machine learning model, and the machine learning model determines whether the text information is related to the category.

[0099] According to the embodiments of the present disclosure, a large number of samples need to be obtained before training the machine learning model, and the samples are processed into the form of "category-comment" data pairs, combining the category with the comment. For example, the data pair can be "Household appliances-delivered the next day after ordering, very fast. The vacuum cleaner is very cool, with multiple combinations, and it is also very convenient when combined!" Then, the comments of all categories are labeled into three types of samples. For example, label_1 can represent general comments applicable to all categories, label_2 can represent special comments applicable only to a category, and label_3 can represent random comments applicable to other categories. Specifically, for example, "Household appliances - logistics is very fast. Very good" is marked as label_1, "Fresh food - Haha. Really good" is marked as label_1, "Clothing underwear - the things are good, very satisfied" is marked as label_1, "Household appliances - the goods arrived the next day after ordering, very fast. The vacuum cleaner is very cool." is marked as label_2, "Fresh food - Haha. The passion fruit delivered this time is really good" is marked as label_2, "Clothing underwear - the clothes are very soft and warm, the colors are very vibrant, and they look very youthful, great" is marked as label_2, "Clothing underwear - the logistics is very fast, none of the crabs are dead, very fresh" is marked as label_3, "Fresh food - the clothes are very soft and warm, the colors are very vibrant" is marked as label_3, "Clothing underwear - the goods arrived the next day after ordering, the vacuum cleaner is very cool and has strong suction." is marked as label_3. Use the labeled samples to train the machine learning model. For example, the labeled samples can be used to train a BiLSTM (Bi-directional Long Short-Term Memory) model, and the trained BiLSTM model can be used to classify text information and determine the label of the text information.

[0100] Figure 5A The flowchart of the method for determining whether text information is related to a category in operation S402 according to an embodiment of the present disclosure is schematically shown.

[0101] like Figure 5A As shown, the method may include operations S412 to S432.

[0102] In operation S412, the character vector of each character in the plurality of characters is input into the bidirectional LSTM layer, so that the bidirectional long short-term memory network layer performs feature extraction on the character vector.

[0103] In operation S422, the extraction result obtained by feature extraction is input into the second fully connected layer, so that the second fully connected layer analyzes the extraction result to determine the category of the text information, wherein the category includes general text applicable to all categories, special text applicable only to the category, and intrusive text applicable to other categories.

[0104] In operation S432, when it is determined that the text information is general text or specific text, it is determined that the text information is related to the category, and when it is determined that the text information is intrusion text, it is determined that the text information is not related to the category.

[0105] According to an embodiment of the present disclosure, operations S412 to S432 can be implemented by a deep learning model, which can be, for example, a BiLSTM model. The first fully connected layer and the second fully connected layer can be classified using the same method or different methods.

[0106] Figure 5B A schematic diagram of a BiLSTM model for implementing operations S412 to S432 according to an embodiment of the present disclosure is schematically shown.

[0107] As Figure 5B shown, the BiLSTM model may include a bidirectional LSTM layer, a fusion layer, a second fully connected layer, and a result output layer.

[0108] According to an embodiment of the present disclosure, in operation S412, for example, the character vectors of each character of "object", "flow", "very", and "good" can be input into the bidirectional LSTM in sequence, and the bidirectional LSTM outputs the feature extraction sub-results respectively.

[0109] According to an embodiment of the present disclosure, the feature extraction sub-results can be input into the fusion layer, and the fusion layer fuses the feature extraction sub-results respectively obtained by the bidirectional LSTM to obtain the extraction results of each character.

[0110] In operation S422, the extraction result is input into the second fully connected layer. The second fully connected layer can, for example, calculate the probability that the text information belongs to a certain category according to its own training model. The categories of the text information may include general text applicable to all categories, specific text only applicable to the category, and intrusion text applicable to other categories.

[0111] The output layer can, for example, determine the category of the text information according to the probabilities that the text information calculated by the second fully connected layer belongs to the above three categories respectively, and can use the category with the larger probability as the output result. Specifically, for example, when the probability that the text information is general text is greater than the probability that the text information is specific text or intrusion text, the output layer can determine that the text information belongs to general text.

[0112] In operation S432, when the text information is general text or specific text, it is determined that the text information is related to the category, and when it is determined that the text information is intrusion text, it is determined that the text information is not related to the category.

[0113] According to an example of the present disclosure, in operation S104, for example, the classification model may include multiple LSTM layers of long short-term memory network layers, and the classification model analyzes the feature vector to determine the recognition result, including: extracting features from the feature vector through multiple long short-term memory network LSTM layers in sequence to obtain deep feature information. Among them, the feature vector may include not only the feature vector determined based on the keyword, but also the feature vector of the category to which the object belongs. The feature vector of the category to which the object belongs is also input into multiple long short-term memory network LSTM layers, so that the recognition accuracy of the category can be further improved.

[0114] Specifically, for example, "The logistics is great and the touch feels good." is a text for digital products. The category of digital products may be "digital". Figure 3B In the scenario shown, "digital" can be input into the LSTM before the first keyword "logistics" obtained by the word segmentation tool.

[0115] Figure 6 A schematic diagram of a text recognition method according to another embodiment of the present disclosure is schematically shown.

[0116] like Figure 6 As shown, the comment identification method may include operations S601 to S610.

[0117] In operation S601, comment information is acquired.

[0118] In operation S602, it is determined whether the comment information is related to the category. If the comment information is related to the category, operations S603 and S604 are performed, and if the comment information is not related to the category, operation S610 is performed.

[0119] In operations S603 and S604, a word segmentation tool performs word segmentation on the comment information to obtain keywords, and a deep learning model BiLSTM extracts keywords from the comment information. Operations S603 and S604 may be performed in parallel, for example.

[0120] In operation S605 and operation S606, a word granularity feature vector and a character granularity feature vector of each keyword are obtained. Operation S605 and operation S606 may be performed in parallel, for example.

[0121] In operation S607, the word granularity feature vector and the character granularity feature vector are merged to obtain a feature vector for each keyword.

[0122] In operation S608, the feature vector of each keyword is input into the classification model in time sequence, and the classification model identifies the comment information. Figure 3B Described method of operation.

[0123] If the result of identifying the comment information is a spam comment, operation S610 is performed; if the result of identifying the comment information is not a spam comment, operation S609 is performed.

[0124] In operation S609, it may be output that the comment is not a spam comment.

[0125] In operation S610, it may be output that the comment is a spam comment.

[0126] Figure 7 The block diagram of a text recognition device 700 according to an embodiment of the present disclosure is schematically shown.

[0127] like Figure 7 As shown, the text recognition device 700 may include an acquisition module 710 , a first determination module 720 , a second determination module 730 and an input module 740 .

[0128] The acquisition module 710 , for example, may execute the operation S101 described above with reference to FIG. 1 , to acquire text information, where the text information includes a plurality of characters.

[0129] The first determining module 720 , for example, may execute the operation S102 described above with reference to FIG. 1 , to determine keywords in the text information.

[0130] The second determination module 730 , for example, may execute the operation S103 described above with reference to FIG. 1 , to determine a feature vector based on the keyword.

[0131] The input module 740 , for example, may execute the operation S104 described above with reference to FIG. 1 , for inputting the feature vector into the classification model, so as to analyze the feature vector using the classification model to determine the recognition result for the text information.

[0132] Among them, determining the keywords in the text information includes: inputting the text information into a deep learning model, so that the deep learning model determines an attribute label sequence of multiple characters based on the multiple characters and context information of each of the multiple characters, wherein the attribute label sequence includes multiple attribute labels, the attribute labels indicate the attribute information of the object to which the text targets, and the multiple attribute labels correspond one-to-one to the multiple characters; and determining the attribute labels that meet the preset conditions from the attribute label sequence, and determining the keywords in the text information based on the attribute labels that meet the preset conditions.

[0133] According to an embodiment of the present disclosure, determining keywords in text information further includes: inputting the text information into a word segmentation model, and using the word segmentation model to segment the text information to obtain keywords.

[0134] According to an embodiment of the present disclosure, determining a feature vector of a keyword includes: determining a word granularity feature vector of the keyword; determining a character granularity feature vector of the keyword; and determining a feature vector by fusing the word granularity feature vector and the character granularity feature vector.

[0135] According to an embodiment of the present disclosure, the classification model analyzes the feature vector to determine the recognition result, including: the classification model includes multiple long short-term memory network layers, and feature vectors are extracted through the multiple long short-term memory network layers in sequence to obtain deep feature information; and based on the deep feature information, the text information is classified to determine the recognition result.

[0136] According to an embodiment of the present disclosure, the classification model also includes a constant mapping layer, a first fully connected layer and an output layer. Based on the deep feature information, classifying the text information to determine the recognition result includes: fusing the deep feature information and the output information by the constant mapping layer, wherein the output information is a feature vector obtained by processing the first long short-term memory network layer among multiple long short-term memory network layers; and inputting the output result of the constant mapping layer into the first fully connected layer so that the output result is analyzed by the first fully connected layer; and determining the recognition result via the output layer based on the analysis result of the first fully connected layer.

[0137] According to an embodiment of the present disclosure, the device 700 may further include a third determination module and a fourth determination module. The third determination module is used to determine the category to which the object belongs, and the fourth determination module is used to determine whether the text information is related to the category. Determining the keywords in the text information includes: determining the keywords in the text information when the text information is related to the category.

[0138] According to an embodiment of the present disclosure, determining whether text information is related to a category includes: inputting a character vector of each of a plurality of characters into a bidirectional long short-term memory network layer, so that the bidirectional long short-term memory network layer performs feature extraction on the character vector; inputting an extraction result obtained by the feature extraction into a second fully connected layer, so that the second fully connected layer performs analysis on the extraction result to determine the category of the text information, wherein the category includes general text applicable to all categories, special text applicable only to the category, and intrusive text applicable to other categories; in the case where the text information is determined to be general text or special text, determining that the text information is related to the category, and in the case where the text information is determined to be intrusive text, determining that the text information is not related to the category.

[0139] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.

[0140] For example, any multiple of the acquisition module 710, the first determination module 720, the second determination module 730, and the input module 740 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module 710, the first determination module 720, the second determination module 730, and the input module 740 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware or in a suitable combination of any of them. Alternatively, at least one of the acquisition module 710, the first determination module 720, the second determination module 730 and the input module 740 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be performed.

[0141] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is schematically shown. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0142] like Figure 8As shown, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0143] In RAM 803, various programs and data required for the operation of electronic device 800 are stored. Processor 801, ROM 802 and RAM 803 are connected to each other via bus 804. Processor 801 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 802 and / or RAM 803. It should be noted that the program can also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.

[0144] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the I / O interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage portion 808 as needed.

[0145] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0146] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0147] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.

[0148] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0149] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.

[0150] The embodiments of the present disclosure are described above. However, these embodiments are only for the purpose of illustration and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A text recognition method, comprising: Acquire text information, where the text information includes a plurality of characters; determining keywords in the text information; Based on the keywords, determining a feature vector; as well as Inputting the feature vector into a classification model, so as to analyze the feature vector using the classification model to determine a recognition result for the text information; Wherein, the determining of the keywords in the text information includes: Inputting the text information into a deep learning model, so that the deep learning model determines an attribute label sequence of the plurality of characters according to the plurality of characters and context information of each of the plurality of characters, wherein the attribute label sequence includes a plurality of attribute labels, the attribute labels indicating attribute information of an object targeted by the text information, and the plurality of attribute labels correspond one-to-one to the plurality of characters; and Determining an attribute tag that meets a preset condition from the attribute tag sequence, and determining a keyword in the text information according to the attribute tag that meets the preset condition; Wherein, the classification model includes a plurality of long short-term memory network layers, a constant mapping layer, a first fully connected layer and an output layer; The classification model analyzes the feature vector to determine the recognition result, including: Extracting features from the feature vectors sequentially through the multiple long short-term memory network layers to obtain deep feature information; The constant mapping layer fuses the depth feature information and output information, wherein the output information is obtained by processing the feature vector via a first long short-term memory network layer among the multiple long short-term memory network layers; Inputting the output result of the constant mapping layer to the first fully connected layer, so that the first fully connected layer analyzes the output result; and The recognition result is determined via the output layer according to the analysis result of the first fully connected layer.

2. The method according to claim 1, wherein: The determining of the keywords in the text information further includes: The text information is input into a word segmentation model, and the word segmentation model is used to segment the text information to obtain the keywords.

3. The method according to claim 1, wherein: The determining of the feature vector of the keyword comprises: Determining a word granularity feature vector of the keyword; Determining a word-granularity feature vector of the keyword; and The feature vector is determined by fusing the word granularity feature vector and the character granularity feature vector.

4. The method according to claim 1, further comprising: Determining the category to which the object belongs; as well as Determining whether the text information is related to the category; The determining of the keywords in the text information includes: determining the keywords in the text information when the text information is related to the category.

5. The method according to claim 4, wherein: Determining whether the text information is related to the category includes: Inputting a character vector of each character in the plurality of characters into a bidirectional long short-term memory network layer, so that the bidirectional long short-term memory network layer performs feature extraction on the character vector; Inputting the extraction result obtained by the feature extraction into the second fully connected layer, so that the second fully connected layer analyzes the extraction result to determine the category of the text information, wherein the category includes general text applicable to all categories, special text applicable only to the category, and random text applicable to other categories; In the case where it is determined that the text information is the general text or the dedicated text, it is determined that the text information is related to the category, and in the case where it is determined that the text information is the random text, it is determined that the text information is not related to the category.

6. A text recognition device, comprising: An acquisition module, used for acquiring text information, wherein the text information includes a plurality of characters; A first determination module, used to determine keywords in the text information; A second determination module, configured to determine a feature vector based on the keyword; as well as An input module, used for inputting the feature vector into a classification model, so as to analyze the feature vector using the classification model to determine a recognition result for the text information; Wherein, the determining of the keywords in the text information includes: Inputting the text information into a deep learning model, so that the deep learning model determines an attribute label sequence of the plurality of characters according to the plurality of characters and context information of each of the plurality of characters, wherein the attribute label sequence includes a plurality of attribute labels, the attribute labels indicate attribute information of an object to which the text is directed, and the plurality of attribute labels correspond one-to-one to the plurality of characters; and Determining an attribute tag that meets a preset condition from the attribute tag sequence, and determining a keyword in the text information according to the attribute tag that meets the preset condition; Wherein, the classification model includes a plurality of long short-term memory network layers, a constant mapping layer, a first fully connected layer and an output layer; The classification model analyzes the feature vector to determine the recognition result, including: Extracting features from the feature vectors sequentially through the multiple long short-term memory network layers to obtain deep feature information; The constant mapping layer fuses the depth feature information and output information, wherein the output information is obtained by processing the feature vector via a first long short-term memory network layer among the multiple long short-term memory network layers; Inputting the output result of the constant mapping layer to the first fully connected layer, so that the first fully connected layer analyzes the output result; and The recognition result is determined via the output layer according to the analysis result of the first fully connected layer.

7. An electronic device comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors execute the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute any one of the methods of claims 1 to 5.

9. A computer program product, the computer program comprising computer executable instructions, the instructions being used to implement the method according to any one of claims 1 to 5 when executed.