Rule configuration text extraction method and system, medium and equipment
The text entity is split and filtered through the method of rule configuration to generate the extracted entity, solving the problem of low text extraction efficiency in the existing technology, and achieving an efficient and accurate text extraction process.
Patent Information
- Application Number
- CN202410980078.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-12-24
AI Technical Summary
Existing text extraction methods rely on language models, resulting in inefficient extraction and inability to efficiently process large amounts of text information.
The rule configuration method is adopted to split and filter text entities through preset rules and correct rules to generate extracted entities, reduce dependence on language models, and improve extraction efficiency and accuracy.
It realizes efficient text extraction, reduces manual operation steps, improves the accuracy of the extraction entity, supports batch text extraction and table type extraction, and lowers the user threshold.
Smart Images

Figure CN119180285A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text extraction, and in particular to a rule-configured text extraction method, system, medium and device. Background Art
[0002] With the rapid development of deep learning and natural language processing, language models have made significant breakthroughs. These models can understand and generate human language and have excellent semantic understanding and contextual reasoning capabilities. Existing text extraction mostly relies on language models. For a large amount of text information extraction tasks, using language models to identify them one by one will prolong the time and response speed of the entire text extraction and reduce the extraction efficiency. Summary of the invention
[0003] In view of the above problems, the present invention provides a rule-configured text extraction method, system, medium and device, which solves the problem that the existing text extraction relies on language model extraction, resulting in low extraction efficiency.
[0004] To achieve the above object, in a first aspect, the present invention provides a rule-configured text extraction method, comprising:
[0005] Obtaining the text to be processed, where the text to be processed includes multiple text entities;
[0006] Extracting text entities from the text to be processed according to preset rules to obtain multiple entities to be corrected;
[0007] According to the correction rules, interference words are filtered out for each entity to be corrected to obtain multiple extracted entities;
[0008] Text extraction is performed in a database according to a plurality of extraction entities to obtain a first extraction result.
[0009] In some embodiments, the method further comprises:
[0010] Determine whether the first extraction result is an empty set;
[0011] If so, obtain the associated tags of the current text to be processed, the associated tags including at least one of the extraction purpose, organization, attribute description and keywords, input the associated tags and multiple extraction entities into the language model for text extraction, and obtain the second extraction result.
[0012] In some embodiments, the method further comprises:
[0013] Return the first extraction result in JSON format;
[0014] And / or, return the second extraction result in JSON format.
[0015] In some embodiments, the preset rules include customized rules and basic rules; extracting text entities from the text to be processed according to the preset rules to obtain multiple entities to be corrected also includes:
[0016] Determine whether there is an input tag, where the input tag is a keyword related to the current text to be processed;
[0017] If yes, the input label is integrated with the basic rule to generate a customized rule, and the text entities in the text to be processed are extracted according to the customized rule to obtain a plurality of entities to be corrected;
[0018] If not, the text entities in the text to be processed are extracted according to the basic rules to obtain multiple entities to be corrected.
[0019] In some embodiments, filtering out interference words from each entity to be corrected according to the correction rule to obtain multiple extracted entities further includes:
[0020] Obtaining a part-of-speech tag, where the part-of-speech tag includes at least one of a verb, an auxiliary word, and a modal particle;
[0021] Remove the interference words containing part-of-speech tags in the entity to be corrected to generate the extracted entity.
[0022] In some embodiments, obtaining the text to be processed includes:
[0023] Receiving an initial text, performing OCR recognition on the initial text, and generating a plurality of paragraph marks and paragraph text of the initial text;
[0024] Mapping paragraph tags with paragraph text is stored to generate text entities;
[0025] Multiple text entities are arranged according to paragraph marks to generate text to be processed.
[0026] In some embodiments, the initial text includes one of TXT text, PDF text, WORD text, JPG text and OFD text.
[0027] In a second aspect, the present invention also provides a rule-configured text extraction system, comprising a text receiving module, a basic recognition module, a correction recognition module and a data extraction module, wherein the text receiving module is used to obtain a text to be processed; the basic recognition module is used to extract text entities in the text to be processed according to preset rules to obtain a plurality of entities to be corrected; the correction recognition module is used to filter out interference words for each entity to be corrected according to the correction rules to obtain a plurality of extracted entities; the data extraction module is used to extract text in a database according to a plurality of extracted entities to obtain a first extraction result.
[0028] In a third aspect, the present invention further provides a computer-readable storage medium storing computer program instructions, which implement the method described in the first aspect when executed by a processor.
[0029] In a fourth aspect, the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method described in the first aspect.
[0030] Different from the prior art, in the above technical scheme, a text to be processed is obtained, the text to be processed includes multiple text entities, the text entities are extracted according to preset rules, multiple entities to be corrected are obtained, and then the interference words are filtered out of the multiple entities to be corrected according to the correction rules, so as to obtain multiple extracted entities, and then the text is extracted for the multiple extracted entities to obtain the first extraction result. The technical scheme sets preset rules and correction rules, first uses the preset rules to preliminarily process the text entities, splits multiple sentences in the text entity into multiple entities to be corrected, each entity to be corrected may include several phrases or short sentences, and then uses the correction rules to filter out the modal particles, auxiliary words or verbs in the entity to be corrected, and screens out the extracted entities that need to be extracted in the end, and the extracted entities include at least one word with practical extraction meaning, so as to obtain the first extraction result; the whole process splits and filters the text entities multiple times, without the need for the user to manually enter relevant tags, and the whole extraction process does not completely rely on the recognition of the language model, and the rule configuration of the text to be processed is realized with the help of preset rules and correction rules, which improves the accuracy of the extracted entities generated during text extraction and reduces the manual operation steps.
[0031] The above-mentioned records related to the content of the invention are only an overview of the technical solution of the present invention. In order to enable ordinary technicians in the field to more clearly understand the technical solution of the present invention, and then implement it according to the text of the specification and the contents recorded in the drawings, and in order to make the above-mentioned purpose and other purposes, features and advantages of the present invention easier to understand, the following is a description in combination with the specific implementation mode of the present invention and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings are only used to illustrate the principles, implementations, applications, features and effects of the specific embodiments of the present invention and other related contents, and shall not be considered as limiting the present invention.
[0033] In the drawings of the specification:
[0034] Figure 1 A step diagram of a text extraction method according to a rule configuration described in a specific embodiment of the present invention;
[0035] Figure 2A schematic diagram of a text extraction process according to a rule configuration described in a specific embodiment of the present invention;
[0036] Figure 3 A schematic diagram of an electronic device for a text extraction method according to a specific embodiment of the present invention.
[0037] The reference numerals in the above drawings are described as follows:
[0038] 1. Electronic equipment;
[0039] 11. Memory;
[0040] 12. Processor. DETAILED DESCRIPTION
[0041] In order to explain in detail the possible application scenarios, technical principles, specific schemes that can be implemented, and the purposes and effects of the present invention, the following is a detailed description in combination with the specific embodiments listed and the accompanying drawings. The embodiments described herein are only used to more clearly illustrate the technical solutions of the present invention, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present invention.
[0042] Reference to "embodiment" herein means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The word "embodiment" appearing in various places in the specification does not necessarily refer to the same embodiment, nor does it particularly limit its independence or association with other embodiments. In principle, in the present invention, as long as there is no technical contradiction or conflict, the various technical features mentioned in each embodiment can be combined in any way to form a corresponding implementable technical solution.
[0043] Unless otherwise defined, the technical terms used herein have the same meanings as those generally understood by those skilled in the art to which the present invention belongs; the use of relevant terms herein is only for describing specific embodiments and is not intended to limit the present invention.
[0044] In the description of the present invention, the term "and / or" is an expression used to describe the logical relationship between objects, indicating that three relationships may exist, for example, A and / or B, which means: A exists, B exists, and A and B exist at the same time. In addition, the character " / " in this article generally indicates that the objects before and after are in a logical relationship of "or".
[0045] In the present invention, terms such as "first" and "second" are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship of quantity, priority or sequence between these entities or operations.
[0046] Without further restrictions, in the present invention, the words "include", "comprises", "has" or other similar open-ended expressions used in sentences are intended to cover non-exclusive inclusion. These expressions do not exclude the presence of additional elements in the process, method or product including the elements, so that the process, method or product including a series of elements may include not only those limited elements, but also other elements not explicitly listed, or also include elements inherent to such process, method or product.
[0047] Similar to the understanding in the Examination Guidelines, in the present invention, expressions such as "greater than", "less than", "exceed" and the like are understood to exclude the number itself; expressions such as "above", "below", "within" and the like are understood to include the number itself. In addition, in the description of the embodiments of the present invention, the meaning of "multiple" is more than two (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups", "multiple times", etc., unless otherwise clearly and specifically limited.
[0048] In the description of the embodiments of the present invention, the space-related expressions used, such as "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "vertical", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicate the orientation or position relationship based on the orientation or position relationship shown in the specific embodiments or drawings, and are only for the convenience of describing the specific embodiments of the present invention or facilitating the reader's understanding, and do not indicate or imply that the referred device or component must have a specific position, a specific orientation, or be constructed or operated in a specific orientation, and therefore cannot be understood as a limitation on the embodiments of the present invention.
[0049] Unless otherwise expressly specified or limited, in the description of the embodiments of the present invention, the terms such as "install", "connect", "connect", "fix", "set" and the like used should be understood in a broad sense. For example, the "connection" can be a fixed connection, a detachable connection, or an integrated setting; it can be a mechanical connection, an electrical connection, or a communication connection; it can be a direct connection, or an indirect connection through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. For those skilled in the art of the technical field to which the present invention belongs, the specific meanings of the above terms in the embodiments of the present invention can be understood according to the specific circumstances.
[0050] See also Figure 1 and Figure 2 In a first aspect, this embodiment provides a rule-configured text extraction method, comprising:
[0051] S11, obtaining a text to be processed, where the text to be processed includes a plurality of text entities;
[0052] S12, extracting text entities in the text to be processed according to preset rules to obtain multiple entities to be corrected;
[0053] S13, filtering out interference words from each entity to be corrected according to the correction rule to obtain multiple extracted entities;
[0054] S14. Extract text in the database according to the multiple extraction entities to obtain a first extraction result.
[0055] In this embodiment, the text to be processed can be understood as text data containing words, such as an article, then the entire article is also text data. The text to be processed includes multiple text entities. The text entity here can be understood as a specific section of text formed by dividing the text to be processed into paragraphs. For example, a text entity of an article can be understood as a text paragraph in the article. If the article is a long article or contains sections, volumes, etc., a text entity can also be understood as the entire content of a section, or the entire content of a volume, and so on.
[0056] In this embodiment, the text entities in the text to be processed are first extracted according to the preset rules. The extraction here refers to extracting the key fields, sentences or words in the current text entity. Taking the text entity as a paragraph as an example, this extraction is the extraction of the key fields in the current paragraph, or the extraction of the sentences in the current paragraph, or the extraction of a certain word in the current paragraph. The multiple entities to be corrected obtained can be a short sentence, such as the short sentence: Go to Industrial and Commercial Bank of China; and so on. The preset rules here are the sentences identified when the key fields, short sentences or words are extracted from the text entity, or the sentences containing a certain word or a certain syntactic category. For example, the text content shown in rule (1) is: Go to xx (location vocabulary), then the text containing this sentence in a certain text entity will be extracted and form the entity to be corrected.
[0057] According to the correction rule, each entity to be corrected is filtered out of interference words. Here, the correction rule can be understood as a filtering standard for a certain useless word. For example, based on the entity to be corrected identified by "go to xx" (location word) in rule (1), the correction rule is "verb", then "go to" will be filtered out accordingly. If the correction rule also includes "particle", then the particles such as "of, "" in each entity to be corrected will be filtered out accordingly. The extracted entity obtained after filtering out interference words by the correction rule is a single word with practical significance, such as "Industrial and Commercial Bank of China", "artificial intelligence", etc., and then text extraction is performed from a database storing text data based on this extracted entity to obtain a first extraction result. The extraction here is understood as an operation of extracting text from a database based on the extracted entity, and the first extraction result obtained is a collection of multiple texts. The database here can be understood as a proprietary database specifically used to store text data, or it can be a custom database collected and stored in advance, etc., and this embodiment does not limit this.
[0058] Corresponding to the above method, in the second aspect, the present embodiment also provides a rule-configured text extraction system, including a text receiving module, a basic recognition module, a correction recognition module and a data extraction module, the text receiving module is used to obtain the text to be processed; the basic recognition module is used to extract text entities in the text to be processed according to preset rules, and obtain multiple entities to be corrected; the correction recognition module is used to filter out interference words for each entity to be corrected according to the correction rules, and obtain multiple extracted entities; the data extraction module is used to extract text in a database according to multiple extracted entities, and obtain a first extraction result.
[0059] The above steps are further understood with reference to a specific example below: if a user needs to extract text related to the article "Industrial and Commercial Bank of China Business Revenue Increase Assessment", based on the above extraction method, the user only needs to input the article "Industrial and Commercial Bank of China Business Revenue Increase Assessment" into the system, and the system will divide the article "Industrial and Commercial Bank of China Business Revenue Increase Assessment" into paragraphs, generate multiple text entities, and split each text entity into multiple short sentences according to preset rules. Each short sentence corresponds to an entity to be corrected, and then the useless words in the short sentences are filtered out according to the correction rules to obtain multiple extracted entities, such as "business", "increase in revenue", "net profit", "income", "business increase", "Industrial and Commercial Bank of China" and other words with practical meanings, and then text extraction is performed in the database based on this extracted entity to obtain the first extraction result.
[0060] Optionally, the current extraction action can be further optimized, such as sorting the extracted entities from high to low according to their frequency of occurrence, selecting the top few extracted entities as strong correlation conditions for extracting text, and then performing the text extraction operation. This method can further correct the accuracy of the first extraction result.
[0061] Optionally, the following steps can be added when extracting entities:
[0062] Obtain the keyword tags input by the user, use the keyword tags as information that is strongly associated with the current text to be processed, and input the keyword tags together with the extracted entities into the database for text extraction. This method can provide the customizability of the text to be processed during the text extraction process, which is more in line with the text extraction needs in different scenarios.
[0063] The above-mentioned embodiment can improve the extraction efficiency. Specifically, through preset rules and modified rules, more than 90% of the text extraction tasks can be diverted and processed, which greatly improves the efficiency of text extraction. It can support batch text extraction and table type extraction and generate entity tags; at the same time, the whole process does not rely on manually input keyword tags, and does not force users to enter keyword tags, which lowers the user's usage threshold and improves work efficiency; on this basis, if users add keyword tags, it can also meet the information extraction needs in different usage scenarios, further improve the flexibility of the entire system, achieve reusable migration, and optimize the use of the system.
[0064] See also Figure 1 and Figure 2 In some embodiments, the method further comprises:
[0065] S15, determining whether the first extraction result is an empty set;
[0066] S16. If yes, obtain the associated tags of the current text to be processed, the associated tags including at least one of the extraction purpose, organizational structure, attribute description and keywords, input the associated tags and multiple extracted entities into the language model for text extraction, and obtain a second extraction result.
[0067] In this embodiment, it is determined whether the first extraction result is an empty set. If so, it means that the extraction entity currently obtained by the preset rules and the modified rules cannot realize the extraction of text. On this basis, the associated label of the current text to be processed is obtained. The associated label can be understood as multiple information related to the current text to be processed, such as prompt words. Specifically, the associated label can include extraction purpose, organization, attribute description and keywords, etc. The associated label and multiple extracted entities are input into the language model for text extraction to obtain the second extraction result. The language model here can be understood as a language model constructed and generated by a neural network model, or it can be a knowledge graph, etc.
[0068] It should be noted that this embodiment introduces text extraction using a language model only when the first extraction result is ineffective. This approach reduces the frequency of use of the language model and uses the language model as an auxiliary means in the text extraction process to correct the text to be processed that cannot be extracted according to preset rules and modified rules, thereby minimizing the impact of the language model's recognition operation on the computing power of the entire system.
[0069] In some embodiments, the method further comprises:
[0070] Return the first extraction result in JSON format;
[0071] And / or, return the second extraction result in JSON format.
[0072] In this embodiment, the first extraction result and / or the second extraction result is converted into JSON format data and returned, which can reduce the number of bytes in the data transmission process and improve the transmission efficiency.
[0073] In some embodiments, the preset rules include customized rules and basic rules; extracting text entities from the text to be processed according to the preset rules to obtain multiple entities to be corrected also includes:
[0074] Determine whether there is an input tag, where the input tag is a keyword related to the current text to be processed;
[0075] If yes, the input label is integrated with the basic rule to generate a customized rule, and the text entities in the text to be processed are extracted according to the customized rule to obtain a plurality of entities to be corrected;
[0076] If not, the text entities in the text to be processed are extracted according to the basic rules to obtain multiple entities to be corrected.
[0077] In this embodiment, the preset rules include customized rules and basic rules, which are different from the keyword tags described above. The difference is that the keyword tags described above are in a parallel relationship with the extracted entities, that is, the keyword tags are introduced before executing step S14, and text extraction is performed in the database based on the keyword tags and the extracted entities. The customized rules shown in this embodiment refer to the user's input tags introduced in step S12, where the input tags and the basic rules are integrated. For example, if the input tag is "Industrial and Commercial Bank of China" and the basic rules include "Go to xx (location information)", then the customized rules include "Go to xx (location information) Industrial and Commercial Bank of China", and so on.
[0078] This method allows users to introduce custom keywords in the text to be processed stage, introduce the customizability of the text to be processed in the rule configuration process, and further meet the information extraction needs in different scenarios.
[0079] In some embodiments, filtering out interference words from each entity to be corrected according to the correction rule to obtain multiple extracted entities further includes:
[0080] Obtaining a part-of-speech tag, where the part-of-speech tag includes at least one of a verb, an auxiliary word, and a modal particle;
[0081] Remove the interference words containing part-of-speech tags in the entity to be corrected to generate the extracted entity.
[0082] In this embodiment, the correction rule can be understood as interference words containing part-of-speech tags, such as "go to Industrial and Commercial Bank of China" is a part-of-speech tag, "convened" in "Industrial and Commercial Bank of China held a meeting" is a part-of-speech tag, "of" in "Industrial and Commercial Bank of China's business volume" is a part-of-speech tag, and so on.
[0083] Optionally, the correction rules also include the position setting of the part-of-speech tag. The correction rules can be: the word where the part-of-speech tag is located is at the head of the entity to be corrected; it can also be that the word where the part-of-speech tag is located is at the tail of the entity to be corrected, etc. Through the correction rules, interfering words can be filtered out for multiple entities to be corrected, effectively reducing the misrecognition rate in the text recognition process, thereby improving the accuracy of text extraction.
[0084] In some embodiments, obtaining the text to be processed includes:
[0085] Receiving an initial text, performing OCR recognition on the initial text, and generating a plurality of paragraph marks and paragraph text of the initial text;
[0086] Mapping paragraph tags with paragraph text is stored to generate text entities;
[0087] Multiple text entities are arranged according to paragraph marks to generate text to be processed.
[0088] In some embodiments, the initial text includes one of TXT text, PDF text, WORD text, JPG text and OFD text.
[0089] In this embodiment, the initial text is a text containing multiple formats, such as PPT or WORD documents. With the help of the OCR recognition model, the initial text can be OCR recognized to generate multiple paragraph marks and paragraph texts of the initial text, and then the paragraph marks and paragraph texts are mapped and stored to generate text entities. Then, multiple text entities are arranged according to the paragraph marks to generate text to be processed.
[0090] This embodiment shows the specific steps of generating the to-be-processed text from the initial text, which can realize multi-format input of the initial text, further reduce the format requirements for the to-be-processed text during text extraction, and expand the compatibility of the entire system.
[0091] See also Figure 2 , the text extraction system containing the above method is further understood in combination with actual application examples below:
[0092] Steps:
[0093] 1) Step 1: Multi-format text input: The system supports text input in multiple formats, such as plain text files, PDF documents, word documents, ofd documents, etc. It meets the user's needs for multiple data sources and can process different types of text data in batches.
[0094] 2) Step 2: OCR recognition and extraction of text information: The system is embedded with an OCR recognition model and supports OCR recognition of multi-format unstructured data. It extracts text information from various files and returns them in the form of paragraphs.
[0095] 3) Step three: Extraction based on preset rule configuration: Input text information into the preset rule configuration system, extract relevant information according to the configuration rules, and extract corresponding entities using entity tag binding rules.
[0096] The preset rules are configured as follows:
[0097] Rule 1: Extract the text information containing the preceding and following text descriptions, for example: In order to ***** make
[0098] Rule 2: Extract text information containing the last information, for example: ***** Industry and Commerce Bureau
[0099] Rule3: Extract text information containing header information, for example: Central enterprises refer to *****
[0100] Rule 4: Extract text information containing keyword fields, for example: **artificial intelligence enterprise***
[0101] Example of basic rule configuration file settings:
[0102] In order to make, Target, rule1
[0103] Industry and Commerce Bureau, Orang, rule 2
[0104] Central enterprises refer to, Attribute, rule 3
[0105] Artificial Intelligence Enterprise,Keyword,rule4
[0106] 4) Step 4: Modify the rule extraction configuration: Modify the rule extraction configuration system, traverse and extract relevant information according to the configuration rules, and remove the filter words from the results extracted in the previous layer.
[0107] The correction rule extraction configuration is as follows:
[0108] Rule 1: Stop words contained in the head are removed. For example: ***Go to Industrial and Commercial Bank of China, configuration: Go to Before
[0109] Remove it to get: Industrial and Commercial Bank of China.
[0110] Rule 2: Stop words contained in the tail are removed. For example: Industrial and Commercial Bank of China holds a ** meeting, configuration: holds After
[0111] Remove it to get: Industrial and Commercial Bank of China.
[0112] Sample of the correction rule configuration file setting:
[0113] Go to, Before
[0114] holds, After
[0115] Received, Before
[0116] 5) Part-of-speech correction extraction configuration in Step Five: Through the part-of-speech correction extraction configuration system, traverse and extract relevant information according to the configuration rules, and remove the useless parts of speech in the results extracted in the previous layer.
[0117] The part-of-speech correction extraction configuration is as follows:
[0118] Rule 1: Part-of-speech filtering at the head. For example: of China Mobile Communications Corporation, "of" is a particle, remove it to get: China Mobile Communications Corporation.
[0119] Rule 2: Part-of-speech filtering at the tail. For example: of China Mobile Communications Corporation, "of" is a particle, remove it to get: China Mobile Communications Corporation.
[0120] 6) Language model extraction in Step Six: If there is no result after the above three-layer extraction, enable the language model for extraction. Input the text information + prompt words into the language model and return the json result.
[0121] The text input into the language model is:
[0122] OCR text information\n+ For the above text, extract entities of purpose (Target), organization (Orang), attribute description (Attribute), and keyword (Keyword), and return data in json format.
[0123] This system has the following advantages:
[0124] 1) High extraction efficiency: The text extraction system can offload more than 90% of the extraction tasks, greatly improving the efficiency of information extraction. It can support batch text extraction and table type extraction and generate entity tags;
[0125] 2) High accuracy: By leveraging the integrity and systematic nature of rule configuration, the extraction accuracy is greatly improved, and combined with the support of the language model, corrections can be made to situations where extraction is impossible.
[0126] 3) Flexible and scalable: Users can customize the entity tag library and set the extraction rules for each entity tag based on the tag library to meet the information extraction needs in different scenarios and achieve flexible and reusable migration.
[0127] 4) User-friendly: The system presents a simple and easy-to-understand configuration rule interface to users at the front end through a multi-level and multi-scale configuration process, lowering the usage threshold.
[0128] 5) High degree of automation: The system uses an efficient configuration platform, and the backend uses system logic rules to achieve a high degree of automation, which can greatly reduce the workload of manual processing, improve work efficiency, and save time and labor costs in the data labeling and model training process.
[0129] In a third aspect, this embodiment further provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described in the first aspect is implemented.
[0130] See also Figure 3 In a fourth aspect, the present invention further provides an electronic device 1, comprising a memory 11 and a processor 12, wherein the memory 11 is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor 12 to implement the method described in the first aspect.
[0131] The storage medium / memory 11 includes but is not limited to: RAM, ROM, disk, tape, CD, flash memory, USB flash drive, mobile hard disk, memory card, memory stick, network server storage, network cloud storage, etc. The processor 12 includes but is not limited to CPU (central processing unit 12), GPU (graphics processor 12), MCU (microprocessor 12), etc.
[0132] In the above technical scheme, by setting preset rules and correction rules, the preset rules are first used to perform preliminary processing on the text entity, and multiple sentences in the text entity are split into multiple entities to be corrected, each of which may include several phrases or short sentences. The correction rules are then used to filter out the modal particles, auxiliary words or verbs in the entity to be corrected, and the extracted entities that ultimately need to be extracted are screened out. The extracted entities include at least one vocabulary with practical extraction significance, thereby obtaining the first extraction result; the entire process involves multiple splitting and filtering of the text entity, without the need for the user to manually input relevant labels, and the entire extraction process does not completely rely on the recognition of the language model. The rule configuration of the text to be processed is realized with the help of preset rules and correction rules, thereby improving the accuracy of the extracted entities generated during text extraction and reducing manual operation steps.
[0133] Finally, it should be noted that although the above embodiments have been described in the specification and drawings of the present invention, the patent protection scope of the present invention cannot be limited thereby. All technical solutions generated by replacing or modifying equivalent structures or equivalent processes based on the essential concept of the present invention and using the contents recorded in the specification and drawings of the present invention, as well as directly or indirectly implementing the technical solutions of the above embodiments in other related technical fields, are included in the patent protection scope of the present invention.
Claims
1. A rule-configured text extraction method, characterized in that: include: Acquire a text to be processed, wherein the text to be processed includes a plurality of text entities; Extracting text entities from the text to be processed according to preset rules to obtain multiple entities to be corrected; According to the correction rule, interference words are filtered out for each entity to be corrected to obtain multiple extracted entities; Text extraction is performed in a database according to the plurality of extraction entities to obtain a first extraction result.
2. The rule-configured text extraction method according to claim 1, characterized in that: The method further comprises: Determine whether the first extraction result is an empty set; If so, obtain the associated tags of the current text to be processed, the associated tags including at least one of the extraction purpose, organizational structure, attribute description and keywords, input the associated tags and multiple extracted entities into the language model for text extraction, and obtain a second extraction result.
3. The rule-configured text extraction method according to claim 2, characterized in that: The method further comprises: Return the first extraction result in JSON format; And / or, returning the second extraction result in JSON format.
4. The rule-configured text extraction method according to claim 1, characterized in that: The preset rules include customized rules and basic rules; Extracting text entities from the text to be processed according to preset rules to obtain a plurality of entities to be corrected further comprises: Determine whether there is an input tag, where the input tag is a keyword related to the current text to be processed; If yes, the input tag is integrated with the basic rule to generate the customized rule, and the text entities in the to-be-processed text are extracted according to the customized rule to obtain a plurality of entities to be corrected; If not, the text entities in the text to be processed are extracted according to the basic rules to obtain a plurality of entities to be corrected.
5. The rule-configured text extraction method according to claim 1, characterized in that: Filtering out interference words from each entity to be corrected according to the correction rule to obtain multiple extracted entities also includes: Obtaining a part-of-speech tag, wherein the part-of-speech tag includes at least one of a verb, an auxiliary word, and a modal particle; The interfering words containing the part-of-speech tag in the entity to be corrected are removed to generate the extracted entity.
6. The rule-configured text extraction method according to claim 1, characterized in that: Getting the text to be processed includes: Receiving an initial text, performing OCR recognition on the initial text, and generating a plurality of paragraph marks and paragraph text of the initial text; Mapping and storing the paragraph mark and the paragraph text to generate the text entity; The plurality of text entities are arranged according to paragraph marks to generate the text to be processed.
7. The rule-configured text extraction method according to claim 6, characterized in that: The initial text includes one of TXT text, PDF text, WORD text, JPG text and OFD text.
8. A rule-configured text extraction system, characterized in that: include: A text receiving module, used to obtain the text to be processed; A basic recognition module, used for extracting text entities in the text to be processed according to preset rules to obtain multiple entities to be corrected; A correction recognition module is used to filter out interference words from each entity to be corrected according to the correction rules to obtain multiple extracted entities; The data extraction module is used to extract text in the database according to the multiple extraction entities to obtain a first extraction result.
9. A computer-readable storage medium storing computer program instructions, characterized in that: The computer program instructions implement the method according to any one of claims 1 to 8 when executed by a processor.
10. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 8.
