Text processing method, electronic equipment and computer readable storage medium

Through character reconstruction and target language understanding of pre-trained language models, the problem of insufficient robustness of the model when handling wrong text input is solved, the model's understanding ability is improved and the training cost is reduced, and it is suitable for natural language processing.

CN120524945APending Publication Date: 2025-08-22ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410196241.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-21
Publication Date
2025-08-22

AI Technical Summary

Technical Problem

The existing pre-trained language models have poor semantic comprehension capabilities and insufficient robustness when dealing with unintentional or deliberate Chinese error text inputs, and existing solutions such as data augmentation and adversarial training lead to high training costs.

Method used

By obtaining the original text containing mutated characters, performing character reconstruction, establishing the connection between mutated characters and alternative characters, using the target language understanding model for natural language understanding, identifying and correcting mutated characters from the reconstructed text, and improving the robustness of the model.

Benefits of technology

The target language understanding model is achieved to correctly understand user intentions, improve the model's understanding of wrong text input, reduce training costs, and is suitable for a variety of natural language processing tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120524945A_ABST
    Figure CN120524945A_ABST
Patent Text Reader

Abstract

The invention discloses a text processing method, electronic equipment and a computer readable storage medium, and relates to the technical field of large models and computers. The method comprises the steps that an original text is obtained, the original text comprises variation characters, and the variation characters are error characters input based on the intention of a user; character reconstruction is carried out on the original text to obtain a reconstructed text, the reconstructed text is used for establishing a relation between the variation character and an alternative character, and the alternative character is used for determining at least one to-be-replaced representation form corresponding to the variation character; natural language understanding is conducted on the reconstructed text through a target language understanding model, a processing result corresponding to the original text is obtained, and the target language understanding model is used for recognizing and correcting variant characters from the reconstructed text so as to provide processing content matched with the original text. The technical problem that the training cost is high due to the fact that the robustness of the model is improved through data enhancement, adversarial training and the like in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of large model technology and computer technology, and specifically to a text processing method, an electronic device, and a computer-readable storage medium. Background Art

[0002] Deep neural network models, especially pre-trained language models (PLMs), are severely impacted in their semantic understanding when processing input containing unintentional or deliberate Chinese text errors. For example, the model is extremely susceptible to adversarial perturbations. If a user deliberately circumvents the service's security mechanisms by typing "WeChat" instead of "Weixin" or "QQ" instead of "QQ" to send a message, the model will be unable to correctly understand the user's true intention. In other words, the model has poor understanding of erroneous text input and is less robust.

[0003] Some current solutions, such as data augmentation and adversarial training, are often expensive to train and may negatively impact the model's performance on general datasets.

[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0005] The embodiments of the present application provide a text processing method, an electronic device, and a computer-readable storage medium to at least solve the technical problem in related technologies of improving the robustness of the model through data enhancement and adversarial training, which leads to high training costs.

[0006] According to one aspect of an embodiment of the present application, a text processing method is provided, comprising: obtaining an original text, wherein the original text contains variant characters, which are erroneous characters input based on user intention; reconstructing the original text to obtain a reconstructed text, wherein the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters; and performing natural language understanding on the reconstructed text using a target language understanding model to obtain a processing result corresponding to the original text, wherein the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text.

[0007] According to another aspect of an embodiment of the present application, a text processing method is also provided, including: obtaining a text processing request through a first application programming interface, wherein the request data carried in the text processing request includes: original text, the original text contains variant characters, and the variant characters are incorrect characters input based on user intention; returning a text processing response through a second application programming interface, wherein the response data carried in the text processing response includes: processing results, the processing results are obtained after natural language understanding of the reconstructed text using a target language understanding model, the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text, the reconstructed text is obtained after character reconstruction of the original text, the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters.

[0008] According to another aspect of an embodiment of the present application, a text processing method is also provided, including: obtaining a currently input text processing dialogue request, wherein the request data carried in the text processing dialogue request includes: original text, the original text contains variant characters, and the variant characters are incorrect characters input based on user intention; in response to the text processing dialogue request, returning a text processing dialogue reply, wherein the information carried in the text processing dialogue reply includes: processing results, the processing results are obtained after natural language understanding of the reconstructed text using a target language understanding model, the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text, the reconstructed text is obtained after character reconstruction of the original text, the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters; and displaying the processing results in a graphical user interface.

[0009] According to another aspect of an embodiment of the present application, a text processing method is also provided, including: obtaining an original legal text, wherein the original legal text contains variant characters, which are erroneous characters input based on user intention; reconstructing the characters of the original legal text to obtain a reconstructed legal text, wherein the reconstructed legal text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters; using a target language understanding model to perform natural language understanding on the reconstructed legal text to obtain a processing result corresponding to the original legal text, wherein the target language understanding model is used to identify and correct the variant characters from the reconstructed legal text to provide processing content that is compatible with the original legal text.

[0010] According to another aspect of an embodiment of the present application, an electronic device is provided, including: a memory storing an executable program; and a processor for running the program, wherein the program executes any one of the above-mentioned text processing methods when running.

[0011] According to another aspect of an embodiment of the present application, a computer-readable storage medium is further provided, which includes a stored executable program, wherein when the executable program runs, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned text processing methods.

[0012] According to another aspect of an embodiment of the present application, a computer program product is further provided, including a computer program, which implements any one of the above-mentioned text processing methods when executed by a processor.

[0013] In an embodiment of the present application, an original text containing variant characters input based on user intention is obtained, and then the original text is reconstructed, a connection is established between the variant character and at least one alternative character corresponding to the variant character to obtain a reconstructed text, and finally a target language understanding model is used to perform natural language understanding on the reconstructed text, and the variant characters are identified and corrected from the reconstructed text to obtain a processing result corresponding to the original text. In this way, the purpose of correctly understanding the user's true intention through the target language understanding model and outputting the processing content corresponding to the user's true intention is achieved, thereby achieving the technical effect of improving the target language understanding model's ability to understand erroneous text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in the related technology of improving the robustness of the model through data enhancement and adversarial training, resulting in high training costs.

[0014] It is easy to notice that the above general description and the following detailed description are merely for the purpose of exemplifying and explaining the present application, and do not constitute a limitation of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0016] Figure 1 This is a schematic diagram of an application scenario of a text processing method according to Example 1 of the present application;

[0017] Figure 2 is a flowchart of a text processing method according to Example 1 of the present application;

[0018] Figure 3 is a schematic diagram of the variation relationship between characters according to Example 1 of the present application;

[0019] Figure 4 is a schematic diagram of the variation path according to Example 1 of the present application;

[0020] Figure 5 is a flowchart of a text processing method according to Example 2 of the present application;

[0021] Figure 6 is a flowchart of a text processing method according to Example 3 of the present application;

[0022] Figure 7 is a flowchart of a text processing method according to Example 4 of the present application;

[0023] Figure 8 is a structural diagram of a text processing device according to Example 5 of the present application;

[0024] Figure 9 is a structural diagram of another text processing device according to Example 5 of the present application;

[0025] Figure 10 is a structural diagram of yet another text processing device according to Example 5 of the present application;

[0026] Figure 11 is a structural diagram of another text processing device according to Example 5 of the present application;

[0027] Figure 12 This is a structural block diagram of a computer terminal according to an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] The technical solution provided in this application is mainly implemented using large-scale model technology. The large model here refers to a deep learning model with large-scale model parameters, which can usually contain hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than ten trillion model parameters. The large model can also be called a cornerstone model / foundation model (Foundation Model). The large model is pre-trained by large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks and has good generalization capabilities, such as large-scale language models (LLMs) and multi-modal pre-training models.

[0031] It should be noted that when the large model is actually applied, the pre-trained model can be fine-tuned with a small number of samples, so that the large model can be applied to different tasks. For example, the large model can be widely used in natural language processing (NLP), computer vision, speech processing and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image captioning (IC), and image generation. It can also be widely used in natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. Therefore, the main application scenarios of the large model include but are not limited to digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.

[0032] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretations:

[0033] BERT (Bidirectional Encoder Representations from Transformers) model: A pre-trained deep learning model based on the Transformer architecture for natural language processing (NLP) tasks that understands text by considering the bidirectional relationships between all words in the context.

[0034] Robustness: refers to the ability of a machine learning or deep learning model to maintain stable performance and accurate predictions in the face of various changes in input data, anomalies, noise interference, and even adversarial attacks.

[0035] Search and Recommendation: A common interactive environment in internet products and services, particularly in e-commerce, content distribution, and social media platforms. In this scenario, users can actively search for specific information or products, or passively receive personalized recommendations based on their behavior, interests, and history. This scenario combines search engine technology with personalized recommendation technology to enhance user experience, increase conversion rates, and enhance user engagement.

[0036] Knowledge Graph (KG): A structured knowledge representation and storage method that organizes data in the form of a graph or network, where nodes represent entities (such as people, places, things, concepts, etc.) and edges represent the relationships between these entities. The core concept of a knowledge graph is to convert unstructured information into structured data, making it easier for computers to understand, retrieve, and reason. In the embodiments of this application, it is mainly used to describe and organize information and knowledge about Chinese character variations.

[0037] Graph Attention Filter: A technique used in graph neural network model training that helps models better focus on important nodes and edges when processing graph data, thereby improving model performance and generalization. In graph neural networks, the graph attention filter mechanism can determine the importance of each node by learning the relationships between them and adjust the connection weights between nodes based on these relationships, allowing the model to better capture the complex relationships and patterns in the graph data, thereby improving model performance.

[0038] 2D Attention Mask: A technique used to restrict the model's focus to specific regions or locations when using the attention mechanism for computation. It typically refers to a matrix used to guide the attention mechanism to ignore certain locations when processing two-dimensional data (such as images or sequence pairs).

[0039] Currently, pre-trained language models (PLMs) suffer from severe interference in their semantic understanding when processing input containing unintentional or intentional Chinese character variations, resulting in poor robustness. The RocBert model and the ChineseBert model have been proposed to significantly improve the robustness of Chinese PLMs in general domains. However, adversarial training requires terabyte (TB)-scale corpus, resulting in high training costs.

[0040] In addition, the GPT series of models has been proposed, which have strong robustness in Chinese natural language understanding. However, in search and recommendation scenarios, offline calculations on millions of documents or millisecond-level inference on online queries are often required, resulting in excessively high inference costs, high response times (RT), and high deployment requirements, making them unsuitable for instant search and recommendation scenarios.

