Text processing method, device, electronic device and storage medium

By optimizing text feature extraction through lightweight target models and model distillation technology, the problems of high resource consumption and low accuracy are solved, and efficient text feature extraction and verification are achieved.

CN114647728BActive Publication Date: 2025-09-09CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210274862.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-18
Publication Date
2025-09-09
Estimated Expiration
2042-03-18

AI Technical Summary

Technical Problem

Existing technologies require the pre-set use of a large number of regular expressions when extracting text elements, which consumes a lot of resources and has a slow inference speed. In addition, sequence labeling models are prone to crashes when processing long texts, and manual verification has a low accuracy rate.

Method used

A lightweight target model is used to determine the text category through sentence vector conversion and classification function, and regular expressions and sequence labeling models are combined to extract text elements. Resource consumption is optimized through model distillation, and processing rules and verification rules are used to improve accuracy.

Benefits of technology

It improves the accuracy of text element extraction, reduces resource consumption, meets the requirements of online processing, and reduces the risk of system downtime.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647728B_ABST
    Figure CN114647728B_ABST
Patent Text Reader

Abstract

The present disclosure provides a text processing method that can be applied to the field of artificial intelligence technology. The text processing method includes: performing a first preprocessing on the text to be processed to obtain at least one sentence text; inputting the at least one sentence text into a first target model to obtain a category corresponding to each sentence text in the at least one sentence text; for at least one first sentence text belonging to the first category, determining at least one first text element of each first sentence text; performing a first processing on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text to obtain at least one target sentence text; and for at least one target sentence text, determining a second text element corresponding to each target sentence text. The present disclosure also provides a text processing device, equipment, storage medium and program product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence, specifically to text classification, and more specifically to a text processing method, device, electronic device, storage medium, and program product. Background Art

[0002] Currently, the methods used to extract text elements from the text to be processed include regular matching based on regular expressions and sequence labeling models.

[0003] When extracting text elements based on regular expression matching, a large number of pre-defined regular expressions are required to identify the required text elements. When extracting text elements based on sequence labeling models, the labeled samples used for training are obtained by processing the target text with a large-scale pre-trained language model. Due to the large scale and the high resources required to train language models, inference speed is too slow. When the text length is too long, the system may experience downtime, which does not meet the requirements for online processing of target text.

[0004] In addition, for the text to be processed, the text elements obtained after sequence annotation and the sentence texts corresponding to each text element need to be checked by staff, and manual corrections should be made to the erroneous text elements and the sentence texts corresponding to each text element to improve the accuracy of text processing. Summary of the Invention

[0005] In view of the above problems, the present disclosure provides a text processing method, apparatus, electronic device, storage medium and program product for improving the accuracy of text element extraction.

[0006] According to a first aspect of the present disclosure, a text processing method is provided, comprising: performing a first preprocessing on a text to be processed to obtain at least one sentence text; inputting the at least one sentence text into a first target model to obtain a category corresponding to each sentence text in the at least one sentence text; for at least one first sentence text belonging to the first category, determining at least one first text element of each first sentence text respectively; performing a first processing on each first sentence text according to each first sentence text and at least one first text element associated with the each first sentence text to obtain at least one target sentence text; and for the at least one target sentence text, determining a second text element corresponding to each target sentence text respectively.

[0007] According to an embodiment of the present disclosure, the step of inputting the at least one sentence text into the first target model to obtain a category corresponding to each sentence text in the at least one sentence text includes: inputting the at least one sentence text into a sentence vector conversion model, determining a sentence vector corresponding to each sentence text, and obtaining at least one sentence vector; determining a numerical value corresponding to each sentence vector according to a classification function; and determining a category to which each sentence text belongs according to the numerical value corresponding to each sentence vector.

[0008] According to an embodiment of the present disclosure, performing a first processing on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text to obtain at least one target sentence text includes: determining the type of each first text element according to each first sentence text and at least one first text element associated with each first sentence text; and performing a first processing on the first sentence text associated with each first text element according to the type to obtain at least one target sentence text.

[0009] According to an embodiment of the present disclosure, determining the type of each first text element according to each first sentence text and at least one first text element associated with each first sentence text includes: when it is determined that multiple different first text elements are associated with the first sentence text, determining that the multiple different first text elements belong to the first type; when it is determined that there are two consecutive identical first text elements in at least one first text element, determining that the two consecutive identical first text elements belong to the second type; and when it is determined that the first text element is consistent with the first text element in the regular expression library, determining that the first text element belongs to the third type.

[0010] According to an embodiment of the present disclosure, the first sentence text associated with each first text element is subjected to a first processing according to the type to obtain at least one target sentence text, including: when it is determined that the multiple different first text elements belong to the first type, the first sentence text associated with the multiple different first text elements is subjected to a second processing to obtain a first target sentence; when it is determined that the two consecutive identical first text elements belong to the second type, the first sentence texts respectively associated with the two consecutive identical first text elements are spliced ​​to obtain a second target sentence text; and when it is determined that the first text element belongs to a third type, regular expression extraction is performed on the first sentence texts respectively associated with the first text element to obtain a third target sentence text, wherein the second processing includes: performing a second preprocessing on the first sentence text to obtain multiple first sub-clause texts; inputting the at least one sentence text into a second target model to determine the category to which each first sub-clause text in the multiple first sub-clause texts belongs; and determining each second sub-clause text in at least one second sub-clause text belonging to the first category as a first target sentence text.

