Knowledge extraction method and device, electronic equipment and storage medium

By determining the text type and using the corresponding parser for text analysis, it solves the problem of unstructured text data processing, improves the efficiency and accuracy of knowledge extraction, and achieves more flexible and efficient knowledge acquisition.

CN118779461APending Publication Date: 2024-10-15BEIJING GRIDSUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310376640.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-10
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively process various unstructured text data, text types and text formats in knowledge extraction, resulting in low efficiency of knowledge extraction.

Method used

By judging the type of text to be extracted, use the structure parser Agent or image processing Agent to parse, and obtain knowledge of different granularities and formats, including event extraction, entity relationship triplet extraction, entity extraction, question and answer pair extraction, document labeling, Tasks such as document summary generation, text clustering and new word discovery.

Benefits of technology

It improves the efficiency and accuracy of knowledge extraction, provides a more flexible and efficient knowledge extraction solution, is suitable for different types of text data, and enhances the credibility of knowledge management and application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779461A_ABST
    Figure CN118779461A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a knowledge extraction method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a to-be-extracted text, and judging the text type of the to-be-extracted text, the text type comprising an editable text and a non-editable text; if the to-be-extracted text is an editable text, analyzing the to-be-extracted text through a structure analyzer Agent to obtain an analyzed text; if the to-be-extracted text is a non-editable text, analyzing the to-be-extracted text through a picture processing Agent to obtain an analyzed text; and performing knowledge extraction on the analyzed text to obtain knowledge with different granularities and / or formats. According to the method, the knowledge extraction efficiency is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information processing, and in particular to a method, device, electronic device and storage medium for knowledge extraction. Background Art

[0002] Knowledge extraction is an essential part of knowledge management and knowledge application. The quality of knowledge extraction has a great impact on subsequent work and is directly related to the quality of knowledge graph, the difficulty of knowledge management and the credibility of knowledge application. However, various unstructured text data, text types and text formats bring great difficulties to knowledge extraction. Summary of the invention

[0003] The purpose of the embodiments of the present invention is to provide a method, device, electronic device and storage medium for knowledge extraction, which greatly improves the efficiency of knowledge extraction.

[0004] In order to achieve the above-mentioned purpose, an embodiment of the present invention provides a method for knowledge extraction, which includes: obtaining a text to be extracted, determining a text type of the text to be extracted, wherein the text type includes editable text and non-editable text; if the text to be extracted is editable text, parsing the text to be extracted by a structure parser Agent to obtain a parsed text; if the text to be extracted is non-editable text, parsing the text to be extracted by an image processing Agent to obtain a parsed text; and performing knowledge extraction on the parsed text to obtain knowledge of different granularities and / or formats.

[0005] Optionally, the text to be extracted is parsed by a structure parser Agent to obtain a parsed text, including: obtaining the text type of the text to be extracted according to the structure parser Agent; performing structural parsing on the text to be extracted according to the text type to obtain a title hierarchy; and performing parsing on the text to be extracted at different granularities from chapters to paragraphs according to the title hierarchy to obtain a parsed text.

[0006] Optionally, parsing the text to be extracted by an image processing agent to obtain a parsed text includes: performing layout analysis on the text to be extracted by an image processing agent; performing OCR based on the result of the layout analysis to obtain the text in the text to be extracted; detecting and modifying the text, and parsing the text to be extracted at different granularities from chapter to paragraph to obtain a parsed text.

[0007] Optionally, the knowledge extraction of the parsed text includes at least one of: event extraction, entity relationship triple extraction, entity extraction, question-answer pair extraction, document labeling, document summary generation, text clustering and new word discovery.

[0008] Optionally, the method further includes parsing the text to be extracted by a structure parser Agent or an image processing Agent to obtain a parsed image, and storing the parsed image.

[0009] Optionally, the granularity includes article granularity, chapter granularity and paragraph granularity.

[0010] On the other hand, the present invention provides a device for knowledge extraction, which includes: an acquisition device, used to acquire a text to be extracted and determine the text type of the text to be extracted, wherein the text type includes editable text and non-editable text; a first processing device, used to parse the text to be extracted by a structure parser Agent to obtain a parsed text when the text to be extracted is editable text; when the text to be extracted is non-editable text, parse the text to be extracted by an image processing Agent to obtain a parsed text; and a second processing device, used to extract knowledge from the parsed text to obtain knowledge of different granularities and / or formats.