[0041] Related technologies propose the RocBert model, ChineseBert model and GPT series models to solve the problem of model robustness, but they have the following defects.

[0042] Defect 1: The RocBert model and the ChineseBert model require adversarial training on TB-level corpora, resulting in high training costs.

[0043] Defect 2: In search and push scenarios, GPT series models often require offline computation on millions of documents or millisecond-level inference on online queries. This results in excessively high inference costs, high response times (RT), high deployment requirements, and is unsuitable for real-time search and push scenarios.

[0044] With respect to the above-mentioned defects, no effective solution has been proposed before the present application.

[0045] Example 1

[0046] According to an embodiment of the present application, a text processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] Considering the huge number of model parameters of large models and the limited computing resources of mobile terminals, the above text processing method provided in the embodiment of the present application can be applied to Figure 1 The application scenarios shown are not limited to these. Figure 1 In the illustrated application scenario, the large model is deployed on a server 10. The server 10 can be connected to one or more client devices 20 via a local area network, a wide area network, the Internet, or other types of data networks. The client devices 20 herein may include, but are not limited to, smartphones, tablet computers, laptops, PDAs, personal computers, smart home devices, and in-vehicle devices. The client devices 20 can interact with users via a graphical user interface to access the large model and thereby implement the methods provided in the embodiments of the present application.

[0048] In an embodiment of the present application, the system composed of a client device and a server can perform the following steps: the client device executes steps of obtaining the original text, reconstructing the characters of the original text, obtaining the reconstructed text, and sending the reconstructed text to the server; the server executes steps of using the target language understanding model to perform natural language understanding on the reconstructed text, obtains the processing result corresponding to the original text, and returns the processing result to the client device. It should be noted that, if the operating resources of the client device can meet the deployment and operation conditions of the large model, the embodiment of the present application can be carried out in the client device.

[0049] Under the above operating environment, this application provides Figure 2 The text processing method shown. Figure 2 This is a flowchart of a text processing method according to Example 1 of the present application. Figure 2 As shown, the method may include the following steps:

[0050] Step S21, obtaining an original text, wherein the original text contains mutated characters, which are incorrect characters input based on user intention;

[0051] Step S22: reconstructing the original text to obtain a reconstructed text, wherein the reconstructed text is used to establish a relationship between the variant character and the candidate characters, and the candidate characters are used to determine at least one to-be-replaced representation corresponding to the variant character;

[0052] Step S23: Use the target language understanding model to perform natural language understanding on the reconstructed text to obtain the processing result corresponding to the original text. The target language understanding model is used to identify and correct variant characters from the reconstructed text to provide processing content adapted to the original text.

[0053] The original text can be understood as incorrect text, that is, text with character variants. Exemplarily, it can be incorrect text with character variants input by the user. The original text includes variant characters, and the variant characters can be understood as incorrect characters that are similar in glyph, pronunciation, or both to the corresponding correct characters. For example, a variant character that is similar in glyph and pronunciation to "微信" can be "薇信", a variant character that is similar in pronunciation to "QQ" can be "扣扣", a variant character that is similar in glyph to "我" can be "莪", etc. There is no limitation here.

[0054] The variant characters are incorrect characters input based on the user's intention. In the embodiments of the present application, the user's intention can include two types: unintentional input by the user and intentional input by the user. Unintentional input by the user means that the user wants to input the correct characters, but due to input errors, incorrect characters (variant characters) are input. For example, the user wants to input "意思", but due to input errors, it is incorrectly input as "一丝", etc. There is no limitation here. Intentional input by the user means that the user may deliberately bypass the security mechanism of the service and input variant characters for reasons such as sending improper messages. For example, the character "加" is deliberately input as the character "+", etc. There is no limitation here.

[0055] In the embodiments of the present application, the variant characters can be in the form of words, phrases, sentences, symbols, etc. There is no limitation here.

[0056] In the embodiments of the present application, the original text can be incorrect text in the Chinese language, or incorrect text in the English language, Japanese language, Korean language, etc., or incorrect text composed of multiple languages. There is no limitation here.

[0057] The alternative characters are used to determine at least one replacement form to be represented corresponding to the variant character. The replacement form to be represented is the correct character corresponding to the variant character, that is, the alternative characters can be understood as at least one possible correct character corresponding to the variant character, that is, at least one possible original character corresponding to the variant character. Exemplarily, if the variant character is "薇", the alternative characters can include "微" that is similar in pronunciation to this variant character, and "徽" that is similar in glyph to this variant character, etc. There is no limitation here.

[0058] In the embodiments of the present application, the alternative characters can be in the form of words, phrases, sentences, symbols, etc. There is no limitation here.

[0059] In an embodiment of the present application, the variant characters and the alternative characters may be characters of the same language or characters of different languages. For example, the variant characters may be characters of the Chinese language, and the alternative characters may include characters of the English language, which is not limited here.

[0060] The reconstructed text is used to establish a connection between the variant character and the alternative character, that is, the reconstructed text is used to determine the variation relationship between the variant character and at least one alternative character. It can be understood that the variant character can be transformed into an alternative character through a glyph transformation, or through a pronunciation transformation, or through a glyph-pronunciation transformation, that is, it can be understood that the variant character can be transformed into an alternative character through different variation paths, and the variation path includes a variation path of glyph transformation, a variation path of pronunciation transformation, and a variation path of glyph-pronunciation transformation. The variation relationship can be understood as the relationship between the variant character and the alternative character that is transformed through the variation path. The reconstructed text can be understood as a text including variation path information corresponding to the variant character, and the variation path information includes the variation mode between the variant character and the corresponding at least one alternative character.

[0061] The target language understanding model is used to identify and correct variant characters in the reconstructed text. Specifically, the target language understanding model is able to identify variant characters in the reconstructed text and determine the correct alternative characters corresponding to the variant characters in the reconstructed text, thereby correcting the variant characters and obtaining the correct text content corresponding to the original text. Furthermore, after obtaining the correct text content corresponding to the original text, the target language understanding model also provides processing content adapted to the original text based on the correct text content corresponding to the original text, namely, providing processing results corresponding to the original text. These processing results may include classification results, search results, recommended content, etc., which are not limited here.

[0062] For example, if the original text is the input text related to information A searched by the user in the search and push scenario, the processing result finally output by the target language understanding model is the relevant search content and related recommended content of information A, etc., which is not limited here.

[0063] In the embodiment of the present application, the target language understanding model can be a large language model or other deep neural network model, which is not limited here.

[0064] In the embodiment of the present application, by obtaining the original text containing the variant characters input based on the user's intention, and then reconstructing the original text, establishing a connection between the variant characters and at least one alternative character corresponding to the variant characters, obtaining a reconstructed text, and finally using the target language understanding model to perform natural language understanding on the reconstructed text, identifying and correcting the variant characters from the reconstructed text, and obtaining the processing result corresponding to the original text. Thus, the purpose of correctly understanding the user's true intention through the target language understanding model and outputting the processing content corresponding to the user's true intention is achieved, improving the target language understanding model's ability to understand erroneous text input, and improving the robustness of the target language understanding model. In addition, the target language understanding model in the embodiment of the present application can be trained on Gigabyte (GB)-level corpus, can quickly adapt to vertical domain text tasks, has low training cost, and can achieve lightweight deployment requirements and high performance. That is, the target language understanding model in the embodiment of the present application can not only more effectively handle the user's erroneous input, but also improve the overall performance in the natural language understanding task, can reduce the negative impact of erroneous input on information processing, but also improve user experience and system reliability.

[0065] The above-mentioned text processing method provided in the embodiment of the present application can be applied to, but is not limited to, application scenarios involving natural language understanding in the fields of e-commerce services, educational services, legal services, medical services, conference services, social network services, financial product services, logistics services and navigation services, for example: natural language understanding of query requests for e-commerce services, natural language understanding of query requests for educational services, natural language understanding of query requests for legal services, etc., which are not limited here.

[0066] According to an embodiment of the present application, an original text containing variant characters input based on user intention is obtained, and then the original text is reconstructed. A connection is established between the variant character and at least one alternative character corresponding to the variant character to obtain a reconstructed text. Finally, a target language understanding model is used to perform natural language understanding on the reconstructed text, and the variant characters are identified and corrected from the reconstructed text to obtain a processing result corresponding to the original text. This achieves the purpose of correctly understanding the user's true intention through the target language understanding model and outputting processing content corresponding to the user's true intention, thereby achieving the technical effect of improving the target language understanding model's ability to understand erroneous text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in related technologies of improving the robustness of the model through data enhancement and adversarial training, resulting in high training costs.

[0067] In an optional embodiment, in step S22, character reconstruction is performed on the original text to obtain a reconstructed text, including the following method steps:

[0068] Step S221: Identify mutated characters from the original text;

[0069] Step S222: Query the alternative characters associated with the mutated characters and the mutation path information corresponding to the alternative characters from the preset knowledge graph. The mutation path information is used to determine the mutation relationship between the mutated characters and the alternative characters in the preset knowledge graph;

[0070] Step S223: Embed the mutation path information into the original text to obtain a reconstructed text.

[0071] The preset knowledge graph can be a pre-constructed character mutation graph, which includes mutated characters and corresponding alternative characters obtained through glyph transformation, pronunciation transformation, or glyph and pronunciation transformation. In the embodiments of the present application, the preset knowledge graph can include common mutated characters and corresponding alternative characters in different scenarios, such as search and recommendation scenarios, attack scenarios for search and recommendation scenarios, etc., which are not limited herein. By pre-constructing the preset knowledge graph and establishing the mutation relationship between the mutated characters and the alternative characters, it can lay a foundation for enhancing the subsequent training of the target language understanding model, reduce the training cost, and improve the robustness of the trained target language understanding model.

[0072] Figure 3 is a schematic diagram of the mutation relationship between characters according to Embodiment 1 of the present application, as Figure 3 shown, the character "我 (I)" can be transformed into "莪 (e)" through glyph transformation, that is, by adding "艹" above the character "我", so as to visually transform it into "莪". The character "我 (I)" can also be transformed into "窝 (wo)" through pronunciation transformation, that is, according to the pronunciation of the pinyin, by changing the third tone of "我" to the first tone in the pinyin, so as to transform it into "窝 (wo)" in pronunciation, which is not limited herein.