[0011] According to an embodiment of the present disclosure, determining the second text element corresponding to each target sentence text for the at least one target sentence text includes: determining the second text element of each first target sentence text based on at least one first target sentence text; determining the two consecutive identical first text elements as second text elements; and determining the first text element as a second text element.

[0012] According to an embodiment of the present disclosure, the target model includes a first target model and a second target model, and the method further includes: receiving a training text, wherein the training text includes a plurality of second sentence texts belonging to a second category; inputting the training text into the first model and the second model respectively to obtain categories corresponding to the training texts; and using the categories and the training text as distillation samples to perform model distillation on the third model to obtain a target model.

[0013] According to an embodiment of the present disclosure, a text processing method is provided, which also includes: verifying the second text element; in the case of determining that the second text element has not passed the verification, determining the reason why the second text element has not passed the verification; based on the reason for the failure to pass the verification, obtaining a correction rule; and based on the correction rule, determining a target text element corresponding to the target sentence text.

[0014] Another aspect of the present disclosure provides a text processing device, including: a preprocessing module, used to perform a first preprocessing on a text to be processed to obtain at least one sentence text; a classification module, used to input the at least one sentence text into a first target model to obtain a category corresponding to each sentence text in the at least one sentence text; a first determination module, used to determine at least one first text element of each first sentence text belonging to the first category; a first processing module, used to perform a first processing on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text to obtain at least one target sentence text; and a second determination module, used to determine, for the at least one target sentence text, a second text element corresponding to each target sentence text.

[0015] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned text processing method.

[0016] Another aspect of the present disclosure further provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to perform the above-mentioned text processing method.

[0017] Another aspect of the present disclosure further provides a computer program product, including a computer program, which implements the above text processing method when executed by a processor.

[0018] By reclassifying the first text element obtained through sequence annotation, and based on the classification results, reprocessing the sentence text associated with the first text element using the processing rules corresponding to the classification results, determining the second text element for the processed sentence text, and finally verifying the second text element to determine the target text element. The above reprocessing of the results obtained from sequence annotation greatly improves the accuracy of text elements and sentence text obtained through text processing. In addition, the lightweight first target model after model distillation is used to process the text to be processed, thereby reducing the resources required for the online operation of the first target model, improving the inference speed, and meeting the requirements for online processing of the text to be processed. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0020] Figure 1Schematically illustrates an application scenario diagram of a text processing method, apparatus, device, medium, and program product according to an embodiment of the present disclosure;

[0021] Figure 2 The flowchart of the text processing method according to the embodiment of the present disclosure is schematically shown;

[0022] Figure 3 Schematically shows a flowchart of a text processing method according to another embodiment of the present disclosure;

[0023] Figure 4A A schematic diagram schematically illustrates a first text preprocessing method according to an embodiment of the present disclosure;

[0024] Figure 4B A schematic diagram schematically illustrates a text preprocessing method according to another embodiment of the present disclosure;

[0025] Figure 5 A schematic diagram schematically illustrates a text processing method according to another embodiment of the present disclosure;

[0026] Figure 6 Schematically shows a structural block diagram of a text processing device according to an embodiment of the present disclosure; and

[0027] Figure 7 A block diagram of an electronic device suitable for implementing a text processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

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

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

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

[0031] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0032] An embodiment of the present disclosure provides a text processing method, which performs a first preprocessing on a text to be processed to obtain at least one sentence text; inputs the at least one sentence text into a first target model to obtain a category corresponding to each sentence text in the at least one sentence text; for at least one first sentence text belonging to the first category, at least one first text element of each first sentence text is determined respectively; based on each first sentence text and at least one first text element associated with each first sentence text, a first processing is performed on each first sentence text respectively to obtain at least one target sentence text; and for at least one target sentence text, a second text element corresponding to each target sentence text is determined respectively.

[0033] Figure 1 The application scenario diagram of text processing according to an embodiment of the present disclosure is schematically shown.

[0034] like Figure 1 As shown, the application scenario 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium for providing a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or optical fiber cables.

[0035] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0036] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0037] Server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using terminal devices 101, 102, and 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal device.

[0038] It should be noted that the text processing method provided in the embodiments of the present disclosure can generally be executed by the server 105. Accordingly, the text processing apparatus provided in the embodiments of the present disclosure can generally be set in the server 105. The text processing method provided in the embodiments of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the text processing apparatus provided in the embodiments of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.

[0039] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.

[0040] The following will be based on Figure 1 The scene described by Figures 2 to 5 The text processing method of the disclosed embodiment is described in detail.

[0041] Figure 2 The flowchart of the text processing method according to the embodiment of the present disclosure is schematically shown.

[0042] like Figure 2 As shown, the text processing method 200 of this embodiment includes operations S210 to S250, and the text processing method can be executed by a server.

[0043] In operation S210 , a first preprocessing is performed on the text to be processed to obtain at least one sentence text.

[0044] According to an embodiment of the present disclosure, an image to be processed is received, and text extraction processing is performed on the image to be processed to obtain text to be processed corresponding to the image to be processed.

[0045] The first pre-processing includes sentence segmentation processing, which includes processing according to sentence segmentation rules. For example, the sentence segmentation rules may include sentence segmentation based on the enter key, punctuation marks, and the number of characters.