[0011] Optionally, the text to be extracted is parsed by a structure parser Agent to obtain a parsed text, including: obtaining the text type of the text to be extracted according to the structure parser Agent; performing structural parsing on the text to be extracted according to the text type to obtain a title hierarchy; and performing parsing on the text to be extracted at different granularities from chapters to paragraphs according to the title hierarchy to obtain a parsed text.

[0012] Optionally, parsing the text to be extracted by an image processing agent to obtain a parsed text includes: performing layout analysis on the text to be extracted by an image processing agent; performing OCR based on the result of the layout analysis to obtain the text in the text to be extracted; detecting and modifying the text, and parsing the text to be extracted at different granularities from chapter to paragraph to obtain a parsed text.

[0013] Optionally, the knowledge extraction of the parsed text includes at least one of: event extraction, entity relationship triple extraction, entity extraction, question-answer pair extraction, document labeling, document summary generation, text clustering and new word discovery.

[0014] Optionally, the granularity includes article granularity, chapter granularity and paragraph granularity.

[0015] On the other hand, the present invention provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the above-mentioned knowledge extraction method by executing the instructions stored in the memory.

[0016] On the other hand, the present invention also provides a machine-readable storage medium storing machine instructions, which, when executed on a machine, enables the machine to execute the above-mentioned knowledge extraction method.

[0017] The present invention provides a method for knowledge extraction, which includes: obtaining a text to be extracted, determining the text type of the text to be extracted, wherein the text type includes editable text and non-editable text; if the text to be extracted is editable text, parsing the text to be extracted by a structure parser agent to obtain a parsed text; if the text to be extracted is non-editable text, parsing the text to be extracted by an image processing agent to obtain a parsed text; and extracting knowledge from the parsed text to obtain knowledge of different granularities and / or formats. The method increases recall through a model, provides a more targeted knowledge extraction solution for the project in a more flexible and efficient manner, provides basic service capabilities, and greatly improves the efficiency of knowledge extraction.

[0018] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0020] Figure 1 It is a flow chart of a knowledge extraction method of the present invention;

[0021] Figure 2 It is a specific flow chart of a knowledge extraction method of the present invention;

[0022] Figure 3 It is a schematic diagram of a configuration module for knowledge extraction of the present invention;

[0023] Figure 4 It is a schematic diagram of an electronic device of the present invention. DETAILED DESCRIPTION

[0024] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.

[0025] Figure 1 is a flow chart of a knowledge extraction method of the present invention, Figure 2 is a specific flow chart of a knowledge extraction method of the present invention, combined with Figure 1 and Figure 2As shown, step S101 is to obtain the text to be extracted.

[0026] Step S102 is to determine the text type of the text to be extracted, and the text type includes editable text and non-editable text. The document to be extracted enters the text type judgment Agent process, and the text type judgment Agent automatically determines the text type. The text includes: txt text, editable pdf, non-editable pdf, png, ppt, docx, doc, html and other types. Different types of text are processed differently. The Agent database includes at least a text type judgment Agent, a structure parser Agent, an image processing Agent and a knowledge extraction Agent. The text type judgment Agent is used to determine the text type, the structure parser Agent is used to parse the text structure, the image processing Agent is used to process the image, and the knowledge extraction Agent is used to extract text knowledge.

[0027] Step S103 is to parse the text to be extracted by a structure parser agent to obtain a parsed text if the text to be extracted is an editable text. Parsing the text to be extracted by a structure parser agent to obtain a parsed text includes: obtaining the text type of the text to be extracted according to the structure parser agent; performing structural parsing on the text to be extracted according to the text type to obtain a title level; performing parsing on the text to be extracted at different granularities from chapter to paragraph according to the title level to obtain a parsed text.