[0073] It can be understood that the preset knowledge graph can be a character mutation graph for the Chinese language, or a character mutation graph for the English language, Japanese language, Korean language, etc., or a character mutation graph composed of multiple languages, which is not limited herein.

[0074] In the embodiments of the present application, when reconstructing characters in the original text to obtain a reconstructed text, mutated characters can be first identified from the original text, that is, all characters in the original text are identified to identify which characters may be mutated characters.

[0075] After identifying the variant characters in the original text, query the alternative characters associated with the variant characters and the variant path information corresponding to the alternative characters from the preset knowledge graph, that is, query the alternative characters corresponding to the variant characters in the original text from the pre-constructed preset knowledge graph, and determine the variant relationship between the variant characters and the alternative characters, that is, determine through which variant path the variant characters become the alternative characters, and obtain the corresponding variant path information.

[0076] It can be understood that the variant paths include the variant paths of glyph transformation, the variant paths of pronunciation transformation, and the variant paths of glyph and pronunciation transformation. The variant path information is used to determine the variant relationship between the variant characters and the alternative characters in the preset knowledge graph, that is, it is used to determine the variant method by which the variant characters are transformed into the alternative characters in the preset knowledge graph.

[0077] Figure 4 It is the schematic diagram of the variant path according to Embodiment 1 of the present application. As Figure 4 shown, taking the variant character in the original text as "Weixin" as an example, its variant path may include the variant path of glyph transformation, that is, obtaining the alternative character "Huixin" through glyph transformation, and the variant path of glyph and pronunciation transformation, that is, obtaining the alternative character "WeChat" through glyph and pronunciation transformation. There is no limitation here.

[0078] Taking the variant character in the original text as "KuaiDi" as an example, its variant path may include the variant path of pronunciation transformation, that is, obtaining the alternative character "HuiDi" through pronunciation transformation, and the variant path of glyph and pronunciation transformation, that is, obtaining the alternative character "Express" through glyph and pronunciation transformation. There is no limitation here.

[0079] After querying the variant path information, embed the variant path information into the original text, so as to obtain the reconstructed text. Exemplarily, embed the identified variant path information into the user's original input text to form a new input string. The embedding process can be realized by adding specific prefix and suffix markers, so as to establish a connection between the incorrect characters in the original input text and their possible correct forms.

[0080] For example, if the user's original input text is "You have an overdue KuaiDi that has not been picked up", then the variant path information exemplified by "[SEP][PIN]Kuai[\PIN][PIN]Hui[\PIN][VIS]" can be embedded into the user's original input text to form the reconstructed text. The specific method is not limited here.

[0081] In an optional embodiment, in step S221, identifying the variant characters from the original text includes the following method steps:

[0082] Step S2211: Use a character recognition model to perform character recognition on the original text to obtain mutated characters. The character recognition model is used to recognize mutated characters based on the probability distribution of each character in the original text.

[0083] The character recognition model is used to recognize mutated characters based on the probability distribution of each character in the original text. Exemplarily, the character recognition model can recognize each character in the original text to obtain the probability distribution of each character in the original text, and then determine the mutated characters in the original text based on the probability distribution, which is not limited herein.

[0084] In the embodiment of the present application, when recognizing mutated characters from the original text, a character recognition model can be used to perform character recognition on the original text to automatically recognize the characters that may be incorrect in the user input, that is, to recognize the mutated characters in the original text, thereby improving the accuracy of the recognized mutated characters.

[0085] In an optional embodiment, in step S2211, using a character recognition model to perform character recognition on the original text to obtain mutated characters includes the following method steps:

[0086] Step S211: Use a character recognition model to calculate the probability distribution of each character in the original text to obtain a probability distribution statistical result, and identify some characters with probabilities lower than a preset threshold from the probability distribution statistical result to obtain mutated characters.

[0087] The probability distribution statistical result can be understood as a statistical result used to determine the possibility of each character appearing in the original text. It can be understood that the higher the possibility of a character appearing, the less likely it is that the character is a mutated character. On the contrary, the lower the possibility of a character appearing, the more likely it is that the character is a mutated character.

[0088] In the embodiment of the present application, the probability distribution of characters can be calculated according to different scenarios. Exemplarily, the character "what" generally appears in the search and recommendation scenario. Then, in the original text of the search and recommendation scenario, if the character "what" exists, the character "what" will calculate a higher probability value. If the character "甚末" exists, the character "甚末" will calculate a lower probability value.

[0089] In the embodiment of the present application, when using a character recognition model to perform character recognition on the original text to obtain mutated characters, a character recognition model can be used to calculate the probability distribution of each character in the original text to obtain a probability distribution statistical result, and identify some characters with probabilities lower than a preset threshold from the probability distribution statistical result, so as to accurately obtain mutated characters.

[0090] In an optional embodiment, the text processing method further includes the following method steps:

[0091] Step S24: construct a preset knowledge graph, wherein the preset knowledge graph is used to establish variation relationships between characters by analyzing character variation forms generated in various types of network attack scenarios.

[0092] Various types of network attack scenarios may include phishing-type network attack scenarios that induce users to enter personal information or install malicious software by sending fake emails or website links. They may also include vulnerability-exploitation-type network attack scenarios that exploit vulnerabilities in the system or software to gain system permissions or steal information. They may also include network attack scenarios targeting specific targets, etc., which are not limited here.

[0093] In an embodiment of the present application, a preset knowledge graph can also be constructed. The preset knowledge graph is used to establish a variation relationship between characters by analyzing the character variation forms generated in various types of network attack scenarios, that is, by analyzing the common character variation forms in different types of network attack scenarios, the variation relationship between characters is established, that is, it is pre-determined through which variation paths the conversion between multiple variant characters and alternative characters can be achieved, so as to provide a basis for subsequent training of the target language understanding model.

[0094] In an optional embodiment, the preset knowledge graph includes: a Chinese character variation graph, and the Chinese character variation graph includes one or more of the following variation forms: pinyin variation, visual variation, glyph pinyin variation, and code variation.

[0095] In an embodiment of the present application, the preset knowledge graph may include a Chinese Character Variation Map (CCVG). Based on the characteristics of the Chinese language, the Chinese Character Variation Map includes one or more of the following variation forms: phonetic variation, visual variation, glyph-phonetic variation, code variation, spelling variation, etc. Among them, phonetic variation can be understood as the pronunciation variation of the example, glyph variation can be understood as the visual variation of the example, glyph-phonetic variation can be understood as the glyph-phonetic variation of the aforementioned example, code variation can be understood as code variation caused by incorrect operation of input code when inputting text through code, and spelling variation can be understood as spelling variation caused by errors in spelling operation when inputting text using different input methods, which are not limited here.

[0096] It is understandable that the preset knowledge graph in the embodiment of the present application may also include English character variation graphs, Japanese character variation graphs, Korean character variation graphs, etc., and may also be character variation graphs composed of multiple languages, which is not limited here.

[0097] In an optional embodiment, the text processing method further includes the following method steps:

[0098] Step S25, using the initial language understanding model to perform natural language understanding on the training text to obtain a training result corresponding to the training text;

[0099] In step S26, based on the training results and the graph attention filtering mechanism, the model parameters of the initial language understanding model are fine-tuned to obtain the target language understanding model, wherein the graph attention filtering mechanism is used to adjust the attention distribution of the initial language understanding model.

[0100] The training text may be a training sample for training an initial language understanding model, and the training text may include incorrect characters input based on user intention.

[0101] The initial language understanding model can be a large language model or other deep neural network model, and is not limited here. The initial language understanding model can perform natural language understanding on the training text, thereby obtaining training results corresponding to the training text, that is, obtaining classification results or search and recommendation results corresponding to the training text.

[0102] The graph attention filter mechanism is used to adjust the attention distribution of the initial language understanding model. Fine-tuning the model parameters of the initial language understanding model based on the training results and the graph attention filter mechanism can help the initial language understanding model better understand and process input data, thereby improving the model's performance and generalization capabilities.

[0103] In an embodiment of the present application, when training to obtain a target language understanding model, the initial language understanding model can be used to perform natural language understanding on the training text to obtain training results corresponding to the training text, and then based on the training results and the graph attention filtering mechanism, the model parameters of the initial language understanding model are fine-tuned. The initial language understanding model will learn to identify and correct erroneous inputs through the training results and the graph attention filtering mechanism, thereby improving its robustness, and thus training to obtain the target language understanding model.

[0104] In an optional embodiment, in step S26, based on the training results and the graph attention filtering mechanism, the model parameters of the initial language understanding model are fine-tuned to obtain the target language understanding model, including the following method steps:

[0105] Step S261: constructing an attention mask based on the graph attention filtering mechanism, wherein the attention mask is used to control the initial language understanding model to capture the alternative characters associated with the variant character;

[0106] Step S262: Based on the training results and the attention mask, fine-tune the model parameters of the initial language understanding model to obtain the target language understanding model.

[0107] In an embodiment of the present application, the attention mask can be a two-dimensional attention mask. The two-dimensional attention mask is a technology for limiting the model to focus on specific areas or positions when using the attention mechanism for calculation. In an embodiment of the present application, the attention mask is used to control the initial language understanding model to capture alternative characters associated with variant characters, that is, to control the initial language understanding model to only focus on alternative characters associated with variant characters, reduce attention to irrelevant information, thereby helping the initial language understanding model to better understand and process input data, and improve the performance and effect of the model.

[0108] In an embodiment of the present application, when fine-tuning the model parameters of the initial language understanding model based on the training results and the graph attention filtering mechanism to obtain the target language understanding model, an attention mask can be constructed based on the graph attention filtering mechanism. For example, a two-dimensional attention mask can be constructed based on the graph attention filtering mechanism to refine the capture of key information in the input sequence (i.e., the reconstructed text), so that the initial language understanding model can only focus on the alternative characters associated with the variant characters, reducing attention to irrelevant information. Then, based on the training results and the attention mask, the model parameters of the initial language understanding model are fine-tuned to train the target language understanding model.

[0109] In an optional embodiment, in step S23, natural language understanding is performed on the reconstructed text using a target language understanding model to obtain a processing result, which includes the following method steps:

[0110] Step S231: In response to the original text being an information search text, a target language understanding model is used to perform natural language understanding on the information search text to obtain information search results corresponding to the information search text;