[0046] For example, the text to be processed extracted based on the image to be processed is "XXX supermarket printed and issued on January 21, 2022". When the preset sentence segmentation rule is enter key sentence segmentation, the sentence text obtained by sentence segmentation of the text to be processed includes "XXX supermarket printed and issued on January 21, 2022". When the preset sentence segmentation rule is to sentence segment every six characters, when "X" is two characters, the sentence text obtained after sentence segmentation of the text to be processed includes "XXX", "Supermarket 20", "22 Year 1", "Month 21" and "Printed and issued". It should be noted that when sentence segmentation is performed according to the preset number of characters, each sentence text in at least one sentence text separated from the text to be processed must be less than or equal to the preset number of characters.

[0047] In operation S220 , at least one sentence text is input into a first target model to obtain a category corresponding to each sentence text in the at least one sentence text.

[0048] According to an embodiment of the present disclosure, the first target model can be any model that can determine the category of a sentence text, such as a large-scale language pre-training model. The category of the sentence text represents the type of element represented by the sentence text in the text to be processed, such as the title category and the drafting unit category.

[0049] For example, the sentence text is "XXX Supermarket issued on January 21, 2022". Based on the first target model, the sentence text is processed, and the categories corresponding to the sentence text include the publishing unit category and the publishing time category.

[0050] According to another embodiment of the present disclosure, the category to which the sentence text belongs includes a first category and a second category, the first category represents that the sentence text includes text elements, and the second category represents that the sentence text does not include sentence elements. At least one sentence text is matched with each category; according to the matching function, the matching degree of each sentence text and each category is calculated respectively to obtain multiple matching degrees; for each sentence text, the matching degree that meets the preset requirements among the matching degrees associated with the sentence text is determined as the target matching degree; the category associated with the target matching degree is determined as the category of each sentence text. The preset requirements include: maximum matching degree and matching degree threshold.

[0051] According to another embodiment of the present disclosure, operation S220 also includes: inputting at least one sentence text into a sentence vector conversion model, determining the sentence vectors corresponding to each sentence text, and obtaining at least one sentence vector; determining the numerical value corresponding to each sentence vector according to the classification function; and determining the category to which each sentence text belongs according to the numerical value corresponding to each sentence vector.

[0052] The categories to which the sentence text belongs include a first category and a second category, the first category indicating that the sentence text includes text elements, and the second category indicating that the sentence text does not include sentence elements. When a numerical value corresponding to the sentence text meets the preset conditions of the first category, the sentence text associated with the numerical value is determined to belong to the first category; when the numerical value corresponding to the sentence text meets the preset conditions of the second category, the sentence text associated with the numerical value is determined to belong to the second category.

[0053] Sentence vector conversion models include any model that can convert text into vectors, such as pre-trained transformer-based bidirectional encoding representation models. Classification functions include any function that can classify vectors, such as the Sigmoid activation function, hyperbolic tangent activation function, ReLU activation function, and Softmax activation function.

[0054] For example, the sentence text is "XXX supermarket issued on January 21, 2022". Based on the sentence vector conversion model, the sentence text is converted into a sentence vector ( ), the sentence vector is input into the classification function, and the value of the sentence vector is obtained as "0.8". When the preset condition of the first category is that the numerical threshold of the sentence vector is 0.75, it is determined that the text "XXX Supermarket Issued on January 21, 2022" belongs to the first category.

[0055] In operation S230 , for at least one first sentence text belonging to the first category, at least one first text element of each first sentence text is determined.

[0056] According to an embodiment of the present disclosure, the category of a sentence text represents the type of element represented by the sentence text in the text to be processed. When the first target model is any model that can determine the category of a sentence text, the category of each sentence text is determined as the first pre-text element corresponding to each sentence text; when it is determined that the first pre-text element is consistent with the text element in the first text element library, the sentence text corresponding to the first pre-text element is determined to be the first sentence text, and the first pre-text element is determined to be the first text element. The first text element library includes at least one text element, which is a preset text element that needs to be extracted.

[0057] According to another embodiment of the present disclosure, when the category to which a sentence text belongs includes a first category and a second category, the first category indicates that the sentence text includes text elements, and the second category indicates that the sentence text does not include sentence elements, the sentence text belonging to the first category is determined as a first sentence text to obtain at least one sentence text; each first sentence text is input as a sequence into a labeling model to obtain a first text element corresponding to each first sentence text. The labeling model includes any model that can determine the text elements of the sentence text for a sentence text, such as a hidden Markov model and a conditional random field model.

[0058] Inputting each first sentence text as a sequence into the annotation model to obtain a first text element corresponding to each first sentence text includes: determining the similarity between each first sentence text and each text element in the first text element library; for each first sentence text, comparing multiple similarities corresponding to the first sentence text with a preset threshold condition; for each first sentence text, determining a similarity that satisfies the preset threshold condition; and determining the text element corresponding to the similarity as the first text element of the first sentence text. The preset threshold condition includes a similarity threshold.

[0059] For example, the text of the first sentence is "XXX Supermarket issued on January 21, 2022". The first sentence text is input into the annotation model, and the similarity between the first sentence text and "issuing unit" is 0.9, and the similarity with "issuing time" is 0.9. When the preset similarity threshold is 0.85, the first text elements corresponding to the first sentence text are "issuing unit" and "issuing time".

[0060] According to another embodiment of the present disclosure, the first target model includes: receiving a training text, the training text including a plurality of second sentence texts belonging to a second category; inputting the training text into the first model and the second model respectively to obtain categories corresponding to the training texts; and using the categories and the training text as distillation samples, performing model distillation on the third model to obtain the first target model.

[0061] Based on the above model distillation for the large-scale first model and the second model, the first target model is obtained, which reduces the resources required for the first target model during operation, improves the inference speed, and meets the requirements of online processing of the text to be processed.