[0028] According to a specific implementation, in the structure parsing Agent, different methods are used to parse the structure of the document according to the specific types of documents. For example, Docx documents have an xml format, and have standard nesting and tags for specific titles, texts, pictures, etc., which can be parsed using specific format rules. Doc and "multi-layer" pdf documents need to be converted into pdf documents, and the text position coordinates inside are parsed using the documents to determine the font and position of the text, and the parsing is performed in combination with rule settings. Among them, some "multi-layer" pdfs have separate layers such as headers and footers, and the content of the separate layers needs to be extracted and parsed to the corresponding content according to the position.

[0029] According to the title level, different granularities of analysis are performed from chapter to paragraph. For example, the article granularity includes: title, abstract, keywords, full text; the chapter granularity includes: chapter 1, chapter 2, etc.; the paragraph granularity includes: paragraph 1, paragraph 2, etc. If the pictures and picture annotations contained in the text to be extracted need to be extracted, they are also completed in the structure parser Agent, and there are different processing methods for documents of different formats. For example: Docx documents have clear picture identifiers, and pictures and titles are obtained according to the identifiers; in non-picture format PDFs, pictures are obtained according to the picture address, and the picture title is obtained in the documents before and after the picture according to empirical rules; for pictures and picture format PDFs, the picture position and title position are obtained through the layout analysis task, and the text corresponding to the title is obtained through OCR; there are also many file types such as xml and html, which need to be processed differently according to different types.

[0030] Step S104 is to parse the text to be extracted by an image processing agent to obtain a parsed text if the text to be extracted is a non-editable text. The parsing of the text to be extracted by an image processing agent to obtain a parsed text includes: performing layout analysis on the text to be extracted by an image processing agent; performing OCR according to the result of the layout analysis to obtain the text in the text to be extracted; detecting and modifying the text, and parsing the text to be extracted at different granularities from chapters to paragraphs to obtain a parsed text.

[0031] According to a specific implementation, the non-editable text (for example, non-editable PDF, PNG, etc.) enters the image processor Agent. In the image processing Agent, the non-editable text is subjected to basic layout analysis, and according to the result of the layout analysis, OCR (optical character recognition) is performed to obtain the text in the text, and the text is detected and modified for typos; while analyzing the layout and obtaining the text, the document is parsed at different granularities from chapters to paragraphs. The parsing of the document at different granularities from chapters to paragraphs can be specifically performed as follows: parsing at different granularities from chapters to paragraphs according to the title level, for example: the article granularity includes: title, abstract, keywords, full text; the chapter granularity includes: chapter 1, chapter 2, etc.; the paragraph granularity includes: paragraph 1, paragraph 2, etc. At the same time, the pictures and picture annotations in the text to be extracted are extracted.

[0032] In specific extraction tasks such as event extraction and relationship extraction, the model is used to improve the extraction accuracy and recall rate.

[0033] Step S105 is to extract knowledge from the parsed text to obtain knowledge of different granularities and / or formats. The knowledge extraction from the parsed text includes at least one of event extraction, entity relationship triple extraction, entity extraction, question-answer pair extraction, document tagging, document summary generation, text clustering and new word discovery. It also includes parsing the text to be extracted by a structure parser agent or an image processing agent to obtain a parsed image and storing the parsed image. The granularity includes article granularity, chapter granularity and paragraph granularity.

[0034] According to a specific implementation method, after the processing of steps S103 and S104d, the document, the image and its annotations are uniformly stored. The text part enters the knowledge extractor agent. In the knowledge extractor agent, knowledge is extracted from the document through different tasks, including event extraction, entity relationship triple extraction, entity extraction, question-answer pair extraction, document (paragraphs, chapters, etc. can be set to different granularities) labeling, document summary generation, text clustering, new word discovery, etc. For example: event extraction is to extract events from documents, including event time, location, people, event causes, results, etc.; entity relationship triple extraction is to extract entity relationship triples from documents, which may include entity-relationship-entity, entity-attribute name-attribute value, etc.; entity extraction is to extract entities from documents; question-answer pair extraction is to extract questions and answers from documents, or generate questions by specifying answers, and obtain questions and answers; document labeling is to classify labels for the full text, chapters, paragraphs, etc. of documents; document summary generation is to obtain a content summary of a document from a document through a generative or extractive method; text clustering is to determine the attribution of a document in an unsupervised manner, and to preliminarily determine the topic of documents in the same cluster; new word discovery is to discover new words that are not used conventionally.