[0111] Step S232: In response to the original text being an information recommendation text, using the target language understanding model to perform natural language understanding on the information recommendation text to obtain an information recommendation result corresponding to the information recommendation text;

[0112] Step S233: In response to the original text being an information classification text, a target language understanding model is used to perform natural language understanding on the information search text to obtain an information classification result corresponding to the information classification text;

[0113] Step S234 , in response to the original text being an information understanding text, a target language understanding model is used to perform natural language understanding on the information search text to obtain an information understanding result corresponding to the information classification text.

[0114] In an embodiment of the present application, when the target language understanding model is used to perform natural language understanding on the reconstructed text to obtain processing results, different processing results can be obtained according to different types of original texts, that is, different processing results can be obtained according to the original texts in different application scenarios.

[0115] If the application scenario is an information search scenario, the original text is the information search text, and the target language understanding model is used to perform natural language understanding on the information search text to obtain information search results corresponding to the information search text.

[0116] If the application scenario is an information recommendation scenario, the original text is the information recommendation text, and the target language understanding model is used to perform natural language understanding on the information recommendation text, thereby obtaining the information recommendation result corresponding to the information recommendation text.

[0117] If the application scenario is an information classification scenario, the original text is the information classification text, and the target language understanding model is used to perform natural language understanding on the information search text to obtain the information classification result corresponding to the information classification text.

[0118] If the application scenario is an information understanding scenario, the original text is the information understanding text, and the target language understanding model is used to perform natural language understanding on the information search text, thereby obtaining the information understanding result corresponding to the information classification text.

[0119] It is understandable that the application scenario may also be other application scenarios, and the corresponding original text may also be other types of text, which are not limited here.

[0120] In an embodiment of the present application, the trained target language understanding model can also be integrated into an existing natural language processing system and applied to actual user erroneous input scenarios. By comparing the performance with that of an untrained initial language understanding model, the effectiveness of the target language understanding model in processing erroneous input can be evaluated to ensure the accuracy of semantic understanding.

[0121] It can be seen that this application adopts model-side optimization (i.e., graph attention filtering mechanism) and pre-builds a refined preset knowledge graph to train the model. After actual testing, the target language understanding model of this application can surpass the capabilities of existing models in zero-sample classification tasks. At the same time, the target language understanding model of this application has a low model deployment cost and a short inference delay, and can be better applied to discriminative tasks.

[0122] It is easy to understand that the beneficial effects of the text processing method provided by this application include the following points.

[0123] Beneficial effect (1): This application can train the model on GB-level corpus, reducing the training cost of the model.

[0124] Beneficial effect (2): Based on the self-built preset knowledge graph and graph attention filtering mechanism, embedded in the general pre-training model, it can improve the robustness of the trained model and enhance the model's ability to understand erroneous text input.

[0125] Beneficial effect (3): The model trained by this application can accurately identify and interpret the true intention of users under erroneous or irregular input, thereby providing more accurate search results and recommended content.

[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0127] In addition, it should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

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

[0129] Example 2

[0130] In the operating environment as in Example 1, the present application provides Figure 5 A text processing method shown in Figure 5 is a flowchart of a text processing method according to Example 2 of the present application, such as Figure 5 As shown, the method includes:

[0131] Step S51: obtaining a text processing request through a first application programming interface, wherein the request data carried in the text processing request includes: original text, the original text containing mutated characters, and the mutated characters are erroneous characters input based on user intention;

[0132] Step S52, return a text processing response through the second application programming interface. The response data carried in the text processing response includes: a processing result, which is obtained by performing natural language understanding on the reconstructed text using a target language understanding model. The target language understanding model is used to identify and correct variant characters from the reconstructed text to provide processing content adapted to the original text. The reconstructed text is obtained by performing character reconstruction on the original text. The reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one replacement representation corresponding to the variant characters.

[0133] The first application programming interface and the second application programming interface can be understood as application programming interfaces (Application Programming Interface, API) for developers to call to implement specific functions or obtain specific data, usually provided in the form of a set of functions, classes, structures, and protocols.

[0134] The text processing request can be understood as a text processing request input by the user. The request data carried in the text processing request includes: the original text, which can be understood as an incorrect text, that is, a text with character variations. Exemplarily, it can be an incorrect text with character variations input by the user. The original text includes variant characters, which can be understood as incorrect characters that are similar in glyph, pronunciation, or both to the corresponding correct characters. For example, a variant character that is similar in glyph and pronunciation to "微信" can be "薇信", etc.; a variant character that is similar in pronunciation to "QQ" can be "扣扣", etc.; a variant character that is similar in glyph to "我" can be "莪", etc., without limitation here.

[0135] The variant characters are incorrect characters input based on the user's intention. In the embodiments of the present application, the user's intention can include two types: unintentional input by the user and intentional input by the user. Unintentional input by the user means that the user wants to input the correct characters but mistakenly inputs the variant characters due to input errors. Intentional input by the user means that the user may deliberately bypass the security mechanism of the service and input variant characters for reasons such as sending black and gray production information.

[0136] In the embodiments of the present application, the original text can be an incorrect text in Chinese, or an incorrect text in English, Japanese, Korean, etc., or an incorrect text composed of multiple languages, without limitation here.

[0137] The text processing response can be understood as the response information corresponding to the text processing request input by the user. The response data carried in the text processing response includes: the processing result, which is obtained by performing natural language understanding on the reconstructed text using a target language understanding model. The target language understanding model is used to identify and correct variant characters from the reconstructed text to provide processing content adapted to the original text. The reconstructed text is obtained by performing character reconstruction on the original text. The reconstructed text is used to establish a connection between the variant characters and alternative characters. The alternative characters are used to determine at least one form of replacement representation corresponding to the variant characters.

[0138] The alternative characters are used to determine at least one form of replacement representation corresponding to the variant characters. The form of replacement representation is the correct character corresponding to the variant character. That is, the alternative characters can be understood as at least one possible correct character corresponding to the variant character, or at least one possible original character corresponding to the variant character. Exemplarily, if the variant character is "薇", the alternative characters may include "微" which has a similar pronunciation to this variant character, and "徽" which has a similar glyph to this variant character, etc., without limitation here.

[0139] In the embodiments of this application, the variant characters and the alternative characters can be characters of the same language, or characters of different languages. For example, the variant characters can be characters of the Chinese language, and the alternative characters can include characters of the English language, without limitation here.

[0140] The reconstructed text is used to establish a connection between the variant characters and the alternative characters, that is, the reconstructed text is used to determine the variant relationship between the variant characters and at least one alternative character. It can be understood that the variant characters can be transformed into alternative characters through glyph transformation, or through pronunciation transformation, or through glyph and pronunciation transformation. That is, it can be understood that the variant characters can be transformed into alternative characters through different variant paths. The variant paths include the variant path of glyph transformation, the variant path of pronunciation transformation, and the variant path of glyph and pronunciation transformation. The reconstructed text can be understood as the text including the variant path information corresponding to the variant characters. The variant path information includes the variant method between the variant characters and the corresponding at least one alternative character.

[0141] The target language understanding model is used to identify and correct variant characters in the reconstructed text. Specifically, the target language understanding model is able to identify variant characters in the reconstructed text and determine the correct alternative characters corresponding to the variant characters in the reconstructed text, thereby correcting the variant characters and obtaining the correct text content corresponding to the original text. Furthermore, after obtaining the correct text content corresponding to the original text, the target language understanding model also provides processing content adapted to the original text based on the correct text content corresponding to the original text, namely, providing processing results corresponding to the original text. These processing results may include classification results, search results, recommended content, etc., which are not limited here.

[0142] For example, if the original text is the input text related to information A searched by the user in the search and push scenario, the processing result finally output by the target language understanding model is the relevant search content and related recommended content of information A, etc., which is not limited here.

[0143] In the embodiment of the present application, the target language understanding model can be a large language model or other deep neural network model, which is not limited here.

[0144] In an embodiment of the present application, a text processing request is obtained through a first application programming interface, wherein the request data carried in the text processing request includes: the original text, the original text contains variant characters, and the variant characters are incorrect characters input based on the user's intention. Then, a text processing response is returned through a second application programming interface, wherein the response data carried in the text processing response includes: a processing result, which is obtained by using a target language understanding model to perform natural language understanding on the reconstructed text, the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text, the reconstructed text is obtained by character reconstruction of the original text, the reconstructed text is used to establish a connection between the variant characters and the alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters. In this way, the purpose of correctly understanding the user's true intention through the target language understanding model and outputting processing content corresponding to the user's true intention is achieved, thereby improving the target language understanding model's ability to understand incorrect text input and improving the robustness of the target language understanding model. In addition, the target language understanding model in the embodiment of the present application can be trained on gigabyte (GB)-level corpus, can quickly adapt to vertical domain text tasks, has low training costs, and can achieve lightweight deployment requirements and high performance. In other words, the target language understanding model in the embodiment of the present application can not only more effectively handle user erroneous input, but also improve the overall performance of natural language understanding tasks, reduce the negative impact of erroneous input on information processing, and improve user experience and system reliability.

[0145] The above-mentioned text processing method provided in the embodiment of the present application can be applied to, but is not limited to, application scenarios involving natural language understanding in the fields of e-commerce services, educational services, legal services, medical services, conference services, social network services, financial product services, logistics services and navigation services, for example: natural language understanding of query requests for e-commerce services, natural language understanding of query requests for educational services, natural language understanding of query requests for legal services, etc., which are not limited here.

[0146] In an embodiment of the present application, a text processing request is obtained through a first application programming interface, wherein the request data carried in the text processing request includes: original text, the original text containing variant characters, which are incorrect characters input based on user intention, and then a text processing response is returned through a second application programming interface, wherein the response data carried in the text processing response includes: processing results, which are obtained by using a target language understanding model to perform natural language understanding on the reconstructed text, the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text, the reconstructed text is obtained by character reconstruction of the original text, the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters, thereby achieving the purpose of correctly understanding the user's true intention through the target language understanding model and outputting processing content corresponding to the user's true intention, thereby achieving the technical effects of improving the target language understanding model's ability to understand incorrect text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in the related art of improving the robustness of the model through data augmentation and adversarial training, which leads to high training costs.

[0147] It should be noted that the preferred implementation of this embodiment can be found in the relevant description in Example 1 and will not be repeated here.