[0062] In operation S240 , first processing is performed on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text to obtain at least one target sentence text.

[0063] According to an embodiment of the present disclosure, a processing rule associated with each first text element is determined respectively; and according to the processing rule, a first processing is performed on the first sentence text associated with the first text element to obtain at least one target sentence text.

[0064] According to another embodiment of the present disclosure, operation S240 also includes: determining the type of each first sentence text and at least one first text element associated with each first sentence text; and performing a first processing on the first sentence text associated with each first text element according to the type to obtain at least one target sentence text.

[0065] A matching table is pre-set for matching the types corresponding to the first sentence texts according to the first sentence texts and at least one first text element associated with each first sentence text, and a text processing rule associated with each type is pre-set.

[0066] Each received first clause text and at least one first text element associated with each first clause text are matched against the matching table to determine the type of each first text element. A text processing rule is determined for each first clause text based on the type. Based on the multiple text processing rules, a first processing is performed on each first clause text to obtain at least one target clause text.

[0067] According to another embodiment of the present disclosure, determining the type of each first text element according to each first sentence text and at least one first text element associated with each first sentence text also includes: when it is determined that multiple different first text elements are associated with the first sentence text, determining that the multiple different first text elements belong to the first type; when it is determined that there are two consecutive identical first text elements in at least one first text element, determining that the two consecutive identical first text elements belong to the second type; and when it is determined that the first text element is consistent with the first text element in the regular expression library, determining that the first text element belongs to the third type.

[0068] For example, the text of the first sentence is "XXX Supermarket issued on January 21, 2022". When the first text element associated with the first sentence text is determined to be "publishing unit and publishing time", it is determined that the first text element "publishing unit and publishing time" belongs to the first type.

[0069] For example, multiple first sentence texts include "XXX supermarket", "About supermarket discounts this weekend" and "Notifications on several products and prices". When multiple first text elements associated with the multiple first sentence texts are all "titles", the multiple first text elements "titles" are determined to be the second type.

[0070] For example, if the first sentence text is "XXX

[2022] No. 90", and the first text element associated with the first sentence text is determined to be "Document Number", "Document Number" is compared with the first text element in the regular expression library. If it is determined that the regular expression library contains "Document Number", the first text element "Document Number" is determined to be of the third type. It should be noted that the regular expression library stores at least one regular expression, which is used to retrieve and replace text that conforms to a certain format. The regular expression library stores multiple types of regular expressions, each of which is associated with a first text element.

[0071] According to another embodiment of the present disclosure, when it is determined that multiple different first text elements belong to the first type, the first sentence texts associated with the multiple different first text elements are subjected to a second processing to obtain a first target sentence; when it is determined that two consecutive identical first text elements belong to the second type, the first sentence texts respectively associated with the two consecutive identical first text elements are spliced ​​to obtain a second target sentence text; and when it is determined that the first text element belongs to a third type, regular expression extraction is performed on the first sentence texts respectively associated with the first text elements to obtain a third target sentence text, wherein the second processing includes: performing a second preprocessing on the first sentence text to obtain multiple first sub-clause texts; inputting at least one sentence text into a second target model to determine the category to which each first sub-clause text in the multiple first sub-clause texts belongs; and determining each second sub-clause text in at least one second sub-clause text belonging to the first category as a first target sentence text.

[0072] The second preprocessing includes character or word segmentation.

[0073] The second target model includes: receiving training text, the training text includes multiple second sentence texts belonging to the second category; inputting the training text into the first model and the second model respectively to obtain categories corresponding to the training text; and using the categories and training text as distillation samples, performing model distillation on the third model to obtain the second target model.

[0074] Based on the above model distillation for the large-scale first model and the second model, the first target model is obtained, which reduces the resources required for the first target model during operation, improves the inference speed, and meets the requirements of online processing of the text to be processed.

[0075] For example, if the first clause text is "XXX supermarket issued on January 21, 2022," and the first text element "issuing unit and release time" is determined to be of the first type, and the first subclause text is determined to include "XXX supermarket," "January 21, 2022," and "issued," then "XXX supermarket" and "January 21, 2022" are determined to be the second subclause texts, respectively. The second subclause texts "XXX supermarket" and "January 21, 2022" are respectively determined to be the first target clause texts.

[0076] For example, multiple first sentence texts include "XXX Supermarket", "About Supermarket Discounts This Weekend" and "Notifications on Several Commodities and Prices". When it is determined that the multiple first text elements "titles" are of the second type, the multiple first sentence texts are spliced ​​together, and the spliced ​​"XXX Supermarket's Notifications on Several Commodities and Prices for Supermarket Discounts This Weekend" is determined to be the second target sentence text.

[0077] For example, the first sentence text is "XXX

[2022] No. 90". When it is determined that the first text element "Document Number" is the third type, the target regular expression is obtained in the regular expression library according to the "Document Number". According to the target regular expression, regular expression extraction is performed on the first text "XXX

[2022] No. 90", and "XXX

[2022] No. 90" is determined to be the third target sentence text.

[0078] In operation S250 , for at least one target sentence text, a second text element corresponding to each target sentence text is determined.

[0079] According to an embodiment of the present disclosure, based on at least one first target sentence text, a second text element of each first target sentence text is determined; two consecutive identical first text elements are determined to be second text elements; and a first text element is determined to be a second text element.

[0080] It should be noted that, based on at least one first target sentence text, the operation of determining the second text element of each first target sentence text may be, for example, the operation shown in operation S230 .