[0035] Some of the tasks included in the knowledge extraction agent in step S105 are to train machine learning models, some are rule-based, or the same task may use a combination of rules and machine learning models. The above are all independent rule editor agents. The rule editor can act on different tasks in the knowledge extraction agent. For example: the entity relationship extraction task uses the deep learning model RPETN; in the document parsing task, Doc documents and "multi-layer" pdf documents need to be converted into pdf documents, and the text position coordinates inside the document are parsed to determine the font and position of the text, and the parsing is performed in combination with rule settings; in the joint content extraction task, summary extraction is based on location information and the defined "summary" field rules for extraction.

[0036] Figure 3 It is a schematic diagram of the configuration module of the knowledge extraction of the present invention, such as Figure 3As shown, the knowledge of different granularities and formats obtained by the knowledge extraction agent can be directly stored in different databases. Since all or part of the tasks may be used in the entire knowledge extraction process, the tasks and the specific processes within the tasks can be configured in the configuration module. If no configuration is performed, the agent will adaptively select the corresponding task to execute according to the specific text format. The configuration module is a configuration file, and the script executes the script according to the content in the configuration file, including: document format recognition task, obtaining the storage location of the previous step, document parsing task, obtaining the storage location of the previous step, key content extraction task, obtaining the "title, summary, text" of the previous step, etc., which are instruction tags that indicate the script. The label is defined first, and each step is a series of instructions. The configuration module is to string these scattered tasks together and make them automatically executable.

[0037] The present invention also provides a device for knowledge extraction, which includes: an acquisition device, used to acquire a text to be extracted and determine the text type of the text to be extracted, wherein the text type includes editable text and non-editable text; a first processing device, used to parse the text to be extracted by a structure parser Agent to obtain a parsed text when the text to be extracted is editable text; when the text to be extracted is non-editable text, parse the text to be extracted by an image processing Agent to obtain a parsed text; and a second processing device, used to perform knowledge extraction on the parsed text to obtain knowledge of different granularities and / or formats.

[0038] The present invention provides a method for knowledge extraction, which includes: obtaining a text to be extracted, determining the text type of the text to be extracted, wherein the text type includes editable text and non-editable text; if the text to be extracted is editable text, parsing the text to be extracted by a structure parser agent to obtain a parsed text; if the text to be extracted is non-editable text, parsing the text to be extracted by an image processing agent to obtain a parsed text; and extracting knowledge from the parsed text to obtain knowledge of different granularities and / or formats. The method increases recall through a model, provides a more targeted knowledge extraction solution for the project in a more flexible and efficient manner, provides basic service capabilities, and greatly improves the efficiency of knowledge extraction.

[0039] Figure 4 is a schematic diagram of an electronic device of the present invention, such as Figure 4 As shown, the electronic device includes: at least one processor; a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the knowledge extraction method by executing the instructions stored in the memory.

[0040] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and synonym acquisition can be achieved by adjusting kernel parameters, thereby improving the efficiency of knowledge extraction.

[0041] An embodiment of the present invention provides a storage medium on which a program is stored. When the program is executed by a processor, the method for extracting knowledge is implemented.

[0042] An embodiment of the present invention provides a processor, which is used to run a program, wherein the method for knowledge extraction is executed when the program is running.

[0043] The embodiment of the present invention provides a device, which includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the above-mentioned synonym acquisition method. The device in this article can be a server, a PC, a PAD, a mobile phone, etc.

[0044] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: obtaining a text to be extracted, determining a text type of the text to be extracted, wherein the text type includes editable text and non-editable text; if the text to be extracted is editable text, parsing the text to be extracted by a structure parser Agent to obtain a parsed text; if the text to be extracted is non-editable text, parsing the text to be extracted by an image processing Agent to obtain a parsed text; and performing knowledge extraction on the parsed text to obtain knowledge of different granularities and / or formats.