[0148] Example 3

[0149] In the operating environment as in Example 1, the present application provides Figure 6 A text processing method shown.

[0150] Figure 6 is a flowchart of a text processing method according to Example 3 of the present application, such as Figure 6 As shown, the method includes:

[0151] Step S61: obtaining a currently input text processing dialog request, wherein the request data carried in the text processing dialog request includes: original text, the original text containing mutated characters, and the mutated characters are incorrect characters input based on the user's intention;

[0152] Step S62: In response to a text processing dialogue request, return a text processing dialogue reply. The information carried in the text processing dialogue reply includes: a processing result, which is obtained by performing natural language understanding on the reconstructed text using a target language understanding model. The target language understanding model is used to identify and correct variant characters from the reconstructed text to provide processing content adapted to the original text. The reconstructed text is obtained by performing character reconstruction on the original text.

[0153] The text processing dialogue request can be understood as a text processing dialogue request input when a user converses with a machine. The request data carried in the text processing dialogue request includes: the original text. The original text can be understood as an incorrect text, that is, a text with character variants. Exemplarily, it can be an incorrect text with character variants input by the user. The original text includes variant characters, and the variant characters can be understood as incorrect characters that are similar in glyph, pronunciation, or both to the corresponding correct characters. For example, the variant characters similar in glyph and pronunciation to "lottery" can be "睬剽", etc.; the variant characters similar in pronunciation to "QQ" can be "扣扣", etc.; the variant characters similar in glyph to "我" can be "莪", etc. There is no limitation here.

[0154] The variant characters are incorrect characters input based on the user's intention. In the embodiments of the present application, the user's intention can include two types: unintentional input by the user and intentional input by the user. Unintentional input by the user means that the user wants to input the correct characters but mistakenly inputs variant characters due to input errors. Intentional input by the user means that the user may deliberately bypass the security mechanism of the service and input variant characters for reasons such as sending black and gray production information.

[0155] In the embodiments of the present application, the original text can be an incorrect text in Chinese, or an incorrect text in English, Japanese, Korean, etc., or an incorrect text composed of multiple languages. There is no limitation here.

[0156] According to the text processing dialogue request, the machine will return a text processing dialogue reply corresponding to the text processing dialogue request. The information carried in the text processing dialogue reply includes: a processing result, which is obtained by performing natural language understanding on the reconstructed text using a target language understanding model. The target language understanding model is used to identify and correct variant characters from the reconstructed text to provide processing content adapted to the original text. The reconstructed text is obtained by performing character reconstruction on the original text. The reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one replacement representation corresponding to the variant characters.

[0157] Alternative characters are used to determine at least one form of replacement representation corresponding to the variant character. The form of replacement representation is the correct character corresponding to the variant character. That is, alternative characters can be understood as at least one possible correct character corresponding to the variant character, or at least one possible original character corresponding to the variant character. Exemplarily, if the variant character is "薇", the alternative characters may include "微" which has a similar pronunciation to this variant character, and "徽" which has a similar glyph to this variant character, etc., without limitation here.

[0158] In the embodiments of this application, the variant character and the alternative character can be characters of the same language or characters of different languages. For example, the variant character can be a character of the Chinese language, and the alternative characters can include characters of the English language, without limitation here.

[0159] The reconstruction text is used to establish a connection between the variant character and the alternative character, that is, the reconstruction text is used to determine the variant relationship between the variant character and at least one alternative character. It can be understood that the variant character can be transformed into the alternative character through glyph transformation, or through pronunciation transformation, or through glyph and pronunciation transformation. That is, it can be understood that the variant character can be transformed into the alternative character through different variant paths, and the variant paths include the variant path of glyph transformation, the variant path of pronunciation transformation, and the variant path of glyph and pronunciation transformation. The reconstruction text can be understood as the text including the variant path information corresponding to the variant character, and the variant path information includes the variant manner between the variant character and the corresponding at least one alternative character.

[0160] The target language understanding model is used to identify and correct the variant character from the reconstruction text. That is, the target language understanding model can identify the variant character in the reconstruction text and determine the correct alternative character corresponding to the variant character in the reconstruction text, so as to correct the variant character and obtain the correct text content corresponding to the original text. In addition, after obtaining the correct text content corresponding to the original text, the target language understanding model will also provide the processing content adapted to the original text based on the correct text content corresponding to the original text, that is, provide the processing result corresponding to the original text, and the processing result can include classification results, search results, recommended content, etc., without limitation here.

[0161] Exemplarily, if the original text is the input text about information A searched by the user in the search and recommendation scenario, the processing result finally output by the target language understanding model is the relevant search content and relevant recommended content of information A, etc., without limitation here.

[0162] In the embodiments of this application, the target language understanding model can be a large language model or other deep neural network models, without limitation here.

[0163] Optionally, after obtaining the processing result carried in the text processing dialogue reply, the processing result can be displayed in the machine's graphical user interface to provide feedback to the user.

[0164] In an embodiment of the present application, by obtaining a text processing dialogue request of the current input, wherein the request data carried in the text processing dialogue request includes: the original text, the original text contains variant characters, the variant characters are incorrect characters input based on the user's intention, and then in response to the text processing dialogue request, a text processing dialogue reply is returned, wherein the information carried in the text processing dialogue reply includes: a processing result, the processing result is obtained after the target language understanding model performs natural language understanding on the reconstructed text, the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text, and the reconstructed text is obtained after character reconstruction of the original text. Thus, the purpose of correctly understanding the user's true intention through the target language understanding model and outputting the processing content corresponding to the user's true intention is achieved, the target language understanding model's ability to understand incorrect text input is improved, and the robustness of the target language understanding model is improved. In addition, the target language understanding model in the embodiment of the present application can be trained on Gigabyte (GB)-level corpus, can adapt to vertical domain text tasks agilely, has low training cost, and can achieve lightweight deployment requirements and high performance. That is, the target language understanding model of the embodiment of the present application can not only handle user erroneous input more effectively, but also improve the overall performance in natural language understanding tasks, reduce the negative impact of erroneous input on information processing, and improve user experience and system reliability.

[0165] The above-mentioned text processing method provided in the embodiment of the present application can be applied to, but is not limited to, application scenarios involving natural language understanding in the fields of e-commerce services, educational services, legal services, medical services, conference services, social network services, financial product services, logistics services and navigation services, for example: natural language understanding of query requests for e-commerce services, natural language understanding of query requests for educational services, natural language understanding of query requests for legal services, etc., which are not limited here.

[0166] According to an embodiment of the present application, a text processing dialogue request currently input is obtained, wherein the request data carried in the text processing dialogue request includes: original text, the original text contains variant characters, and the variant characters are incorrect characters input based on the user's intention. Then, in response to the text processing dialogue request, a text processing dialogue reply is returned, wherein the information carried in the text processing dialogue reply includes: processing results, which are obtained by performing natural language understanding on the reconstructed text using a target language understanding model. The target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text. The reconstructed text is obtained by character reconstruction of the original text. The reconstructed text is used to establish a connection between the mutated characters and the alternative characters, and the alternative characters are used to determine at least one form of expression to be replaced corresponding to the mutated characters. Finally, the processing results are displayed in the graphical user interface as feedback to the user, thereby achieving the purpose of correctly understanding the user's true intention through the target language understanding model and outputting the processing content corresponding to the user's true intention, thereby achieving the technical effect of improving the target language understanding model's ability to understand erroneous text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in related technologies of improving the robustness of the model through data enhancement and adversarial training, resulting in high training costs.

[0167] It should be noted that the preferred implementation of this embodiment can be found in the relevant description in Example 1 and will not be repeated here.

[0168] Example 4

[0169] In the operating environment as in Example 1, the present application provides Figure 7 A text processing method shown.

[0170] Figure 7 is a flowchart of a text processing method according to Example 4 of the present application, such as Figure 7 As shown, the method includes:

[0171] Step S71, obtaining an original legal text, wherein the original legal text contains mutated characters, which are incorrect characters input based on user intention;

[0172] Step S72: reconstructing the original legal text to obtain a reconstructed legal text, wherein the reconstructed legal text is used to establish a relationship between the variant character and the alternative character, and the alternative character is used to determine at least one to-be-replaced representation corresponding to the variant character;

[0173] Step S73: Use the target language understanding model to perform natural language understanding on the reconstructed legal text, and obtain the processing result corresponding to the original legal text. The target language understanding model is used to identify and correct variant characters in the reconstructed legal text to provide processing content adapted to the original legal text.

[0174] The original legal text can be understood as the incorrect text in a legal document, that is, the text with character variants. Exemplarily, it can be the incorrect text with character variants input by the user. The original legal text includes variant characters, and the variant characters can be understood as incorrect characters that are similar in glyph, pronunciation, or both to the corresponding correct characters. For example, the variant character similar in glyph and pronunciation to "WeChat" can be "V WeChat", the variant character similar in pronunciation to "QQ" can be "Q Q", the variant character similar in glyph to "I" can be "E", etc. There is no limitation here.

[0175] The variant characters are incorrect characters input based on the user's intention. In the embodiments of the present application, the user's intention can include two types: user's unintentional input and user's intentional input. User's unintentional input means that the user wants to input the correct character, but due to input errors, the incorrect variant character is input. For example, the user wants to input "meaning", but due to input errors, it is incorrectly input as "a trace", etc. There is no limitation here. User's intentional input means that the user may deliberately bypass the security mechanism of the service and input variant characters for reasons such as sending improper messages. For example, the character "add" is deliberately input as the character "+", etc. There is no limitation here.

[0176] In the embodiments of the present application, the variant characters can be in the forms of words, phrases, sentences, symbols, etc. There is no limitation here.

[0177] In the embodiments of the present application, the original legal text can be the incorrect text in Chinese, or the incorrect text in English, Japanese, Korean, etc., or the incorrect text composed of multiple languages. There is no limitation here.

[0178] The alternative characters are used to determine at least one replacement representation form corresponding to the variant character. The replacement representation form is the correct character corresponding to the variant character, that is, the alternative characters can be understood as at least one possible correct character corresponding to the variant character, that is, at least one possible original character corresponding to the variant character. Exemplarily, if the variant character is "V", the alternative characters can include "W" that is similar in pronunciation to this variant character, and "Emblem" that is similar in glyph to this variant character, etc. There is no limitation here.