[0081] For example, when the first target sentence text includes "XXX supermarket" and "January 21, 2022", the second text element of the first target sentence text "XXX supermarket" is determined to be "publishing unit" and the second text element of the first target sentence text "January 21, 2022" is determined to be "publishing time".

[0082] For example, when the second target sentence text is "XXX supermarket's notice on several discounted products and prices this weekend", the original plurality of first text elements "title" are determined to be the second text elements corresponding to the second target sentence text.

[0083] For example, when the third target sentence text is "XXX

[2022] No. 90", the original first text element "Document No." is determined to be the second text element of the third target sentence text.

[0084] Figure 3 The flowchart of a text processing method according to another embodiment of the present disclosure is schematically shown.

[0085] like Figure 3 As shown, the text processing method 300 of this embodiment includes operations S3060 to S3110, and the text processing method can be executed by a server.

[0086] In operation S3060, the second text element is verified.

[0087] According to an embodiment of the present disclosure, all second text elements obtained after processing the text to be processed are summarized. Verification of all second text elements includes: whether there are repeated second text elements among all the summarized second text elements, and when at least two of "publication date", "implementation date" and "revocation date" are enclosed in all the second text elements, whether the "publication date" in the second text element is less than or equal to the "implementation date" or the "revocation date", whether the "implementation date" is greater than or equal to the "publication date" and less than or equal to the "revocation date", and whether the "revocation date" is greater than or equal to the "implementation date" or the "publication date".

[0088] In operation S3070, it is determined whether the second text element passes verification.

[0089] In operation S3080 , the second text element is determined to be a target text element.

[0090] In operation S3090, a reason why the second text element fails verification is determined.

[0091] According to an embodiment of the present disclosure, if it is determined that the second text element passes verification, operation S3080 is performed to determine that the second text element is a target text element. If it is determined that the second text element fails verification, operation S3090 is performed to determine the reason why the second text element fails verification.

[0092] Operation S3090 also includes: obtaining a list of reasons why the text element fails verification, and obtaining the reason why the second text element fails verification based on matching two discontinuous second text elements "Release Date" with the list of reasons.

[0093] For example, the aggregated plurality of second text elements include two discontinuous second text elements “Release Date.” The reason for determining that the two text elements fail verification is that one of the two second text elements is incorrectly determined and should be “Implementation Date.”

[0094] In operation S3100, based on the reason for failing the verification, a correction rule is obtained.

[0095] In operation S3110 , a target text element corresponding to the target sentence text is determined based on the correction rule.

[0096] For example, if it is determined that the reason two text elements failed verification is that one of the two second text elements was incorrectly identified and should be "implementation date," the correction rule includes obtaining target clause texts associated with two discontinuous identical second text elements. The time identified earlier in the two target clause texts is determined as the "release date," and the time identified later in the two target clause texts is determined as the "implementation date."

[0097] The first text element obtained through sequence annotation is reclassified, and based on the classification results, the sentence text associated with the first text element is reprocessed using the processing rules corresponding to the classification results. The second text element is determined for the processed sentence text, and finally the second text element is verified to determine the target text element. The above reprocessing of the results obtained from sequence annotation greatly improves the accuracy of text elements and sentence text obtained through text processing. In addition, the lightweight first target model after model distillation is used to process the processed text, thereby reducing the resources required for the online operation of the first target model, improving the inference speed, and meeting the requirements for online processing of the processed text.

[0098] Figure 4A The figure schematically shows a first text preprocessing method according to an embodiment of the present disclosure.

[0099] like Figure 4A As shown, the first text preprocessing method of this embodiment includes a text to be processed 410 and a preprocessed text 420 .

[0100] An image to be processed is received, and text extraction is performed on the received image to be processed to obtain a text to be processed 410. Partition processing is performed on the text to be processed 410, and sentence segmentation processing is performed on the pre-processed text after the partition processing.

[0101] Partition processing means processing the text to be processed according to the region where the characters in the text to be processed are located.

[0102] For example, the text in the to-be-processed text 410 is partitioned according to the region where the text is located to obtain the pre-processed text 420. The pre-processed text 420 includes a first text 421, a second text 422, a third text 423, and a fourth text 424.

[0103] The pre-processed text 420 is segmented into sentences, where the segmentation includes segmenting the sentences according to the Enter key.

[0104] There is an enter key in the first text 421, and the first text 421 is processed into sentences to obtain the following Figure 4B Since there is no Enter key in the second text, the second text 422 is determined to be a sentence text. Similarly, the third text 423 and the fourth text 424 are sentence-separated and are respectively determined to be sentence texts.

[0105] Figure 4B The figure schematically shows a first text preprocessing method according to another embodiment of the present disclosure.

[0106] like Figure 4B As shown, the text first preprocessing method of this embodiment includes a text first preprocessing step including a first text 421 .

[0107] There is an Enter key in the first text 421 , and the first text 421 is sentence-processed to obtain three sentence texts, which include a fifth text 4211 , a sixth text 4212 and a seventh text 4213 .

[0108] Those skilled in the art will appreciate that the above embodiments are merely examples, and the number of specific clause texts disclosed herein is not limited thereto.

[0109] Figure 5 The following schematically shows a text processing method according to another embodiment of the present disclosure.

[0110] like Figure 5 As shown, the text processing method of this embodiment includes a text to be processed 510 and an output result 520 .

