Text recognition method and device, electronic equipment and storage medium
By extracting entity words from advertising content text recognition and generating tagged text using deep learning and knowledge graphs, the problem of insufficient adaptability of deep learning models and abnormal word libraries is solved, achieving efficient and accurate text anomaly recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
- Filing Date
- 2023-02-14
- Publication Date
- 2026-05-22
AI Technical Summary
In existing technologies for identifying anomalies in advertising content text, deep learning models and anomalous word libraries struggle to adapt to changes in standards, leading to a decline in recognition performance.
By extracting entity words from the initial text, performing fully connected processing using a deep learning-based pre-trained model, determining the labeled text in conjunction with a pre-defined knowledge graph, and generating target semantic structure information based on the labeled text, the system adapts to standard changes.
It improves the generalization ability and accuracy of text recognition, reduces the probability of abnormal text published online, and reduces maintenance costs.
Smart Images

Figure CN116244409B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and more particularly to the field of natural language processing technology, applicable to scenarios such as text recognition and text classification. More specifically, this disclosure provides a text recognition method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of artificial intelligence technology, the application scenarios of Natural Language Processing (NLP) technology are constantly increasing. For example, based on NLP technology, it is possible to determine whether the text of advertising content conforms to relevant rules. Summary of the Invention
[0003] This disclosure provides a text recognition method, apparatus, device, and storage medium.
[0004] According to one aspect of this disclosure, a text recognition method is provided, the method comprising: extracting at least one entity word from an initial text; obtaining at least one labeled text based on the type labels of the at least one entity word, wherein the labeled text includes a type label and at least one type word, the labeled text corresponds to an entity word, and there is an association between the type label and the type word of the labeled text; obtaining target semantic structure information of the initial text based on the at least one labeled text; and determining the target recognition result of the initial text based on at least one preset semantic structure information and the target semantic structure information.
[0005] According to another aspect of this disclosure, a text recognition device is provided, comprising: an extraction module for extracting at least one entity word from an initial text; a first obtaining module for obtaining at least one tag text based on the type labels of the at least one entity word, wherein the tag text includes a type label and at least one type word, the tag text corresponds to an entity word, and there is an association between the type label and the type word of the tag text; a second obtaining module for obtaining target semantic structure information of the initial text based on the at least one tag text; and a determining module for determining the target recognition result of the initial text based on at least one preset semantic structure information and the target semantic structure information.
[0006] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method provided according to this disclosure.
[0007] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions for causing a computer to perform the methods provided according to this disclosure.
[0008] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method provided according to this disclosure.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0010] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0011] Figure 1 This is an exemplary system architecture diagram of a text recognition method and apparatus applicable according to an embodiment of the present disclosure;
[0012] Figure 2 This is a flowchart of a text recognition method according to an embodiment of the present disclosure;
[0013] Figure 3 This is a schematic diagram of a fully connected process according to an embodiment of the present disclosure;
[0014] Figure 4 This is a partial schematic diagram of a preset knowledge graph according to an embodiment of the present disclosure;
[0015] Figure 5 This is a schematic diagram of a text recognition method according to an embodiment of the present disclosure;
[0016] Figure 6 This is a block diagram of a text recognition device according to an embodiment of the present disclosure; and
[0017] Figure 7 This is a block diagram of an electronic device to which a text recognition method can be applied, according to an embodiment of the present disclosure. Detailed Implementation
[0018] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0019] Text anomaly detection can include determining whether there are risks such as anomalous descriptions or implications in the text. In internet advertising, ad titles may contain anomalous descriptions or implications. During ad review, the text content of these ads needs to be given close attention. The challenges of identifying text anomalies in ad content include the fact that the criteria for determining whether related descriptions or implications are anomalous can change.
[0020] In some embodiments, deep learning models can be used to determine whether advertising content text is normal or anomalous. In the short term, deep learning models can efficiently determine whether advertising content text is anomalous. However, if the criteria for determining whether a description or implication is anomalous change, the performance of deep learning models may degrade significantly.
[0021] In some embodiments, the advertisement content text can also be matched against anomalous words in an anomalous word database. If an anomalous word is found in the advertisement content text, a successful match can be determined, and the advertisement content text can be considered anomalous text. However, if the criteria for determining whether a word is anomalous change, and the anomalous word database is not updated in a timely manner, accurate text recognition may be impossible.
[0022] Figure 1 This is a schematic diagram of an exemplary system architecture for applying text recognition methods and apparatus according to an embodiment of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0023] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0024] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0025] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using terminal devices 101, 102, and 103 (for example only). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0026] It should be noted that the text recognition method provided in this disclosure embodiment can generally be executed by server 105. Correspondingly, the text recognition device provided in this disclosure embodiment can generally be located in server 105. The text recognition method provided in this disclosure embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the text recognition device provided in this disclosure embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105.
[0027] Figure 2 This is a flowchart of a text recognition method according to an embodiment of the present disclosure.
[0028] like Figure 2 As shown, the method 200 may include operations S210 to S240.
[0029] In operation S210, at least one entity word is extracted from the initial text.
[0030] In this embodiment of the disclosure, the initial text can be text awaiting review. For example, the initial text can be advertising content text awaiting review. For example, the initial text could be "Please take a break, I beg you."
[0031] In this embodiment of the disclosure, entity words can be word segments in the initial text with a preset semantic meaning. For example, entity words extracted from the initial text can be "rest" and "seek".
[0032] In operation S220, at least one tag text is obtained based on the type tag of each of at least one entity word.
[0033] In this embodiment of the disclosure, entity words can be matched with multiple type tags according to their semantics. The type tag that matches the entity word is used as the type tag of that entity word. For example, the type tag for the entity word "rest" can be "rest", and the type tag for the entity word "seek" can be "seek affirmation".
[0034] In this embodiment of the disclosure, the label text may include a type tag and at least one type word. Each label text corresponds to an entity word, and there is an association between the type tag and the type word. For example, the label text corresponding to the entity word "rest" could be "behavior_action_rest". This label text includes the type word "behavior", the type word "action", and the type tag "rest". There is an association between the type tag "rest", the type word "behavior", and the type word "action". The type word "behavior" can indicate the category of the type word "action", and the type word "action" can indicate the category of the type tag "rest". As another example, the label text corresponding to the entity word "seek" could be "behavior_scenario_seek affirmation". This label text includes the type word "behavior", the type word "scenario", and the type tag "seek affirmation". There is an association between the type tag "seek affirmation", the type word "behavior", and the type word "scenario". The type word "behavior" can indicate the category of the type word "scenario", and the type word "scenario" can indicate the category of the type tag "seek affirmation".
[0035] In operation S230, the target semantic structure information of the initial text is obtained based on at least one tag text.
[0036] In this embodiment of the disclosure, a set of tag texts can be obtained based on at least one tag text. This set of tag texts can serve as target semantic structure information. For example, the target semantic structure information of the initial text can be implemented as "behavior_action_rest, behavior_scene_request".
[0037] In operation S240, the target recognition result of the initial text is determined based on at least one preset semantic structure information and the target semantic structure information.
[0038] In this embodiment of the disclosure, multiple preset semantic structure information can correspond to preset recognition results. The preset recognition results can indicate that the text related to the preset semantic structure information is abnormal text.
[0039] In this embodiment of the disclosure, multiple preset semantic structure information can be obtained based on multiple abnormal text samples. For example, multiple abnormal text samples can be acquired. The above-described operations S210 to S230 are performed on the multiple abnormal text samples respectively to obtain multiple preset semantic structure information.
[0040] In this embodiment of the disclosure, the target recognition result can indicate whether the initial text is abnormal text. For example, if there is preset semantic structure information that matches the target semantic structure information, it can be determined that the target recognition result indicates that the initial text is abnormal text. Conversely, if there is no preset semantic structure information that matches the target semantic structure information, it can be determined that the target recognition result indicates that the initial text is normal text.
[0041] Through the embodiments of this disclosure, entity words are extracted from the initial text, and at least one tag text of the initial text is determined based on the type label and type word that match the semantics of the entity words, thereby determining the semantic structure information. This can make full use of the semantics of the initial text and extract accurate semantic structure information, which helps to quickly perform text recognition.
[0042] Furthermore, through the embodiments of this disclosure, entity words are extracted from the initial text. Therefore, even if the criteria for determining whether text is abnormal change, the probability of changes in the entity words extracted from the initial text is low. Changes in criteria can lead to changes in type labels and / or type words, causing the label text of entity words to change accordingly. Thus, by fine-tuning at least one preset semantic structure information (e.g., deleting and / or adding preset semantic structure information), the text recognition method can adapt to changes in criteria, facilitating rapid and accurate recognition.
[0043] As can be understood, the method of this disclosure has been described above, and some implementation methods for extracting at least one entity word from the initial text will be described below.
[0044] In some embodiments, extracting at least one entity word from the initial text may include performing a fully connected operation on the initial text to obtain a processing result. The processing result may include the position of each of the at least one entity word in the initial text.
[0045] In this embodiment of the disclosure, a pre-trained model based on deep learning can be used to perform fully connected processing, which will be further described below.
[0046] Figure 3 This is a schematic diagram of a fully connected process according to an embodiment of the present disclosure.
[0047] like Figure 3 As shown, the initial text "Take a break, please." can be tokenized to obtain N tokens. These N tokens can include token Tok1, token Tok2, ..., token TokN. N can be an integer greater than 2. The N tokens, a preset processing token [CLS], and a preset end token [SEP] are used as input to a deep learning-based pre-trained model 300. The deep learning-based pre-trained model 300 can perform fully connected processing on the N tokens of the initial text. The deep learning-based pre-trained model 300 can be a pre-trained language model (such as ERNIE).
[0048] The deep learning-based pre-trained model 300 may include a first fully connected layer 310 and a second fully connected layer 320. The first fully connected layer can process N labels, a preset processing label [CLS], and a preset end label [SEP] to obtain N first vectors, a first processing vector Ecls, and a first end vector Esep. The N first vectors may include first vector E1, first vector E2, ..., first vector EN.
[0049] The second fully connected layer can process N first vectors, a first processing vector Ecls, and a first ending vector Esep, resulting in N second vectors, a second processing vector C, and a second ending vector S. The N second vectors can include second vector T1, second vector T2, ..., second vector TN. Based on the N second vectors, the second processing vector C, and the second ending vector S, the processing result can be determined. This result can include the start and end positions of entity words in the initial text. For example... Figure 3 As shown, the processing result can include: the first character of the initial text is the start position of the first entity word, and the second character is the end position of the first entity word. Based on the start and end positions of the first entity word, the first entity word of the initial text can be determined as "rest". The processing result can also include: the start and end positions of the second entity word are the same character. The second entity word can be "seek".
[0050] In this embodiment of the disclosure, in order for the deep learning-based pre-trained model 300 to determine the entity words of the initial text, the deep learning-based pre-trained model 300 can be trained using multiple text samples. The ground truth values of the text samples can be obtained by manually annotating the text samples. The ground truth values of the text samples can indicate the position of the entity words in the text samples. For example, the text samples can be tokenized to obtain multiple sample tokens. The multiple sample tokens, preset processing tokens, and preset end tokens are input into the deep learning-based pre-trained model 300 to obtain the sample processing results. The parameters of the deep learning-based pre-trained model 300 are adjusted so that the difference between the sample processing results and the ground truth values of the text samples is less than or equal to a preset threshold, in order to train the deep learning-based pre-trained model.
[0051] Through the embodiments of this disclosure, the initial text is processed using a fully connected layer, which can fully utilize the semantics of the text to extract entity words, thus helping to improve the generalization ability of text recognition. By fully utilizing the semantics of the initial text, even if new anomalous words appear in the initial text, new anomalous entity words may still be extracted after the fully connected layer processing, thereby further improving the generalization ability of text recognition and reducing the probability of anomalies in online published text.
[0052] As you can understand, the above text has explained some ways to determine entity words, and the following text will explain some ways to obtain tag text.
[0053] In some embodiments, at least one tag text can be obtained based on a preset knowledge graph and at least one type label for each entity word. The preset knowledge graph may include multiple nodes, which may include parent nodes and child nodes. A child node may correspond to a type label, and a parent node may correspond to a type word. The preset knowledge graph will be described below.
[0054] Figure 4 This is a partial schematic diagram of a preset knowledge graph according to an embodiment of the present disclosure.
[0055] like Figure 4 As shown, the preset knowledge graph can include multiple nodes. These nodes can include child nodes 4311, 4312, 4313, 4321, 4322, 4411, and 4421. Child node 4311 can correspond to the type tag "loneliness." Child node 4312 can correspond to the type tag "shyness." Child node 4313 can correspond to the type tag "excitement." Child node 4321 can correspond to the type tag "health." Child node 4322 can correspond to the type tag "fatigue." Child node 4411 can correspond to the type tag "rest." Child node 4421 can correspond to the type tag "seeking affirmation."
[0056] Multiple parent nodes can also include parent nodes 431, 432, 441, 442, 430, and 440. Parent node 431 can correspond to the type term "emotion". Parent node 432 can correspond to the type term "physiological state". Parent node 441 can correspond to the type term "action". Parent node 442 can correspond to the type term "scene". Parent node 430 can correspond to the type term "personality". Parent node 440 can correspond to the type term "behavior".
[0057] In this embodiment of the disclosure, a child node can be associated with a level I parent node. A child node can be associated with a level I parent node, and a level I-i+1 parent node is associated with a level Ii parent node. I can be an integer greater than or equal to 1 and less than 1. I can also be an integer greater than 1. For example, child node 4311 can be associated with parent node 431. Parent node 431 can be a level I parent node. Parent node 431 can be associated with parent node 430. Parent node 430 can be a level I-1 parent node. It can be understood that for child node 4311, I can be 2, and the value of i can be 1.
[0058] In this embodiment of the disclosure, at least one type word is a Level I type word. A Level I type word can indicate the category of a type label, and a Level i type word can indicate the category of a Level i+1 type word. For example, type words associated with the type label "loneliness" can include the type word "emotion" and the type word "personality." The type word "emotion" can indicate the category of the type label "loneliness." The type word "personality" can indicate the category of the type word "emotion." The type word "emotion" can be a Level I type word. The type word "personality" can be a Level I-1 type word. It is understood that the level of a type word can be consistent with the level of its parent node. For the type label "loneliness," I can be 2, and the value of i can be 1. It is understood that the preset knowledge graph can also include other parent nodes and child nodes. Figure 4 The nodes shown are for illustrative purposes only.
[0059] As can be understood, the above has explained the pre-defined knowledge graph of this disclosure. The following will further explain some methods for obtaining tagged text.
[0060] In this embodiment of the disclosure, obtaining at least one tagged text based on the type tags of at least one entity word may include: acquiring a preset knowledge graph; determining target child nodes corresponding to entity words in the preset knowledge graph based on the type tags matching the entity words; determining at least one parent node associated with the target child node as at least one target parent node; and obtaining the tagged text corresponding to the entity words based on the type words corresponding to the at least one target parent node and the type tags corresponding to the target child nodes.
[0061] For example, it is possible to obtain such as Figure 4 The preset knowledge graph shown.
[0062] In this embodiment of the disclosure, various methods can be used to determine the type label that matches the entity word. For example, the semantics of the entity word and the semantics of multiple type labels can be determined separately. The type label that is closest in semantics to the entity word is taken as the type label that matches the entity word.
[0063] For example, the entity word "rest" can be matched with the type tag "rest". The type tag "rest" corresponds to child node 4411. As mentioned above, child node 4411 is associated with parent node 441, and parent node 441 is associated with parent node 440. Child node 4411 can be the target child node of the entity word "rest". Parent nodes 441 and 440 can be the target parent nodes of the entity word "rest". Based on the type word "action" corresponding to parent node 441, the type word "behavior" corresponding to parent node 440, and the type tag "rest" corresponding to child node 4411, the tag text "behavior_action_rest" corresponding to the entity word "rest" can be determined.
[0064] For example, the entity word "qiu" can be matched with the type label "qiuken". The type label "qiuken" corresponds to the child node 4421. As Figure 4 shown, the child node 4421 is associated with the parent node 442, and the parent node 442 is associated with the parent node 440. The child node 4421 can be used as the target child node of the entity word "qiu". The parent nodes 442 and 440 can be used as the target parent nodes of the entity word "qiu". According to the type word "scene" corresponding to the parent node 442, the type word "behavior" corresponding to the parent node 440, and the type label "qiuken" corresponding to the child node 4421, the label text "behavior_scene_qiuken" corresponding to the entity word "qiu" can be determined.
[0065] Through the embodiments of the present disclosure, the label text is determined based on the knowledge graph corresponding to the type word and the type label. If the standard for determining whether the text is abnormal changes, after updating the preset knowledge graph, it can better adapt to the change of the standard, reducing the maintenance cost of text recognition.
[0066] It can be understood that some methods for obtaining the label text are described above, and below some methods for obtaining the target semantic structure information will be described.
[0067] Figure 5 is a schematic diagram of a text recognition method according to an embodiment of the present disclosure.
[0068] As Figure 5 shown, another initial text "Take a break, please, the woman's sad request, but how can you give up halfway? She silently..." can be tokenized to obtain M tokens.M tokens can include token Tokl, token Tok2,..., token TokM.M can be an integer greater than 2. The M tokens, the preset processing token [CLS], and the preset end token [SEP] are used as the input of the pre-trained model 500 based on deep learning. The pre-trained model 500 based on deep learning can perform a fully connected processing on the M tokens of the initial text to obtain a processing result. The processing result can include the positions of at least one entity word in the initial text. Thus, at least one entity word can be extracted from the initial text. [[ID=第十九]]
[0069] 如 Figure 5 所示,至少一个实体词可以包括:实体词“休息”、实体词“求”、实体词“女子”、实体词“请求”、实体词“半途而废”以及实体词“她”。
[0070] Next, according to the type tags of at least one entity word respectively, at least one tag text can be determined. For example, the entity word "rest" can correspond to the tag text "behavior_action_rest". The entity word "beg" can correspond to the tag text "behavior_scenario_begging". The entity word "woman" can correspond to the tag text "person_female". The entity word "request" can correspond to the tag text "behavior_scenario_begging". The entity word "give up halfway" can correspond to the tag text "personality trait_attitude_giving up". The entity word "she" can correspond to the tag text "person_pronoun_female".
[0071] Next, according to at least one tag text, the target semantic structure information of the initial text can be obtained.
[0072] In the embodiments of the present disclosure, in response to determining that the tag text meets a preset condition, according to the preset processing rule corresponding to the preset condition, at least one of the type tag and at least one of the type words can be deleted. For example, the preset condition may include: the tag text includes a word related to gender. The word related to gender may be "male", "female", etc. The preset processing rule may include: deleting the words other than the word related to gender. According to this preset processing rule, the type word "person" in the tag text "person_female" can be deleted, or the type words "person" and "pronoun" in the tag text "person_pronoun_female" can be deleted, and two processed tag texts "female" are obtained. Through the embodiments of the present disclosure, processing the tag text according to the preset processing rule is equivalent to pruning the tag text, which can further improve the accuracy of text recognition. It can be understood that pruning can also be performed according to other rules, and the present disclosure does not limit this.
[0073] In the embodiments of the present disclosure, in response to determining that two tag texts are the same, any one of the two tag texts is deleted. For example, in response to determining that the tag text of the entity word "beg" is the same as the tag text of the entity word "request", any one of these two tag texts can be deleted. Another example, in response to determining that the processed tag text of the entity word "woman" is the same as the processed tag text of the entity word "she", any one of these two processed tag texts can be deleted. After performing at least one deletion operation, if it is determined that any two tag texts are not the same, the deletion operation is stopped. In this case, the tag texts of the initial text include: "behavior_action_rest", "behavior_scenario_begging", "female", and "personality trait_attitude_giving up". Through the embodiments of the present disclosure, deleting the same tag texts is equivalent to deduplicating the tag texts, which can further improve the accuracy of text recognition and the efficiency of text recognition.
[0074] In the embodiments of the present disclosure, sorting at least one tag text according to a preset sorting rule can obtain target semantic structure information. For example, sorting can be performed according to various sorting rules (ascending order, descending order, etc.). The target semantic structure information obtained after sorting can be "personality trait_attitude_give up, female, behavior_action_rest, behavior_scene_petition".
[0075] Next, according to at least one preset semantic structure information and the target semantic structure information, determine the recognition result of the initial text. In the embodiments of the present disclosure, according to the preset recognition result of the preset semantic structure information that matches the target semantic structure information, the target recognition result can be determined. For example, the preset semantic structure information can be obtained according to at least one preset tag text. If there is a preset semantic structure information that is consistent with the target semantic structure information, the preset recognition result of this preset semantic structure information can be used as the target recognition result.
[0076] In some other embodiments of the present disclosure, after performing at least one deletion process, if it is determined that any two tag texts are inconsistent, the target tag text set of the initial text can be used as the target semantic structure information. Next, without considering the order of the tag texts, if it is determined that the target tag text set is equal to the preset tag text set of the preset semantic structure information, the preset recognition result of this preset semantic structure information can be used as the target recognition result.
[0077] It can be understood that the above has described the text recognition method of the present disclosure. Below, the target semantic structure information of the present disclosure will be further described in combination with related embodiments.
[0078] For example, the target semantic structure information of the initial text "Chapter 1: I didn't expect your craftsmanship to be so amazing, much better than my master", the initial text "Chapter 2: I didn't expect your craftsmanship to be so amazing, much better than my husband", and the initial text "Chapter 1: I didn't expect your technology to be so amazing, much better than my leader" can all be "person pronoun_you, person pronoun_me, work content_chapter, male, qualifier_modify_amazing, qualifier_transition_after_I didn't expect". The tag text "person pronoun_you" can correspond to the entity word "you". The tag text "person pronoun_me" can correspond to the entity word "me". The tag text "work content_chapter" can correspond to the entity word "chapter". The tag text "male" can correspond to the entity words "master", "husband", and "leader" respectively. The tag text "qualifier_modify_amazing" can correspond to the entity word "amazing". The tag text "qualifier_transition_after_I didn't expect" can correspond to the entity word "I didn't expect". If this target semantic structure information is used as a preset semantic structure information, it can quickly and accurately determine the target recognition results of at least three initial texts.
[0079] It is understood that in this embodiment of the disclosure, abnormal text may include malicious text or other abnormal text.
[0080] Figure 6 This is a block diagram of a text recognition device according to an embodiment of the present disclosure.
[0081] like Figure 6 As shown, the device 600 may include an extraction module 610, a first acquisition module 620, a second acquisition module 630, and a determination module 640.
[0082] Extraction module 610 is used to extract at least one entity word from the initial text.
[0083] The first obtaining module 620 is used to obtain at least one tag text based on the type tags of at least one entity word. For example, the tag text includes a type tag and at least one type word, the tag text corresponds to an entity word, and there is an association between the type tag and the type word of the tag text.
[0084] The second obtaining module 630 is used to obtain the target semantic structure information of the initial text based on at least one tag text.
[0085] The determination module 640 is used to determine the target recognition result of the initial text based on at least one preset semantic structure information and target semantic structure information.
[0086] In some embodiments, the first obtaining module includes: an obtaining submodule, used to obtain a preset knowledge graph. For example, the preset knowledge graph includes multiple nodes, each node including a parent node and child nodes, where each child node corresponds to a type tag and each parent node corresponds to a type word. A first determining submodule is used to determine, based on the type tag matching the entity word, a target child node corresponding to the entity word in the preset knowledge graph. A second determining submodule is used to determine at least one parent node associated with the target child node as at least one target parent node. The obtaining submodule is used to obtain the tag text corresponding to the entity word based on the type word corresponding to each of the at least one target parent node and the type tag corresponding to the target child node.
[0087] In some embodiments, the target child node is associated with the first-level parent node, the target child node is associated with the first-level parent node, the (I-i+1)th-level parent node is associated with the Ii-level parent node, where i is an integer greater than or equal to 1 and less than 1, and 1 is an integer greater than 1.
[0088] In some embodiments, at least one type word is a level I type word, which is used to indicate the category of the type label, and the level i type word is used to indicate the category of the (i+1)th level type word.
[0089] In some embodiments, the second obtaining module includes at least one of the following sub-modules: a first deletion sub-module, configured to delete at least one of a type tag and at least one type word according to a preset processing rule corresponding to the preset conditions, in response to determining that the tag text meets preset conditions; and a second deletion sub-module, configured to delete either of the two tag texts in response to determining that the two tag texts are identical.
[0090] In some embodiments, the second obtaining module further includes a sorting submodule, used to sort at least one tag text according to a preset sorting rule to obtain target semantic structure information.
[0091] In some embodiments, the determining module is further configured to: determine the target recognition result based on the preset recognition result of the preset semantic structure information that matches the target semantic structure information.
[0092] In some embodiments, the extraction module includes a fully connected submodule for performing fully connected processing on the initial text to obtain a processing result, wherein the processing result includes the position of at least one entity word in the initial text.
[0093] In some embodiments, the target recognition result is used to indicate whether the initial text is abnormal text.
[0094] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0095] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0096] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0097] like Figure 7As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or a computer program loaded into random access memory (RAM) 703 from storage unit 708. The RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.
[0098] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0099] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as text recognition methods. For example, in some embodiments, the text recognition method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the text recognition method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform text recognition methods by any other suitable means (e.g., by means of firmware).
[0100] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0101] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0102] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0103] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) monitor or an LCD (liquid crystal display)) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0104] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0105] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0106] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0107] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A text recognition method, comprising: Extract at least one entity word from the initial text; At least one tag text is obtained based on the type tags of at least one entity word, wherein the tag text includes the type tags and at least one type word, the tag text corresponds to one entity word, and there is an association between the type tags and the type words of the tag text; Based on at least one of the labeled texts, the target semantic structure information of the initial text is obtained; The target recognition result of the initial text is determined based on at least one preset semantic structure information and the target semantic structure information; The step of obtaining at least one tag text based on the type tags of at least one entity word includes: acquiring a preset knowledge graph, wherein the preset knowledge graph includes multiple nodes, each node including a parent node and a child node, each child node corresponding to a type tag, and each parent node corresponding to a type word; determining a target child node corresponding to the entity word in the preset knowledge graph based on the type tag matching the entity word; determining at least one parent node associated with the target child node as at least one target parent node; and obtaining the tag text corresponding to the entity word based on the type word corresponding to each of the at least one target parent node and the type tag corresponding to the target child node. The preset semantic structure information is obtained by performing the same operations on multiple abnormal text samples as extracting at least one entity word, obtaining at least one tag text, and obtaining the target semantic structure information of the initial text.
2. The method according to claim 1, wherein, The target child node is associated with the first-level parent node. The target child node is associated with the first-level parent node, and the (I-i+1)th-level parent node is associated with the Ii-level parent node, where i is an integer greater than or equal to 1 and less than 1, and 1 is an integer greater than 1.
3. The method according to claim 2, wherein, At least one of the type words is a level I type word, which is used to indicate the category of the type label, and the level i type word is used to indicate the category of the (i+1)th level type word.
4. The method according to claim 1, wherein, Obtaining the target semantic structure information of the initial text based on at least one of the labeled texts includes at least one of the following operations: In response to determining that the tag text meets a preset condition, the type tag and at least one of the type words are deleted according to a preset processing rule corresponding to the preset condition; In response to determining that the two label texts are identical, either of the two label texts is deleted.
5. The method according to claim 1, wherein, The step of obtaining the target semantic structure information of the initial text based on at least one of the labeled texts further includes: At least one of the tag texts is sorted according to a preset sorting rule to obtain the target semantic structure information.
6. The method according to claim 1, wherein, The step of determining the recognition result of the initial text based on at least one preset semantic structure information and the target semantic structure information includes: The target recognition result is determined based on the preset recognition result of the preset semantic structure information that matches the target semantic structure information.
7. The method according to claim 1, wherein, The extraction of at least one entity word from the initial text includes: The initial text is subjected to a full connection process to obtain a processing result, wherein the processing result includes the position of at least one of the entity words in the initial text.
8. The method according to claim 1, wherein, The target recognition result is used to indicate whether the initial text is abnormal text.
9. A text recognition device, comprising: The extraction module is used to extract at least one entity word from the initial text; The first obtaining module is configured to obtain at least one tag text based on the type tags of at least one entity word, wherein the tag text includes the type tag and at least one type word, the tag text corresponds to one entity word, and there is an association between the type tag and the type word of the tag text; The second obtaining module is used to obtain the target semantic structure information of the initial text based on at least one of the labeled texts; The determining module is used to determine the target recognition result of the initial text based on at least one preset semantic structure information and the target semantic structure information; The first obtaining module includes: The acquisition submodule is used to acquire a preset knowledge graph, wherein the preset knowledge graph includes multiple nodes, each node including a parent node and a child node, each child node corresponding to a type tag, and each parent node corresponding to a type word; The first determining submodule is used to determine the target sub-node corresponding to the entity word in the preset knowledge graph based on the type tag that matches the entity word; The second determining submodule is used to determine at least one parent node associated with the target child node as at least one target parent node; The submodule is configured to obtain the tag text corresponding to the entity word based on the type word corresponding to at least one of the target parent nodes and the type tag corresponding to the target child node; The preset semantic structure information is obtained by performing the same operations on multiple abnormal text samples as extracting at least one entity word, obtaining at least one tag text, and obtaining the target semantic structure information of the initial text.
10. The apparatus according to claim 9, wherein, The target child node is associated with the first-level parent node. The target child node is associated with the first-level parent node, and the (I-i+1)th-level parent node is associated with the Ii-level parent node, where i is an integer greater than or equal to 1 and less than 1, and 1 is an integer greater than 1.
11. The apparatus according to claim 10, wherein, At least one of the type words is a level I type word, which is used to indicate the category of the type label, and the level i type word is used to indicate the category of the (i+1)th level type word.
12. The apparatus according to claim 9, wherein, The second obtaining module includes at least one of the following sub-modules: The first deletion submodule is configured to, in response to determining that the tag text meets a preset condition, delete the type tag and at least one of the type words according to a preset processing rule corresponding to the preset condition; The second deletion submodule is used to delete either of the two tag texts in response to determining that the two tag texts are consistent.
13. The apparatus according to claim 9, wherein, The second obtaining module also includes: The sorting submodule is used to sort at least one of the tag texts according to a preset sorting rule to obtain the target semantic structure information.
14. The apparatus according to claim 9, wherein, The determining module is also used for: The target recognition result is determined based on the preset recognition result of the preset semantic structure information that matches the target semantic structure information.
15. The apparatus according to claim 9, wherein, The extraction module includes: The fully connected submodule is used to perform fully connected processing on the initial text to obtain a processing result, wherein the processing result includes the position of at least one of the entity words in the initial text.
16. The apparatus according to claim 9, wherein, The target recognition result is used to indicate whether the initial text is abnormal text.
17. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 8.
19. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 8.