[0179] In the embodiments of the present application, the alternative characters can be in the forms of words, phrases, sentences, symbols, etc. There is no limitation here.

[0180] In an embodiment of the present application, the variant characters and the alternative characters may be characters of the same language or characters of different languages. For example, the variant characters may be characters of the Chinese language, and the alternative characters may include characters of the English language, which is not limited here.

[0181] Reconstructing the legal text is used to establish a connection between variant characters and alternative characters, that is, reconstructing the legal text is used to determine the variation relationship between the variant character and at least one alternative character. It can be understood that the variant character can be transformed into an alternative character through glyph transformation, or through pronunciation transformation, or through glyph-pronunciation transformation, that is, it can be understood that the variant character can be transformed into an alternative character through different variation paths, and the variation path includes the variation path of glyph transformation, the variation path of pronunciation transformation and the variation path of glyph-pronunciation transformation. The variation relationship can be understood as the relationship between the variant character and the alternative character that is converted through the variation path. Reconstructing the legal text can be understood as a text including variation path information corresponding to the variant character, and the variation path information includes the variation mode between the variant character and the corresponding at least one alternative character.

[0182] The target language understanding model is used to identify and correct variant characters in the reconstructed legal text. Specifically, the target language understanding model is able to identify variant characters in the reconstructed legal text and determine the correct alternative characters corresponding to the variant characters in the reconstructed legal text, thereby correcting the variant characters and obtaining the correct text content corresponding to the original legal text. Furthermore, after obtaining the correct text content corresponding to the original legal text, the target language understanding model also provides processing content that is compatible with the original legal text based on the correct text content corresponding to the original legal text. Specifically, it provides processing results corresponding to the original legal text. These processing results may include classification results, search results, recommended content, etc., which are not limited here.

[0183] For example, if the original legal text is the input text for information A that the user searches for in the search and push scenario, the processing result ultimately output by the target language understanding model is the relevant search content and related recommended content of information A, etc., which is not limited here.

[0184] In the embodiment of the present application, the target language understanding model can be a large language model or other deep neural network model, which is not limited here.

[0185] In the embodiment of the present application, by obtaining the original legal text containing the variant characters input based on the user's intention, and then reconstructing the characters of the original legal text, establishing a connection between the variant characters and at least one alternative character corresponding to the variant characters, a reconstructed legal text is obtained, and finally the target language understanding model is used to perform natural language understanding on the reconstructed legal text, and the variant characters are identified and corrected from the reconstructed legal text to obtain the processing result corresponding to the original legal text. Thus, the purpose of correctly understanding the user's true intention through the target language understanding model and outputting the processing content corresponding to the user's true intention is achieved, the target language understanding model's ability to understand erroneous text input is improved, and the robustness of the target language understanding model is improved. In addition, the target language understanding model in the embodiment of the present application can be trained on Gigabyte (GB)-level corpus, can adapt to vertical domain text tasks agilely, has low training cost, and can achieve lightweight deployment requirements and high performance. That is, the target language understanding model in the embodiment of the present application can not only more effectively handle the user's erroneous input, but also improve the overall performance in the natural language understanding task, which can reduce the negative impact of erroneous input on information processing and improve user experience and system reliability.

[0186] The above-mentioned text processing method provided in the embodiment of the present application can also be applied to, but is not limited to, application scenarios involving natural language understanding in the fields of e-commerce services, educational services, medical services, conference services, social network services, financial product services, logistics services and navigation services, for example: natural language understanding of query requests for e-commerce services, natural language understanding of query requests for educational services, natural language understanding of query requests for legal services, etc., which are not limited here.

[0187] According to an embodiment of the present application, an original legal text containing mutated characters input based on user intention is obtained, and then the original legal text is reconstructed. A connection is established between the mutated character and at least one alternative character corresponding to the mutated character to obtain a reconstructed legal text. Finally, a target language understanding model is used to perform natural language understanding on the reconstructed legal text, and the mutated characters are identified and corrected from the reconstructed legal text to obtain a processing result corresponding to the original legal text. This achieves the purpose of correctly understanding the user's true intention through the target language understanding model and outputting the processing content corresponding to the user's true intention, thereby achieving the technical effect of improving the target language understanding model's ability to understand erroneous text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in related technologies of improving the robustness of the model through data enhancement and adversarial training, resulting in high training costs.

[0188] In an optional embodiment, in step S72, character reconstruction is performed on the original legal text to obtain a reconstructed legal text, including the following method steps:

[0189] Step S721, identifying mutated characters from the original legal text;

[0190] Step S722, querying the alternative characters associated with the mutated characters and the mutation path information corresponding to the alternative characters from a preset knowledge graph, where the mutation path information is used to determine the mutation relationship between the mutated characters and the alternative characters in the preset knowledge graph;

[0191] Step S723, embedding the mutation path information into the original legal text to obtain a reconstructed legal text.

[0192] The preset knowledge graph can be a pre-constructed character mutation graph, and the preset knowledge graph includes mutated characters and corresponding alternative characters obtained through glyph transformation, pronunciation transformation, or glyph and pronunciation transformation. In the embodiments of the present application, the preset knowledge graph can include common mutated characters and corresponding alternative characters in different scenarios, such as search and recommendation scenarios, attack scenarios for search and recommendation scenarios, etc., which are not limited herein. By pre-constructing the preset knowledge graph, the mutation relationship between the mutated characters and the alternative characters is established, which can lay a foundation for enhancing the subsequent training of the target language understanding model, reduce the training cost, and improve the robustness of the trained target language understanding model.

[0193] As Figure 3 shown, the character "我" can be transformed into "莪" through glyph transformation, that is, by adding "艹" above the character "我", thus visually transforming it into "莪". The character "我" can also be transformed into "窝" through pronunciation transformation, that is, according to the pronunciation of the pinyin, by changing the third tone of "我" to the first tone in the pinyin, thus transforming it into "窝" in pronunciation, which is not limited herein.

[0194] It can be understood that the preset knowledge graph can be a character mutation graph of the Chinese language, or a character mutation graph of the English language, Japanese language, Korean language, etc., or a character mutation graph composed of multiple languages, which is not limited herein.

[0195] In the embodiments of the present application, when performing character reconstruction on the original legal text to obtain a reconstructed legal text, mutated characters can be first identified from the original legal text, that is, all characters in the original legal text are identified to identify which characters may be mutated characters.

[0196] After identifying the variant characters in the original legal text, query the alternative characters associated with the variant characters and the variant path information corresponding to the alternative characters from the preset knowledge graph, that is, query the alternative characters corresponding to the variant characters in the original legal text from the pre-constructed preset knowledge graph, and determine the variant relationship between the variant characters and the alternative characters, that is, determine through which variant path the variant characters become the alternative characters, and obtain the corresponding variant path information.

[0197] It can be understood that the variant paths include the variant paths of glyph transformation, pronunciation transformation, and the variant paths of glyph and pronunciation transformation. The variant path information is used to determine the variant relationship between the variant characters and the alternative characters in the preset knowledge graph, that is, to determine the variant method by which the variant characters are transformed into the alternative characters in the preset knowledge graph.

[0198] For example Figure 4 As shown, taking the variant character "Weixin" in the original legal text as an example, its variant paths may include the variant path of glyph transformation, that is, obtaining the alternative character "Huixin" through glyph transformation, and the variant path of glyph and pronunciation transformation, that is, obtaining the alternative character "WeChat" through glyph and pronunciation transformation, which is not limited here.

[0199] Taking the variant character "KuaiDi" in the original legal text as an example, its variant paths may include the variant path of pronunciation transformation, that is, obtaining the alternative character "HuiDi" through pronunciation transformation, and the variant path of glyph and pronunciation transformation, that is, obtaining the alternative character "Express" through glyph and pronunciation transformation, which is not limited here.

[0200] After querying the variant path information, embed the variant path information into the original legal text, so as to obtain the reconstructed legal text. Exemplarily, embed the identified variant path information into the user's original input text to form a new input string. The embedding process can be implemented by adding specific prefix and suffix markers, so as to establish a connection between the incorrect characters in the original input text and their possible correct forms.

[0201] For example, if the user's original input text is "You have an overdue KuaiDi that has not been picked up", then the variant path information exemplified by "[SEP][PIN]Kuai[\PIN][PIN]Hui[\PIN][VIS]" can be embedded into the user's original input text to form the reconstructed legal text, and the specific method is not limited here.

[0202] Embodiment 5

[0203] According to the embodiments of the present application, an apparatus embodiment for implementing the above text processing method is also provided. Figure 8 It is a schematic structural diagram of a text processing apparatus according to Embodiment 5 of the present application, as Figure 8As shown, the device includes:

[0204] The first acquisition module 801 is used to acquire original text, wherein the original text contains mutated characters, which are incorrect characters input based on user intention;

[0205] A first reconstruction module 802 is configured to reconstruct characters of the original text to obtain a reconstructed text, wherein the reconstructed text is used to establish a relationship between the variant character and the alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant character;

[0206] The first processing module 803 is used to use the target language understanding model to perform natural language understanding on the reconstructed text to obtain a processing result corresponding to the original text, wherein the target language understanding model is used to identify and correct mutated characters from the reconstructed text to provide processing content that is compatible with the original text.

[0207] Optionally, the above-mentioned first reconstruction module 802 is also used to: identify variant characters from the original text; query the alternative characters associated with the variant characters and the variant path information corresponding to the alternative characters from the preset knowledge graph, wherein the variant path information is used to determine the variant relationship between the variant characters and the alternative characters in the preset knowledge graph; embed the variant path information into the original text to obtain the reconstructed text.

[0208] Optionally, the first reconstruction module 802 is further configured to perform character recognition on the original text using a character recognition model to obtain variant characters, wherein the character recognition model is configured to recognize the variant characters based on the probability distribution of each character in the original text.

[0209] Optionally, the first reconstruction module 802 is further used to: use a character recognition model to calculate the probability distribution of each character in the original text to obtain a probability distribution statistical result, and identify some characters whose probability is lower than a preset threshold from the probability distribution statistical result to obtain variant characters.

[0210] Optionally, it also includes: a construction module for: constructing a preset knowledge graph, wherein the preset knowledge graph is used to establish variation relationships between characters by analyzing character variation forms generated in various types of network attack scenarios.