[0111] The text to be processed 510 is first preprocessed to obtain a plurality of sentence texts corresponding to the text to be processed 510. The sentence texts include "XXX Supermarket", "About Supermarket Discounts This Weekend", "Notice on Several Commodities and Prices", "XXX

[2022] No. 90", "Citizens Purchase Rice, Beef...", and "Published by XXX Supermarket on January 20, 2022".

[0112] Input multiple clauses into the first target model to obtain the corresponding category for each clause. Determine "XXX Supermarket," "About Supermarket Discounts This Weekend," "Notice on Certain Commodities and Prices," "XXX

[2022] No. 90," and "Published by XXX Supermarket on January 20, 2022" as the first category, and "Citizens Purchasing Rice, Beef..." as the second category.

[0113] Determine the first text element of the first category of clause text. Determine that the first text element of "XXX

[2022] No. 90" is "Document Number." Determine that the first text elements of "XXX Supermarket Issued on January 20, 2022" are "Issuing Unit" and "Issuing Date." Determine that the first text element of "XXX Supermarket," "About Supermarket Discounts This Weekend," and "Notice on Certain Commodities and Prices" are all "Title."

[0114] Perform the first processing on each sentence text to obtain at least one target sentence text. Perform the first processing on "XXX

[2022] No.90" to obtain the third target sentence text "XXX

[2022] No.90". Perform the first processing on "XXX Supermarket issued on January 20, 2022" to obtain the first target sentence text "XXX Supermarket" and "January 20, 2022". Perform the first processing on "XXX Supermarket", "About supermarket discounts this weekend" and "Notice on several commodities and prices" to obtain the second target sentence text "XXX Supermarket's notice on several commodities and prices for discounts this weekend".

[0115] For the first target clause text, the second target clause text, and the third target clause text, determine the second text element corresponding to each target clause text. Determine the second text element of the third target clause text "XXX

[2022] No. 90" as "document number". Determine the second text elements of the first target clause text "XXX Supermarket" and "January 20, 2022" as "issuing unit" and "issuing time" respectively. Determine the second text element of the second target clause text "XXX Supermarket's Notice on Several Commodities and Prices Discounted This Weekend" as "Title".

[0116] Verification is performed on multiple second text elements. When multiple second text elements pass the verification, an output result 520 corresponding to the text to be processed 510 is output. The output result 520 includes a first output result 521, a second output result 522, a third output result 523, and a fourth output result 524. The first output result 521 includes the target text element "title" and the target sentence text "XXX Supermarket's notice on several commodities and prices discounted this weekend". The second output result 522 includes the target text element "document number" and the target sentence text "XXX

[2022] No. 90". The third output result 523 includes the target text element "issuing unit" and the target sentence text "XXX Supermarket". The fourth output result 524 includes the target text element "issuing time" and the target sentence text "January 20, 2022".

[0117] Those skilled in the art will appreciate that the above embodiments are merely examples, and the number of specific target text elements and target sentence texts disclosed herein is not limited thereto.

[0118] Based on the above text processing method, the present disclosure also provides a text processing device. Figure 6 The device is described in detail.

[0119] Figure 6 The structural block diagram of the text processing device according to an embodiment of the present disclosure is schematically shown.

[0120] like Figure 6 As shown, the text processing device 600 of this embodiment includes a pre-processing module 610 , a classification module 620 , a first determination module 630 , a first processing module 640 and a second determination module 650 .

[0121] The pre-processing module 610 is used to perform a first pre-processing on the text to be processed to obtain at least one sentence text. In one embodiment, the pre-processing module 610 can be used to perform the operation S210 described above, which will not be repeated here.

[0122] The classification module 620 is used to input at least one sentence text into the first target model to obtain a category corresponding to each sentence text in the at least one sentence text. In one embodiment, the classification module 620 can be used to perform the operation S220 described above, which will not be repeated here.

[0123] According to an embodiment of the present disclosure, the classification module 620 is also used to input at least one sentence text into the sentence vector conversion model, determine the sentence vector corresponding to each sentence text, and obtain at least one sentence vector; determine the numerical value corresponding to each sentence vector according to the classification function; and determine the category to which each sentence text belongs according to the numerical value corresponding to each sentence vector.

[0124] According to an embodiment of the present disclosure, the first target model in the classification module 620 includes receiving a training text, where the training text includes a plurality of second sentence texts belonging to a second category; inputting the training text into the first model and the second model respectively to obtain categories corresponding to the training texts; and using the categories and the training text as distillation samples to perform model distillation on the third model to obtain the first target model.

[0125] The first determining module 630 is used to determine at least one first text element of each first sentence text belonging to the first category. In one embodiment, the first determining module 630 can be used to perform the operation S230 described above, which will not be repeated here.

[0126] The first processing module 640 is configured to perform a first processing on each first sentence text based on each first sentence text and at least one first text element associated with each first sentence text, thereby obtaining at least one target sentence text. In one embodiment, the first processing module 640 may be configured to perform operation S240 described above, which will not be further described herein.

[0127] According to an embodiment of the present disclosure, the first processing module 640 is also used to determine the type of each first text element based on each first sentence text and at least one first text element associated with each first sentence text; and according to the type, perform first processing on the first sentence text associated with each first text element to obtain at least one target sentence text.

[0128] According to an embodiment of the present disclosure, the first processing module 640 is also used to determine that multiple different first text elements belong to the first type when it is determined that multiple different first text elements are associated with the first sentence text; determine that two consecutive identical first text elements belong to the second type when it is determined that there are two consecutive identical first text elements in at least one first text element; and determine that the first text element belongs to the third type when it is determined that the first text element is consistent with the first text element in the regular expression library.