[0045] The text to be extracted is parsed by a structure parser agent to obtain a parsed text, including: obtaining the text type of the text to be extracted according to the structure parser agent; performing structural parsing on the text to be extracted according to the text type to obtain a title level; parsing the text to be extracted at different granularities from chapter to paragraph according to the title level to obtain a parsed text. The text to be extracted is parsed by an image processing agent to obtain a parsed text, including: performing layout analysis on the text to be extracted by an image processing agent; performing OCR according to the result of the layout analysis to obtain the text in the text to be extracted; detecting and modifying the text, and parsing the text to be extracted at different granularities from chapter to paragraph to obtain a parsed text. The knowledge extraction of the parsed text includes: at least one of event extraction, entity relationship triple extraction, entity extraction, question-answer pair extraction, document tagging, document summary generation, text clustering and new word discovery. The parsed image is stored. The granularity includes article granularity, chapter granularity and paragraph granularity.

[0046] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0047] In a typical configuration, the device includes one or more processors (CPU), memory and bus. The device may also include input / output interface, network interface and the like.

[0048] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.

[0049] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0050] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0051] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0052] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for knowledge extraction, characterized in that: The method includes: Obtaining the text to be extracted, and determining the text type of the text to be extracted, wherein the text type includes editable text and non-editable text; If the text to be extracted is an editable text, the text to be extracted is parsed by a structure parser Agent to obtain a parsed text; If the text to be extracted is non-editable text, the text to be extracted is parsed by an image processing agent to obtain a parsed text; Knowledge extraction is performed on the parsed text to obtain knowledge of different granularities and / or formats.

2. The method according to claim 1, characterized in that The text to be extracted is parsed by a structure parser Agent to obtain a parsed text, including: Acquiring the text type of the text to be extracted according to the structure parser Agent; Performing structural analysis on the text to be extracted according to the text type to obtain a title level; The text to be extracted is parsed at different granularities from chapter to paragraph according to the title level to obtain a parsed text.

3. The method according to claim 1, characterized in that The step of parsing the text to be extracted by the image processing agent to obtain the parsed text includes: Perform layout analysis on the extracted text through image processing agent; Perform OCR according to the result of the layout analysis to obtain the text in the text to be extracted; The text is detected and modified, and the extracted text is parsed at different granularities from chapter to paragraph to obtain a parsed text.

4. The method according to claim 1, characterized in that: The extracting knowledge from the parsed text includes: At least one of event extraction, entity relationship triple extraction, entity extraction, question-answer pair extraction, document labeling, document summary generation, text clustering and new word discovery; The granularity includes article granularity, chapter granularity and paragraph granularity.

5. The method according to claim 1, characterized in that The method also includes parsing the text to be extracted by a structure parser Agent or an image processing Agent to obtain a parsed image, and storing the parsed image.

6. A knowledge extraction device, characterized in that: The device includes: An acquisition device is used to acquire the text to be extracted and determine the text type of the text to be extracted, wherein the text type includes editable text and non-editable text; A first processing device is used for parsing the text to be extracted by a structure parser Agent to obtain a parsed text if the text to be extracted is an editable text; When the text to be extracted is non-editable text, the text to be extracted is parsed by an image processing agent to obtain a parsed text; The second processing device is used to extract knowledge from the parsed text to obtain knowledge of different granularities and / or formats.

7. The device according to claim 6, characterized in that The text to be extracted is parsed by a structure parser Agent to obtain a parsed text, including: Acquiring the text type of the text to be extracted according to the structure parser Agent; Performing structural analysis on the text to be extracted according to the text type to obtain a title level; The text to be extracted is parsed at different granularities from chapter to paragraph according to the title level to obtain a parsed text.

8. The device according to claim 6, characterized in that The step of parsing the text to be extracted by the image processing agent to obtain the parsed text includes: Perform layout analysis on the extracted text through image processing agent; Perform OCR according to the result of the layout analysis to obtain the text in the text to be extracted; The text is detected and modified, and the extracted text is parsed at different granularities from chapter to paragraph to obtain a parsed text.

9. An electronic device, characterized in that: The electronic device includes: at least one processor; a memory connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the knowledge extraction method described in any one of claims 1 to 5 by executing the instructions stored in the memory.

10. A machine-readable storage medium, characterized in that: Machine instructions are stored, and when the machine instructions are executed on a machine, the machine executes the method for knowledge extraction described in any one of claims 1 to 5.