[0211] Optionally, it also includes: a fine-tuning module, which is used to: use the initial language understanding model to perform natural language understanding on the training text to obtain training results corresponding to the training text; based on the training results and the graph attention filtering mechanism, fine-tune the model parameters of the initial language understanding model to obtain the target language understanding model, wherein the graph attention filtering mechanism is used to adjust the attention distribution of the initial language understanding model.

[0212] Optionally, the above-mentioned fine-tuning module is also used to: construct an attention mask based on the graph attention filtering mechanism, wherein the attention mask is used to control the initial language understanding model to capture alternative characters associated with the variant characters; based on the training results and the attention mask, fine-tune the model parameters of the initial language understanding model to obtain the target language understanding model.

[0213] Optionally, the above-mentioned first processing module 803 is used to: in response to the original text being an information search text, use the target language understanding model to perform natural language understanding on the information search text to obtain information search results corresponding to the information search text; in response to the original text being an information recommendation text, use the target language understanding model to perform natural language understanding on the information recommendation text to obtain information recommendation results corresponding to the information recommendation text; in response to the original text being an information classification text, use the target language understanding model to perform natural language understanding on the information search text to obtain information classification results corresponding to the information classification text; in response to the original text being an information understanding text, use the target language understanding model to perform natural language understanding on the information search text to obtain information understanding results corresponding to the information classification text.

[0214] According to an embodiment of the present application, an original text containing variant characters input based on user intention is obtained, and then the original text is reconstructed. A connection is established between the variant character and at least one alternative character corresponding to the variant character to obtain a reconstructed text. Finally, a target language understanding model is used to perform natural language understanding on the reconstructed text, and the variant characters are identified and corrected from the reconstructed text to obtain a processing result corresponding to the original text. This achieves the purpose of correctly understanding the user's true intention through the target language understanding model and outputting processing content corresponding to the user's true intention, thereby achieving the technical effect of improving the target language understanding model's ability to understand erroneous text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in related technologies of improving the robustness of the model through data enhancement and adversarial training, resulting in high training costs.

[0215] It should be noted that the first acquisition module 801, the first reconstruction module 802, and the first processing module 803 correspond to steps S21 to S23 in Example 1. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules or units can be hardware components or software components stored in a memory and processed by one or more processors, and the above modules can also run in the server 10 provided in Example 1.

[0216] According to an embodiment of the present application, another device embodiment for implementing the above-mentioned text processing method is also provided. Figure 9is a structural diagram of another text processing device according to Example 5 of the present application, such as Figure 9 As shown, the device includes:

[0217] The second acquisition module 901 is configured to acquire a text processing request through a first application programming interface, wherein the request data carried in the text processing request includes: original text, the original text containing mutated characters, and the mutated characters are erroneous characters input based on user intention;

[0218] The second return module 902 is used to return a text processing response through a second application programming interface, wherein the response data carried in the text processing response includes: a processing result, which is obtained by performing natural language understanding on the reconstructed text using a target language understanding model, the target language understanding model is used to identify and correct variant characters in the reconstructed text to provide processing content that is compatible with the original text, the reconstructed text is obtained by performing character reconstruction on the original text, the reconstructed text is used to establish a connection between the variant character and the alternative character, and the alternative character is used to determine at least one to-be-replaced representation corresponding to the variant character.

[0219] In an embodiment of the present application, a text processing request is obtained through a first application programming interface, wherein the request data carried in the text processing request includes: original text, the original text containing variant characters, which are incorrect characters input based on user intention, and then a text processing response is returned through a second application programming interface, wherein the response data carried in the text processing response includes: processing results, which are obtained by using a target language understanding model to perform natural language understanding on the reconstructed text, the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text, the reconstructed text is obtained by character reconstruction of the original text, the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters, thereby achieving the purpose of correctly understanding the user's true intention through the target language understanding model and outputting processing content corresponding to the user's true intention, thereby achieving the technical effects of improving the target language understanding model's ability to understand incorrect text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in the related art of improving the robustness of the model through data augmentation and adversarial training, which leads to high training costs.

[0220] It should be noted that the second acquisition module 901 and the second return module 902 correspond to steps S51 and S52 in Example 2. The examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules or units can be hardware components or software components stored in a memory and processed by one or more processors, and the above modules can also run in the server 10 provided in Example 1.

[0221] According to an embodiment of the present application, another device embodiment for implementing the above-mentioned text processing method is also provided. Figure 10 is a structural diagram of another text processing device according to Example 5 of the present application, such as Figure 10 As shown, the device includes:

[0222] The third acquisition module 1001 is configured to acquire a currently input text processing dialog request, wherein the request data carried in the text processing dialog request includes: original text, the original text containing mutated characters, and the mutated characters are incorrect characters input based on the user's intention;

[0223] The second return module 1002 is used to respond to the text processing dialogue request and return a text processing dialogue reply, wherein the information carried in the text processing dialogue reply includes: a processing result, which is obtained by using a target language understanding model to perform natural language understanding on the reconstructed text, the target language understanding model is used to identify and correct mutated characters in the reconstructed text to provide processing content that is compatible with the original text, and the reconstructed text is obtained by reconstructing the characters of the original text.

[0224] According to an embodiment of the present application, a currently input text processing dialogue request is obtained, wherein the request data carried in the text processing dialogue request includes: original text, wherein the original text contains variant characters, which are incorrect characters input based on the user's intention. Then, in response to the text processing dialogue request, a text processing dialogue reply is returned, wherein the information carried in the text processing dialogue reply includes: processing results, wherein the processing results are obtained by using a target language understanding model to perform natural language understanding on the reconstructed text, wherein the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text, and the reconstructed text is obtained by character reconstruction of the original text. This achieves the purpose of correctly understanding the user's true intention through the target language understanding model and outputting processing content corresponding to the user's true intention, thereby achieving the technical effect of improving the target language understanding model's ability to understand erroneous text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in related technologies of improving the robustness of the model through data augmentation and adversarial training, resulting in high training costs.

[0225] It should be noted that the third acquisition module 1001 and the second return module 1002 correspond to steps S61 and S62 in Example 3. The examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules or units can be hardware components or software components stored in a memory and processed by one or more processors, and the above modules can also run in the server 10 provided in Example 1.

[0226] According to an embodiment of the present application, another device embodiment for implementing the above-mentioned text processing method is also provided. Figure 11 is a structural diagram of another text processing device according to Example 5 of the present application, such as Figure 11 As shown, the device includes:

[0227] The fourth acquisition module 1101 is configured to acquire an original legal text, wherein the original legal text contains mutated characters, where the mutated characters are incorrect characters input based on user intention.

[0228] The second reconstruction module 1102 reconstructs the characters of the original legal text to obtain a reconstructed legal text, wherein the reconstructed legal text is used to establish a relationship between the variant characters and the alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters;

[0229] The second processing module 1103 uses a target language understanding model to perform natural language understanding on the reconstructed legal text to obtain a processing result corresponding to the original legal text, wherein the target language understanding model is used to identify and correct mutated characters from the reconstructed legal text to provide processing content that is compatible with the original legal text.

[0230] Optionally, the second reconstruction module 1102 is also used to identify variant characters from the original legal text; query the alternative characters associated with the variant characters and the variant path information corresponding to the alternative characters from the preset knowledge graph, wherein the variant path information is used to determine the variant relationship between the variant characters and the alternative characters in the preset knowledge graph; embed the variant path information into the original legal text to obtain the reconstructed legal text.

[0231] It should be noted that the preferred implementation scheme involved in the above embodiments of this application is the same as the scheme provided in Example 1, as well as the application scenario and implementation process, but is not limited to the scheme provided in Example 1.

[0232] Example 6

[0233] The embodiment of the present application can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.

[0234] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of a computer network.

[0235] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the text processing method: obtaining an original text, wherein the original text contains variant characters, and the variant characters are erroneous characters input based on the user's intention; reconstructing the characters of the original text to obtain a reconstructed text, wherein the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters; using a target language understanding model to perform natural language understanding on the reconstructed text to obtain a processing result corresponding to the original text, wherein the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text.

[0236] Optionally, Figure 12 This is a structural block diagram of a computer terminal according to an embodiment of the present application. Figure 12 As shown, the computer terminal A may include: one or more (only one is shown in the figure) processors 1202, a memory 1204, a storage controller, and a peripheral interface, wherein the peripheral interface is connected to a radio frequency module, an audio module and a display.

[0237] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the text processing method and device in the embodiments of the present application. The processor executes various functional applications and data processing by running the stored software programs and modules, that is, realizing the above-mentioned text processing method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0238] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: obtaining an original text, wherein the original text contains variant characters, and the variant characters are erroneous characters input based on the user's intention; reconstructing the characters of the original text to obtain a reconstructed text, wherein the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters; using a target language understanding model to perform natural language understanding on the reconstructed text to obtain a processing result corresponding to the original text, wherein the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text.

[0239] Optionally, the processor may also execute the program code of the following steps: identifying variant characters from the original text; querying the alternative characters associated with the variant characters and the variant path information corresponding to the alternative characters from the preset knowledge graph, wherein the variant path information is used to determine the variant relationship between the variant characters and the alternative characters in the preset knowledge graph; and embedding the variant path information into the original text to obtain a reconstructed text.

[0240] Optionally, the processor may further execute program code of the following steps: performing character recognition on the original text using a character recognition model to obtain variant characters, wherein the character recognition model is used to identify the variant characters based on the probability distribution of each character in the original text.

[0241] Optionally, the processor may also execute the following program code: using a character recognition model to calculate the probability distribution of each character in the original text to obtain a probability distribution statistical result, and identifying some characters whose probability is lower than a preset threshold from the probability distribution statistical result to obtain variant characters.

[0242] Optionally, the processor may also execute the program code of the following steps: constructing a preset knowledge graph, wherein the preset knowledge graph is used to establish variation relationships between characters by analyzing character variation forms generated in various types of network attack scenarios.

[0243] Optionally, the processor may also execute the program code of the following steps: using the initial language understanding model to perform natural language understanding on the training text to obtain training results corresponding to the training text; based on the training results and the graph attention filtering mechanism, fine-tuning the model parameters of the initial language understanding model to obtain the target language understanding model, wherein the graph attention filtering mechanism is used to adjust the attention distribution of the initial language understanding model.