[0129] According to an embodiment of the present disclosure, the first processing module 640 is also used to, when it is determined that multiple different first text elements belong to the first type, perform a second processing on the first sentence texts associated with the multiple different first text elements to obtain a first target sentence; when it is determined that two consecutive identical first text elements belong to the second type, splice the first sentence texts respectively associated with the two consecutive identical first text elements to obtain a second target sentence text; and when it is determined that the first text element belongs to the third type, perform regular expression extraction on the first sentence texts respectively associated with the first text elements to obtain a third target sentence text, wherein the second processing includes: performing a second preprocessing on the first sentence text to obtain multiple first sub-clause texts; inputting at least one sentence text into the second target model to determine the category to which each first sub-clause text in the multiple first sub-clause texts belongs; and determining each second sub-clause text in at least one second sub-clause text belonging to the first category as a first target sentence text.

[0130] According to an embodiment of the present disclosure, the first processing module 640 is also used to determine the second text element of each first target sentence text based on at least one first target sentence text; determine two consecutive identical first text elements as second text elements; and determine the first text element as the second text element.

[0131] According to an embodiment of the present disclosure, the second target model in the first processing module 640 includes receiving a training text, where the training text includes a plurality of second sentence texts belonging to a second category; inputting the training text into the first model and the second model respectively to obtain categories corresponding to the training texts; and using the categories and the training text as distillation samples to perform model distillation on the third model to obtain a second target model.

[0132] The second determining module 650 is used to determine, for at least one target sentence text, a second text element corresponding to each target sentence text. In one embodiment, the second determining module 650 can be used to perform the operation S250 described above, which will not be repeated here.

[0133] According to an embodiment of the present disclosure, the second determination module 650 is also used to determine the second text element of each first target sentence text based on at least one first target sentence text; determine two consecutive identical first text elements as second text elements; and determine the first text element as the second text element.

[0134] According to an embodiment of the present disclosure, the text processing apparatus 600 of this embodiment further includes a verification module, a third determination module, an acquisition module, and a fourth determination module.

[0135] The verification module is used to verify the second text element. In one embodiment, the verification module can be used to perform the operation S3060 described above, which will not be repeated here.

[0136] The third determining module is used to determine the reason why the second text element fails to pass the verification when it is determined that the second text element fails to pass the verification. In one embodiment, the third determining module can be used to perform the operation S3090 described above, which will not be repeated here.

[0137] The acquisition module is used to acquire the correction rule based on the reason for failing the verification. In one embodiment, the acquisition module can be used to perform the operation S3100 described above, which will not be repeated here.

[0138] The fourth determination module is used to determine the target text element corresponding to the target sentence text based on the correction rule. In one embodiment, the fourth determination module can be used to perform the operation S3110 described above, which will not be repeated here.

[0139] According to embodiments of the present disclosure, any multiple modules among the pre-processing module 610, the classification module 620, the first determination module 630, the first processing module 640, and the second determination module 650 may be combined into a single module, or any one of these modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in a single module. According to embodiments of the present disclosure, at least one of the pre-processing module 610, the classification module 620, the first determination module 630, the first processing module 640, and the second determination module 650 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented in hardware or firmware through any other reasonable means of circuit integration or packaging, or may be implemented in any one of the three implementation methods of software, hardware, and firmware, or any appropriate combination of any of these. Alternatively, at least one of the preprocessing module 610, the classification module 620, the first determination module 630, the first processing module 640 and the second determination module 650 can be at least partially implemented as a computer program module, which can perform corresponding functions when executed.

[0140] Figure 7 A block diagram of an electronic device suitable for implementing a text processing method according to an embodiment of the present disclosure is schematically shown.

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

[0142] Various programs and data required for the operation of the electronic device 700 are stored in the RAM 703. The processor 701, ROM 702, and RAM 703 are connected to each other via a bus 704. The processor 701 executes the various operations of the method flow according to the embodiment of the present disclosure by executing the programs in the ROM 702 and / or RAM 703. It should be noted that the programs may also be stored in one or more memories other than the ROM 702 and RAM 703. The processor 701 may also execute the various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in the one or more memories.

[0143] According to an embodiment of the present disclosure, electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to bus 704. Electronic device 700 may also include one or more of the following components connected to I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 708 including a hard disk; and a communication section 709 including a network interface card such as a LAN card or modem. Communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to I / O interface 705 as needed. Removable media 711, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 710 as needed, so that computer programs read from the removable media can be installed into storage section 708 as needed.

[0144] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when executed, implements the method according to the embodiments of the present disclosure.

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

[0146] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to cause the computer system to implement the item recommendation method provided by the embodiments of the present disclosure.

[0147] The computer program executes the above functions defined in the system / device of the embodiment of the present disclosure when the processor 701 executes the computer program. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0148] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 709, and / or installed from a removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0149] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from a removable medium 711. When the computer program is executed by the processor 701, the above-described functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.

[0150] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).

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

[0152] Those skilled in the art will appreciate that various combinations and / or combinations of features described in the various embodiments and / or claims of this disclosure may be made, even if such combinations or combinations are not explicitly described in this disclosure. In particular, various combinations and / or combinations of features described in the various embodiments and / or claims of this disclosure may be made, without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

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

Claims

1. A text processing method, comprising: Performing a first preprocessing on the text to be processed to obtain at least one sentence text; Inputting the at least one sentence text into a first target model to obtain a category corresponding to each sentence text in the at least one sentence text; For at least one first sentence text belonging to the first category, determining at least one first text element of each first sentence text; performing first processing on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text to obtain at least one target sentence text; as well as For the at least one target sentence text, determining a second text element corresponding to each target sentence text, including: determining two consecutive identical first text elements as second text elements; Wherein, for at least one first sentence text belonging to the first category, determining at least one first text element of each first sentence text includes: determining the category of each sentence text as a first pre-text element corresponding to each sentence text; When it is determined that the first pretext element is consistent with a text element in a first text element library, determining that the sentence text corresponding to the first pretext element is a first sentence text, and determining that the first pretext element is a first text element, wherein the first text element library includes at least one preset text element to be extracted; The step of performing first processing on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text to obtain at least one target sentence text includes: When it is determined that a plurality of different first text elements are associated with the first clause text, performing character or word segmentation processing on the first clause text to obtain a plurality of first subclause texts; Inputting at least one clause text into a second target model, and determining a category to which each first subclause text in a plurality of first subclause texts belongs; Each second sub-clause text in the at least one second sub-clause text belonging to the first category is determined as a first target clause text.

2. The method according to claim 1, wherein Inputting the at least one sentence text into the first target model to obtain a category corresponding to each sentence text in the at least one sentence text includes: Inputting the at least one sentence text into a sentence vector conversion model, determining a sentence vector corresponding to each sentence text, and obtaining at least one sentence vector; Determine a numerical value corresponding to each sentence vector according to the classification function; and The category to which each sentence text belongs is determined according to the numerical value corresponding to each sentence vector.

3. The method according to claim 1, wherein The step of performing a first processing on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text to obtain at least one target sentence text further includes: Determining the type of each first text element according to each first sentence text and at least one first text element associated with each first sentence text; and According to the type, first processing is performed on the first sentence text associated with each first text element to obtain at least one target sentence text.

4. The method according to claim 3, wherein: Determining the type of each first text element according to each first sentence text and at least one first text element associated with each first sentence text includes: In a case where it is determined that a plurality of different first text elements are associated with the first sentence text, determining that the plurality of different first text elements belong to a first type; In a case where it is determined that two consecutive identical first text elements are consistent in at least one first text element, determining that the two consecutive identical first text elements belong to the second type; and When it is determined that the first text element is consistent with the first text element in the regular expression library, it is determined that the first text element belongs to the third type.

5. The method according to claim 4, wherein The performing first processing on the first sentence text associated with each first text element according to the type to obtain at least one target sentence text includes: In the case where it is determined that the plurality of different first text elements belong to the first type, performing a second processing on the first sentence texts associated with the plurality of different first text elements to obtain a first target sentence; When it is determined that the two consecutive identical first text elements belong to the second type, the first sentence texts respectively associated with the two consecutive identical first text elements are concatenated to obtain a second target sentence text; and When it is determined that the first text element belongs to the third type, regular expression extraction is performed on the first sentence texts respectively associated with the first text elements to obtain third target sentence texts.

6. The method according to claim 5, wherein: The determining, for the at least one target sentence text, a second text element corresponding to each target sentence text includes: determining a second text element of each first target sentence text according to at least one of the first target sentence texts; The first text element is determined to be a second text element.

7. The method according to claim 2 or 5, wherein: The target model includes a first target model and a second target model, and the method further includes: receiving a training text, wherein the training text includes a plurality of second sentence texts belonging to a second category; Inputting the training text into the first model and the second model respectively to obtain categories corresponding to the training text respectively; and The category and the training text are used as distillation samples, and model distillation is performed on the third model to obtain a target model.

8. The method according to claim 1, further comprising: verifying the second text element; If it is determined that the second text element fails verification, determining a reason why the second text element fails verification; Obtaining correction rules based on the reason for the failure to pass the verification; and Based on the correction rule, a target text element corresponding to the target sentence text is determined.

9. A text processing device comprising: A preprocessing module, configured to perform a first preprocessing on the text to be processed to obtain at least one sentence text; a classification module, configured to input the at least one clause text into a first target model to obtain a category corresponding to each clause text in the at least one clause text; A first determining module is configured to determine, for at least one first sentence text belonging to the first category, at least one first text element of each first sentence text; A first processing module is configured to perform a first processing on each first sentence text according to each first sentence text and at least one first text element associated with each first sentence text, to obtain at least one target sentence text; as well as A second determining module is configured to determine, for the at least one target sentence text, a second text element corresponding to each target sentence text; Wherein, the first determining module is further configured to determine the category of each sentence text as a first pre-text element corresponding to each sentence text; When it is determined that the first pretext element is consistent with a text element in a first text element library, determining that the sentence text corresponding to the first pretext element is a first sentence text, and determining that the first pretext element is a first text element, wherein the first text element library includes at least one preset text element to be extracted; The first processing module is further configured to, when determining that a plurality of different first text elements are associated with the first clause text, perform character or word segmentation processing on the first clause text to obtain a plurality of first subclause texts; Inputting at least one clause text into a second target model, and determining a category to which each first subclause text in a plurality of first subclause texts belongs; determining each second sub-clause text in the at least one second sub-clause text belonging to the first category as a first target clause text; The second determining module is further configured to determine that two consecutive identical first text elements are second text elements.

10. An electronic device comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to execute the method according to any one of claims 1 to 8.

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

12. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Method and device for recognizing elements in judicial documents

    CN111291570A

  • Text processing method and device and computer equipment

    CN112800747A