[0244] Optionally, the processor may also execute the program code of the following steps: constructing an attention mask based on the graph attention filtering mechanism, wherein the attention mask is used to control the initial language understanding model to capture alternative characters associated with the variant characters; based on the training results and the attention mask, fine-tuning the model parameters of the initial language understanding model to obtain the target language understanding model.

[0245] Optionally, the processor may also execute the program code for the following steps: in response to the original text being an information search text, using the target language understanding model to perform natural language understanding on the information search text to obtain information search results corresponding to the information search text; in response to the original text being an information recommendation text, using the target language understanding model to perform natural language understanding on the information recommendation text to obtain information recommendation results corresponding to the information recommendation text; in response to the original text being an information classification text, using the target language understanding model to perform natural language understanding on the information search text to obtain information classification results corresponding to the information classification text; in response to the original text being an information understanding text, using the target language understanding model to perform natural language understanding on the information search text to obtain information understanding results corresponding to the information classification text.

[0246] According to an embodiment of the present application, an original text containing variant characters input based on user intention is obtained, and then the original text is reconstructed. A connection is established between the variant character and at least one alternative character corresponding to the variant character to obtain a reconstructed text. Finally, a target language understanding model is used to perform natural language understanding on the reconstructed text, and the variant characters are identified and corrected from the reconstructed text to obtain a processing result corresponding to the original text. This achieves the purpose of correctly understanding the user's true intention through the target language understanding model and outputting processing content corresponding to the user's true intention, thereby achieving the technical effect of improving the target language understanding model's ability to understand erroneous text input, improving the robustness of the target language understanding model, and reducing the training cost of the target language understanding model, thereby solving the technical problem in related technologies of improving the robustness of the model through data enhancement and adversarial training, resulting in high training costs.

[0247] It can be understood by those skilled in the art that Figure 12 The structure shown is for illustration only, and the computer terminal A may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 12 It does not limit the structure of the above electronic device. For example, the computer terminal A may also include Figure 12 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 12 Different configurations shown.

[0248] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0249] Example 7

[0250] The embodiment of the present application further provides a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium can be used to store the program code executed by the text processing method provided in the first embodiment.

[0251] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0252] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for executing the following steps: obtaining an original text, wherein the original text contains variant characters, which are erroneous characters input based on user intention; reconstructing the original text to obtain a reconstructed text, wherein the reconstructed text is used to establish a connection between the variant characters and alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant characters; performing natural language understanding on the reconstructed text using a target language understanding model to obtain a processing result corresponding to the original text, wherein the target language understanding model is used to identify and correct the variant characters from the reconstructed text to provide processing content that is compatible with the original text.

[0253] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: identifying variant characters from the original text; querying the alternative characters associated with the variant characters and the variant path information corresponding to the alternative characters from the preset knowledge graph, wherein the variant path information is used to determine the variant relationship between the variant characters and the alternative characters in the preset knowledge graph; and embedding the variant path information into the original text to obtain a reconstructed text.

[0254] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for executing the following steps: performing character recognition on the original text using a character recognition model to obtain variant characters, wherein the character recognition model is used to identify the variant characters based on the probability distribution of each character in the original text.

[0255] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: using a character recognition model to calculate the probability distribution of each character in the original text to obtain a probability distribution statistical result, and identifying some characters whose probability is lower than a preset threshold from the probability distribution statistical result to obtain variant characters.

[0256] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: constructing a preset knowledge graph, wherein the preset knowledge graph is used to establish variation relationships between characters by analyzing character variation forms generated in various types of network attack scenarios.

[0257] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for executing the following steps: using the initial language understanding model to perform natural language understanding on the training text to obtain training results corresponding to the training text; based on the training results and the graph attention filtering mechanism, fine-tuning the model parameters of the initial language understanding model to obtain the target language understanding model, wherein the graph attention filtering mechanism is used to adjust the attention distribution of the initial language understanding model.

[0258] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: constructing an attention mask based on a graph attention filtering mechanism, wherein the attention mask is used to control the initial language understanding model to capture alternative characters associated with the variant characters; based on the training results and the attention mask, fine-tuning the model parameters of the initial language understanding model to obtain a target language understanding model.

[0259] Optionally, in this embodiment, the computer-readable storage medium is configured to store program codes for executing the following steps: in response to the original text being an information search text, using the target language understanding model to perform natural language understanding on the information search text to obtain information search results corresponding to the information search text; in response to the original text being an information recommendation text, using the target language understanding model to perform natural language understanding on the information recommendation text to obtain information recommendation results corresponding to the information recommendation text; in response to the original text being an information classification text, using the target language understanding model to perform natural language understanding on the information search text to obtain information classification results corresponding to the information classification text; in response to the original text being an information understanding text, using the target language understanding model to perform natural language understanding on the information search text to obtain information understanding results corresponding to the information classification text.

[0260] An embodiment of the present application further provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the text processing method in any one of the above embodiments, which will not be described in detail here.

[0261] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0262] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0263] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0264] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0265] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0266] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0267] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A text processing method, characterized in that: include: Obtaining an original text, wherein the original text contains a variant character, and the variant character is an erroneous character input based on user intention; Reconstructing the original text to obtain a reconstructed text, wherein the reconstructed text is used to establish a relationship between the variant character and the alternative characters, and the alternative characters are used to determine at least one to-be-replaced representation corresponding to the variant character; A target language understanding model is used to perform natural language understanding on the reconstructed text to obtain a processing result corresponding to the original text, wherein the target language understanding model is used to identify and correct the mutated characters from the reconstructed text to provide processing content that is compatible with the original text.

2. The text processing method according to claim 1, characterized in that: Reconstructing the original text to obtain the reconstructed text includes: identifying the variant character from the original text; querying the alternative characters associated with the variant character and the variation path information corresponding to the alternative characters from a preset knowledge graph, wherein the variation path information is used to determine the variation relationship between the variant character and the alternative characters in the preset knowledge graph; The variation path information is embedded into the original text to obtain the reconstructed text.

3. The text processing method according to claim 2, characterized in that: Identifying the variant character from the original text includes: The original text is subjected to character recognition using a character recognition model to obtain the variant characters, wherein the character recognition model is used to recognize the variant characters based on the probability distribution of each character in the original text.

4. The text processing method according to claim 3, characterized in that: Performing character recognition on the original text using the character recognition model to obtain the mutated characters includes: The character recognition model is used to calculate the probability distribution of each character in the original text to obtain a probability distribution statistical result, and some characters whose probabilities are lower than a preset threshold are identified from the probability distribution statistical result to obtain the variant characters.

5. The text processing method according to claim 2, characterized in that: The text processing method further includes: Construct the preset knowledge graph, wherein the preset knowledge graph is used to establish variation relationships between characters by analyzing character variation forms generated in various types of network attack scenarios.

6. The text processing method according to claim 1, characterized in that: The text processing method further includes: Using the initial language understanding model to perform natural language understanding on the training text to obtain a training result corresponding to the training text; Based on the training results and the graph attention filtering mechanism, the model parameters of the initial language understanding model are fine-tuned to obtain the target language understanding model, wherein the graph attention filtering mechanism is used to adjust the attention distribution of the initial language understanding model.

7. The text processing method according to claim 6, characterized in that: Based on the training results and the graph attention filtering mechanism, fine-tuning the model parameters of the initial language understanding model to obtain the target language understanding model includes: Constructing an attention mask according to the graph attention filtering mechanism, wherein the attention mask is used to control the initial language understanding model to capture the candidate characters associated with the variant character; Based on the training results and the attention mask, the model parameters of the initial language understanding model are fine-tuned to obtain the target language understanding model.

8. The text processing method according to claim 1, wherein: The target language understanding model is used to perform natural language understanding on the reconstructed text, and the processing result obtained includes: In response to the original text being an information search text, performing natural language understanding on the information search text using the target language understanding model to obtain information search results corresponding to the information search text; In response to the original text being an information recommendation text, performing natural language understanding on the information recommendation text using the target language understanding model to obtain an information recommendation result corresponding to the information recommendation text; In response to the original text being an information classification text, performing natural language understanding on the information search text using the target language understanding model to obtain an information classification result corresponding to the information classification text; In response to the original text being an information understanding text, the target language understanding model is used to perform natural language understanding on the information search text to obtain an information understanding result corresponding to the information classification text.

9. A text processing method, characterized in that: include: Obtaining a currently input text processing dialogue request, wherein the request data carried in the text processing dialogue request includes: an original text, wherein the original text contains a mutated character, and the mutated character is an erroneous character input based on user intention; In response to the text processing dialogue request, a text processing dialogue reply is returned, wherein the information carried in the text processing dialogue reply includes: a processing result, which is obtained by performing natural language understanding on the reconstructed text using a target language understanding model, the target language understanding model is used to identify and correct the mutated characters from the reconstructed text to provide processing content that is compatible with the original text, and the reconstructed text is obtained by performing character reconstruction on the original text.

10. A text processing method, characterized in that: include: Obtaining an original legal text, wherein the original legal text contains mutated characters, where the mutated characters are erroneous characters input based on user intention; Reconstructing the original legal text to obtain a reconstructed legal text, wherein the reconstructed legal text is used to establish a relationship between the variant character and an alternative character, and the alternative character is used to determine at least one to-be-replaced representation corresponding to the variant character; A target language understanding model is used to perform natural language understanding on the reconstructed legal text to obtain a processing result corresponding to the original legal text, wherein the target language understanding model is used to identify and correct the mutated characters from the reconstructed legal text to provide processing content that is compatible with the original legal text.

11. The text processing method according to claim 10, characterized in that: The original legal text is subjected to character reconstruction to obtain the reconstructed legal text, which includes: identifying the variant characters from the original legal text; querying the alternative characters associated with the variant character and the variation path information corresponding to the alternative characters from a preset knowledge graph, wherein the variation path information is used to determine the variation relationship between the variant character and the alternative characters in the preset knowledge graph; The variation path information is embedded into the original legal text to obtain the reconstructed legal text.

12. An electronic device, characterized in that: include: a memory storing an executable program; A processor is used to run the program, wherein the program executes the text processing method according to any one of claims 1 to 11 when running.

13. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored executable program, wherein when the executable program is run, the device where the computer-readable storage medium is located is controlled to execute the text processing method according to any one of claims 1 to 11.

14. A computer program product, characterized in that The invention comprises a computer program, which implements the text processing method according to any one of claims 1 to 11 when executed by a processor.