Document analysis method and device, electronic equipment and storage medium
Through the modular and plug-in design of the plug-in document parsing framework, using preset iconic expressions and pipeline parsers, it solves the problems of slow parsing speed and high storage cost of unformatted documents, and realizes efficient and flexible document parsing.
Patent Information
- Application Number
- CN202510817006.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-09-12
AI Technical Summary
The existing technology has problems such as slow parsing speed, complex operations and high storage medium time cost when parsing unformatted documents uploaded by users, especially the multiple rounds of operations on docx format documents lead to slow execution speed.
It adopts a plug-in document parsing framework, builds a modular and plug-in design, uses preset iconic expressions to determine the document parts paragraph by paragraph, and loads multiple parsers to parse the document content paragraph by paragraph. The parsers follow common interface standards to achieve pipeline parsing.
It improves the efficiency of document parsing, makes the parsing speed faster than existing technologies, simplifies the document recognition process, improves the scalability and flexibility of the system, and reduces the storage and reading time costs.
Smart Images

Figure CN120633633A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of document processing technology. Specifically, the present application relates to a document parsing method, device, electronic device, computer-readable storage medium and computer program product. Background Art
[0002] When performing intelligent typesetting on a document, the uploaded document must be parsed, identified, and typeset. Parsing a document means determining to which document section each text content belongs (e.g., metadata, body text, references, etc.).
[0003] Since users may be limited to lacking knowledge of using editing software (Word, WPS, etc.), the format of the documents to be typeset provided to the system may not be standardized, or even the document text may be provided without any format. Identifying and parsing documents "without any format", that is, "weakly formatted documents", is currently a difficulty in document parsing. Summary of the Invention
[0004] The embodiments of the present application provide a document parsing method, apparatus, electronic device, computer-readable storage medium, and computer program product that can solve the above-mentioned problems of the prior art. The technical solution is as follows: According to one aspect of an embodiment of the present application, a document parsing method is provided, the method comprising: Get the document to be parsed; Determining the document section to which each paragraph in the document belongs, paragraph by paragraph, based on a predetermined symbolic representation for each document section; Load multiple parsers; each parser corresponds to a document part and a text content, and is used to parse the corresponding text content in the corresponding document part according to the corresponding parsing rules; The document is parsed paragraph by paragraph by the multiple parsers, wherein for each paragraph, the paragraph is parsed according to at least one parser among the parsers corresponding to the document part to which the paragraph belongs, to obtain the text contents in the paragraph.
[0005] According to another aspect of an embodiment of the present application, a document parsing device is provided, comprising: Document acquisition module, used to obtain the document to be parsed; a text part determination module, configured to determine, paragraph by paragraph, the document part to which each paragraph in the document belongs based on a preset symbolic representation for each document part; A parser loading module is used to load multiple parsers; each parser corresponds to a document part and a text content, and is used to parse the corresponding text content in the corresponding document part according to the corresponding parsing rules; A parsing module is used to parse the document paragraph by paragraph using the multiple parsers, wherein for each paragraph, the paragraph is parsed according to at least one parser among the parsers corresponding to the document part to which the paragraph belongs to obtain the text content in the paragraph.
[0006] According to another aspect of an embodiment of the present application, an electronic device is provided. The electronic device includes a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the above-mentioned document parsing method.
[0007] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned document parsing method is implemented.
[0008] According to one aspect of an embodiment of the present application, a computer program product is provided, including a computer program, which implements the above-mentioned document parsing method when executed by a processor.
[0009] The beneficial effects of the technical solution provided by the embodiments of the present application are: By first determining the document section to which each paragraph belongs, based on pre-defined landmark representations for each document section, this system lays the foundation for subsequent targeted parsing of each paragraph using the parsers for that document section. For each document section, at least one parser for that document section is used to parse each paragraph in turn, with each parser performing its own function in a pipeline until a successful parsing is achieved. This architecture utilizes a modular and plug-in design concept, which not only simplifies the document content identification process but also improves the system's scalability and flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments of the present application.
[0011] Figure 1 A flowchart of a document parsing method provided in an embodiment of the present application; Figure 2 A schematic diagram of a document parsing framework provided in an embodiment of the present application; Figure 3 A schematic diagram of a process for determining the document portion to which each paragraph belongs, provided in an embodiment of the present application; Figure 4 A schematic diagram of another process for determining the document portion to which each paragraph belongs, provided in an embodiment of the present application; Figure 5A schematic diagram of a process for parsing a paragraph by a parser provided in an embodiment of the present application; Figure 6 A schematic diagram of the structure of a document parsing system provided in an embodiment of the present application; Figure 7 A schematic diagram of the structure of a document parsing device provided in an embodiment of the present application; Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0012] The following describes the embodiments of the present application in conjunction with the accompanying drawings. It should be understood that the embodiments described below in conjunction with the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0013] Those skilled in the art will understand that, unless otherwise stated, the singular forms "a", "an" and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or it can refer to that the element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used here can include wireless connection or wireless coupling. The term "and / or" used here indicates at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".
[0014] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0015] Although there are "Rules for Writing Academic Papers" that set general standards for paper writing, different publishers have different requirements on the details, resulting in diverse paper formats and lack of uniformity, which increases the difficulty of parsing and metadata extraction.
[0016] Related art provides a template-based automatic document typesetting method, which mainly includes two steps: Step 1: Purify the document to obtain the purified document, i.e., the first document to be typeset that is clean, effective, and truly contains the document content: the purified items include the annotation modification information in the document, the hidden information set by the document creator, and the lower-layer data information covered by the upper layer; Step 2: The first document to be typeset is segmented into a title part and a main text part according to preset feature information. Since the two parts are quite different, they are automatically annotated to obtain a second document to be typeset; for example, metadata such as Chinese author, author institution, etc. are annotated (consistent with the present invention).
[0017] Among them, the schemes marked in the title include: Annotate based on feature words. For example, if the preset feature word is "Author Profile," the example "Author Profile: xx, Female, 1981-, Professor" will cause both the feature word and the content containing the feature word to be annotated as "Author Profile" (here, "Author Profile" is not a feature word, but a annotation item). Multiple feature words can be set for a single annotation item.
[0018] The methods noted in the text include: Filter and mark tables and figures (and then remove the marked content from the main text) Parse and mark whether the preceding and following paragraphs of tables and figures are figure and table titles (then remove the marked content from the main text) Mark "Text Heading" with the number (and then remove the marked content from the text) Filter and mark formulas (then remove the marked content from the body text) Mark paragraphs.
[0019] The main problem with this solution is its slow parsing speed. Specifically, it takes an average of 3-6 minutes to annotate a document. The annotation solution performs multiple rounds of operations on docx-format documents, primarily by adding "annotations" to the document. The annotation results for each paragraph can then be viewed visually through software such as Word. However, the following process results in a slow execution: 1) Document purification operation: In order to perform annotations normally, the existing annotations must be purified first, which is a time-consuming process; 2) Repeated manipulation of docx files: docx files consist of complex XML structures. During the annotation process, the cleaned documents need to be manipulated to generate the "first document to be typeset," which is then segmented and annotated again to create the "second document to be typeset." Multiple rounds of manipulation of the complex structure slow down the process. 3) High time-consuming storage media costs for docx files: The resulting "second document to be typeset" is used for typesetting, but the storage medium and subsequent convenient usage are unclear. Files typically need to be stored on hard drives, object storage systems, and other media, increasing storage and access time costs. 4) Restrictions on the use of subsequent products and systems: Products or systems using this method must be able to parse docx files and obtain text and metadata through parsing.
[0020] The document parsing method, device, electronic device, computer-readable storage medium, and computer program product provided in this application are intended to solve the above technical problems in the prior art.
[0021] The present application innovatively provides a plug-in document parsing framework that provides a standardized and flexible solution for core business logic. This framework builds an infrastructure that allows developers to design and implement a series of independent parsers based on specific document characteristics, such as the structure of an academic paper. These parsers follow a common interface standard, ensuring seamless integration into the framework.
[0022] The core of this architecture lies in its modular design, which not only simplifies the document recognition process but also improves system scalability. Within this framework, different parsers can be systematically attempted and recognized based on the characteristics of the text content, such as title, author, and abstract. The framework intelligently calls each parser in sequence according to a preset weighted order until the target information is successfully parsed or a decision is made to skip.
[0023] This design fully considers the diversity and complexity of real-world applications, enabling the system to adapt to a variety of document structures and formats. By abstracting the parsing logic, the framework not only avoids code duplication and redundancy, but also greatly improves the readability and maintainability of the code. The architecture provides a "plug-in" model with high flexibility and adaptability. Parsing rules are integrated and run sequentially in the form of plug-ins, providing "an engineered solution for document parsing." Whether it is new document types or updates to parsing rules, they can be quickly integrated into the existing system without requiring large-scale modifications to the underlying framework.
[0024] The embodiment of the present application is aimed at structured parsing and metadata extraction based on the characteristic structure and writing rules of "journal documents". This method and device is based on the parsing and extraction of "journal full-text data" and can support the parsing and extraction of weakly formatted journal texts. It should be understood that "weak format" is different from "no format". "Weak format" complies with some basic document rules, such as the title must be recorded before the text, and the title will not be recorded in the middle of the text.
[0025] Among them, the "structured parsing part" can parse the document into metadata part, text part and reference part; In the metadata section, the present embodiment further parses the following content from the text and extracts metadata: Chinese title, Chinese author, Chinese author affiliation, Chinese abstract, Chinese keywords, DOI, China Library Classification Number, article number, document identification code, English title, English author, English author affiliation, English abstract, English keywords, manuscript receipt date, funding project, Chinese corresponding author, Chinese author profile, etc.; at the same time, the font and font size of the document body text are also parsed, mainly including: Western text font, Chinese text font, and text size; In the main text, the present embodiment will further parse the following content from the text: main text title (including level 1 to 6 titles), pictures, figure numbers and figure captions, formulas, formula numbers, tables, table numbers and table captions, main text (including font, font size, superscript, bold and other styles); In the reference section, the present application embodiment will further parse out all references from the text.
[0026] The embodiments of the present application can be used to provide underlying support for the following scenarios: 1) Based on the extracted journal metadata, supplement and improve the metadata of Chinese journals to improve information retrieval efficiency, promote knowledge discovery, and facilitate document management; 2) Automatically generate a table of contents for journal articles based on the structured information of the text title to improve readers' reading efficiency; 3) Reorganize structured information and complete automatic typesetting, reducing the manual workload generated by hundreds of editing requirements to meet national standards; 4) A large amount of structured information is conducive to in-depth statistical analysis of Chinese journal data and facilitates data mining and analysis; 5) Structured data can be processed again, such as translated, which helps in cross-language retrieval and promotes international academic exchanges.
[0027] It should be noted that the relationship between the two parts of the embodiment of the present application is as follows: "A document parsing framework" is an architecture, a specification and regulation, and an engineering solution; and "A method for structured parsing and metadata extraction of weakly formatted journal documents" is a business implementation based on the above architecture. Based on this architecture, more functions can be developed, such as the parsing of "dissertations" or "announcements, official documents" and other functions.
[0028] The following describes several exemplary embodiments to illustrate the technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application. It should be noted that the following embodiments can refer to, draw on, or combine with each other, and the same terms, similar features, and similar implementation steps in different embodiments will not be repeated.
[0029] 1. The embodiment of the present application first structures the document into three parts, then scans each part "top-down" and "section by section" before submitting it to a pre-set "parser" for parsing and recognition. The entire process is efficient and convenient, with no duplication of work and no performance loss. The execution process is fast, with a total time consumption of no more than 5 seconds. The average patent processing time of HowNet is 3-6 minutes, and the embodiment of the present application is much faster than HowNet. The parsing process of the embodiment of the present application does not rely on the annotation process of the docx document, so the execution efficiency is much faster than HowNet. 2. The storage medium of the embodiment of the present application is a memory-based key-value method. The key is the name defined by the system for each field, and the value is the document information containing the style. It can be used to directly extract and assemble into any format, including but not limited to JSON structured strings, tables, docx documents, etc. 3. The embodiment of the present application proposes a document parsing architecture, which consists of a parser, a parser loader and a parser execution scheduler, and adopts a pipeline execution process. The text paragraphs in the document are parsed by multiple parsers in turn, and each parser is like a worker on a factory assembly line, each doing its job until the parsing is successful. The architecture adopts a modular and plug-in design concept, which not only simplifies the document content recognition process, but also improves the scalability of the system, making it more flexible. The existing technology is a fixed execution process, which is slightly inferior to the embodiment of the present application in terms of framework flexibility, scalability and engineering.
[0030] The present application provides a document parsing method, such as Figure 1 As shown, the method includes: S101: Obtain the document to be parsed.
[0031] In some embodiments, a document upload interface may be provided to the user, so that the user can upload the document to be parsed through the interface.
[0032] In some embodiments, the document to be parsed may be a document stored locally in the terminal.
[0033] In some embodiments, the document parsing method can be encapsulated in a document parsing program. When a user starts the program, the program can provide a control for uploading a document, and the user can upload the document to be parsed by operating the control.
[0034] S102: Determine the document part to which each paragraph in the document belongs, paragraph by paragraph, based on the preset symbolic expressions for each document part.
[0035] The embodiment of the present application defines a document as a combination of multiple document parts. For example, taking a paper as an example, the document parts can be metadata, text and references. Taking a patent text as an example, the document parts can include claims, invention content, specification drawings, etc.
[0036] The embodiment of the present application predefines a landmark expression for each document part. That is, when a certain paragraph or each sentence of a text fragment has a landmark expression of a document part, it can be determined that the text fragment belongs to the document part.
[0037] In some embodiments, the landmark expression can be a characteristic word. For example, if a paragraph contains the words "Chinese and English abstract," the paragraph can be determined to belong to metadata. Another example is that if a paragraph contains the words "document identifier," the paragraph can also be determined to belong to metadata. Generally, in weakly formatted journal texts, a paragraph does not belong to multiple document parts simultaneously (for example, it cannot belong to both metadata and the main text). This application can quickly determine the document part to which a paragraph belongs based on the landmark expression for each document part. Furthermore, once the document part to which a paragraph belongs is determined, there is no need to process the paragraph using the landmark expressions of other document parts, thereby improving processing efficiency.
[0038] From the above, it can be seen that the format of weak-format papers still has certain rules - a document part is usually concentrated together and will not be scattered. For example, metadata (abstract, keywords, China Library Classification Number, document identification code, etc.) usually appears at the beginning of the document and will not be scattered in the paragraphs of the text. This application determines the document part to which each paragraph belongs according to the natural order of each paragraph in the document and the preset iconic expressions of each document part. After determining a document part, the iconic expression of the document part will no longer be used to determine the document part of subsequent paragraphs, thereby improving the efficiency of parsing.
[0039] Furthermore, this application first determines the document part to which each paragraph in the document belongs from a macro perspective, thereby laying the foundation for subsequently parsing each paragraph in each document part to obtain more fine-grained text content.
[0040] S103: Load multiple parsers.
[0041] In the embodiment of the present application, multiple parsers can be pre-configured for each document section. A parser is a tool specifically designed to analyze and extract specific information from a document. It follows predefined rules and standards to scan, identify, and parse the document content by paragraph, thereby converting the original text into structured, actionable data. In short, the parser is like an efficient "document reader" that can accurately and quickly understand and extract key information from the document, such as title information, author information, abstract information, etc., providing basic data support for subsequent document processing and application.
[0042] In some embodiments, the embodiments of the present application can load all parsers when the program starts. In order to ensure that the parsers are executed on demand, each parser in the embodiments of the present application has an "execution condition" attribute. Parsing will only be performed when the execution conditions are met, which has the advantage of not having to be loaded repeatedly.
[0043] Each parser in the embodiments of the present application corresponds to a document portion and a type of text content, and is used to parse the corresponding text content in the corresponding document portion according to the corresponding parsing rules. Taking metadata as an example, the text content of metadata includes DOI information, title information, author information, keyword information, identifier information, etc. The present application can configure different parsers for different text content, thereby parsing paragraphs by calling different parsers.
[0044] It should be noted that since this application adopts the method of pre-configuring the parser and using the parser to parse the document, the parsing rules and parsing content can be adjusted more flexibly. Taking the parser that parses DOI information as an example, since this parser only parses DOI information, if the parsing rules of DOI information need to be adjusted, only the version of this parser needs to be updated, and it will not interfere with the parsing rules of other parsers.
[0045] The embodiments of the present application provide a set of standardized and flexible solutions for the core business logic. By building an infrastructure, developers are allowed to design and implement a series of independent parsers based on specific document features, such as the structure of an academic paper. These parsers follow a common interface standard, ensuring that they can be seamlessly integrated into the framework. The core lies in its modular design concept, which not only simplifies the document recognition process, but also improves the scalability of the system. Under this framework, different parsers can be tried and recognized in an orderly manner according to the characteristics of the text content, such as title information, author information, abstract information, etc. The framework can intelligently call each parser in sequence according to the preset weight order until the target information is successfully parsed or it is decided to skip.
[0046] This design fully considers the diversity and complexity of practical applications, thus adapting to a variety of document structures and formats. By abstracting the parsing logic, not only does it avoid code duplication and redundancy, but it also greatly improves the readability and maintainability of the code. The embodiment of the present application provides a "plug-in" model with high flexibility and adaptability. The parsing rules (i.e., the parser) are integrated in the form of plug-ins and run sequentially.
[0047] S104. Parsing the document paragraph by paragraph using the multiple parsers, wherein for each paragraph, the paragraph is parsed according to at least one parser among the parsers corresponding to the document part to which the paragraph belongs, to obtain the text contents in the paragraph.
[0048] When parsing each paragraph in the embodiment of the present application, it is necessary to use at least one parser among the parsers corresponding to the document part to which the paragraph belongs to parse the paragraph. That is to say, the present application does not need to parse each paragraph with all the parsers corresponding to the document part to which the paragraph belongs, but can parse the paragraph by at least one of the parsers.
[0049] For example, considering that in most cases, the DOI of the paper itself is marked below the author information on the first page of the paper, in the footer, etc., and the corresponding DOIs for the cited documents are also listed in the reference section, and the DOI parser of this application is used to parse the DOI of the paper itself and does not need to pay attention to the DOIs of other documents. Therefore, when parsing each paragraph of the metadata of the document, when the DOI parser is used to parse out the DOI information of the paragraph, the DOI parser does not need to be called for subsequent paragraphs to avoid parsing out other DOIs.
[0050] In some embodiments, the parsing result of the parser for a paragraph can be parsing completion or parsing failure. When parsing is completed, it means that the corresponding text content has been parsed from the paragraph, so that the next parser can be called to continue parsing, or the parsing of the paragraph can be ended. If the parsing fails, it means that there are some faults in the current paragraph or the parser. At this time, manual intervention can be performed for parsing, or the parser can be called to repeat the parsing at least once (the number of repetitions can be determined by the developer or operator himself).
[0051] See Figure 2, which exemplarily shows an architectural diagram of a document parsing framework provided by an embodiment of the present application. As shown in the figure, the framework mainly includes a parser set, a parser loader and a parser execution scheduler. After determining the document part to which each paragraph belongs according to the preset iconic expressions for each document part, for each document part, the parser loader can load the parser set corresponding to the corresponding document part. Each parser in a parser set corresponds to the same document part and is used to parse out the corresponding text content in the paragraph. The parser execution scheduler can call each parser in the parser set in sequence according to the preset order, so as to obtain the text content of each paragraph.
[0052] The embodiment of the present application obtains the document to be parsed and first determines the document section to which each paragraph in the document belongs, paragraph by paragraph, based on the pre-set landmark expressions for each document section. This lays the foundation for the subsequent targeted parsing of each paragraph using the various parsers for the document section. For each document section, at least one parser for that document section is used to parse each paragraph of that document section one by one, with each parser performing its own function in a pipeline until the parsing is successful. This architecture adopts a modular and plug-in design concept, which not only simplifies the document content recognition process but also improves the scalability of the system, making it more flexible.
[0053] The document of the embodiment of the present application includes multiple document parts with a sequential relationship. For example, a paper usually includes metadata, text and references in sequence, and a patent usually includes abstract, claims, specification and drawings in sequence. When determining the document parts of each paragraph in the document, the present application determines which document paragraph landmark expression to use for identifying the current paragraph based on the landmark expressions of each document part that has been determined. That is, if the last paragraph of document part n is found, then it is necessary to first determine whether the last paragraph of document part n+1 is found. After finding the last paragraph of document part n+1, it is then necessary to determine whether the last paragraph of document part n+2 is found, and so on until the last paragraph of the last document part is found.
[0054] Based on the above embodiments, as an optional embodiment, determining the document part to which each paragraph in the document belongs, paragraph by paragraph, according to preset symbolic representations of each document part, includes: Performing a document part attribution operation on the document paragraph by paragraph to determine the document part to which each paragraph belongs; For each paragraph, performing the attribution operation on the paragraph includes: Determine the current target document part, wherein the target document part of the first paragraph is the first document part; If it is determined that the paragraph matches the landmark expression of the target document part, then determining that the document part to which the paragraph belongs is the target document part, updating the last paragraph of the target document part to the paragraph, and keeping the current target document part unchanged, thereby ending the attribution operation for the current paragraph; If it is determined that the paragraph does not conform to the landmark expression of the target document part, the paragraph is treated as a pending paragraph and the accumulated count of pending paragraphs is updated; if it is determined that the count reaches a preset threshold or the paragraph is the last paragraph of the document, the next document part of the target document part is treated as a new target document part, and the count is cleared to start from the first paragraph after the last paragraph of the current target document part and re-execute the attribution operation based on the new target document part.
[0055] The target document part of the embodiment of the present application is dynamically updated. For the first paragraph, its target document part is the first document part (such as metadata). If it is determined that the paragraph meets the iconic expression of the current document part, then the document part to which the paragraph belongs can be determined to be the target document part. In addition, the embodiment of the present application also maintains the information of the last paragraph for the target document part. Whenever it is determined that the document part to which a paragraph belongs is the target document part, the last paragraph of the target document part will be updated to the paragraph, while the current target document part will continue to remain unchanged. Then, when the document part attribution operation is performed on the next paragraph, it is still based on the iconic expression of the current target document part to determine whether the next paragraph belongs to the current target document part. Taking the first paragraph as an example, if it is determined that the first paragraph meets the iconic expression of the first document part (metadata), then the document part to which the first paragraph belongs is determined to be metadata, and the last paragraph of the metadata is updated to the first paragraph. Then, it is determined whether the second paragraph meets the iconic expression of the metadata.
[0056] If it is determined that the paragraph does not conform to the iconic expression of the current target document part, the paragraph will be treated as a pending paragraph. A pending paragraph refers to a paragraph whose document part cannot be determined at present. Considering that the metadata in many documents is incomplete, perhaps only the title is written, and the author information and subsequent metadata are not written, and there are many types of Chinese journals, each of which requires different metadata. Therefore, in actual application, it is not suitable to define the type of the last metadata, that is, to parse it into a specific type and determine that the last metadata has been found for judgment. Therefore, in order to correctly identify metadata and text, the embodiment of the present application considers counting. However, during the research and development process, it was further discovered that simply counting may lead to misjudgment, but combining the characteristics of journal articles will make the judgment very accurate. For example, the metadata in the article is generally a separate paragraph. For example, keywords should be in a separate paragraph. It is unlikely that keywords will be connected to a lot of text. If this happens, it is definitely the text. Therefore, the embodiment of the present application will also maintain a count: the cumulative count of pending paragraphs. When a paragraph does not conform to the iconic expression of the current document part, the count will be updated. For example, if the count when performing the attribution operation on the previous paragraph is an integer n, then the updated count is n+1. Then it is determined whether the technology reaches the preset threshold or whether the current paragraph is the last paragraph of the document. If the count reaches the preset threshold or the current paragraph is the last paragraph, it means that the last paragraph of the current target document part is the real last paragraph of the current target document part, so the next document part of the current target document part is used as the new target document part, and the count is cleared, and starting from the first paragraph after the last paragraph of the current target document part, the attribution operation is re-executed based on the new target document part.
[0057] See Figure 3 , which exemplarily shows a flow chart of determining the document part to which each paragraph in the document belongs paragraph by paragraph in an embodiment of the present application, as shown in the figure, including: S301, initializing the target document part to the first document part (also referred to as document part 1); S302, determining the paragraph and target document portion on which the attribution operation is currently to be performed; S303, determining whether the paragraph conforms to the landmark expression of the current target document portion, if so, executing S304, if not, executing S306; S304, determining that the paragraph belongs to the current target document; S305: The next paragraph of the paragraph is used as a new paragraph to be assigned to, and the process returns to step S302; S306: Set the paragraph as a pending paragraph and update the accumulated count of pending paragraphs; S307: Determine whether any of the following conditions is met: the count reaches a preset threshold and the paragraph is the last paragraph of the document. If so, execute S308; if not, execute S305. S308: The next document part of the current target document part is used as the new target document part, and the count is cleared. The first paragraph after the last paragraph of the current target document part is used as the new paragraph to be assigned. Return to step S302.
[0058] Next, we will take the example of a document result including metadata, text, and references in sequence to explain the attribution operation performed on this application section by section: The document is operated from top to bottom, paragraph by paragraph. Starting from the first paragraph, it is determined whether the paragraph meets the symbolic expression of metadata. If it does, the paragraph is determined to belong to metadata. If not, the paragraph is treated as a pending paragraph and the accumulated count of pending paragraphs is updated. If the count reaches a preset threshold or the paragraph is the last paragraph in the document, the main text is set as the new target document part, the count is reset, and the first paragraph after the last paragraph in the metadata is checked for the presence of the main text's signature expression. It is understood that if a paragraph with a signature expression belonging to the main text is present, it will be updated to the last paragraph in the main text. Subsequently, starting from the first paragraph after the last paragraph in the metadata, the signature expression of the reference will be checked, ultimately determining the document part to which all paragraphs belong.
[0059] In some embodiments, the present application provides the following four sets: Metadata paragraph collection: used to store metadata paragraphs; Body paragraph collection: used to store the paragraphs of the body text; Reference paragraph collection: used to store reference paragraphs; Temporary paragraph collection: used to store paragraphs with uncertain content.
[0060] The document is scanned using a top-down, paragraph-by-paragraph scanning strategy, starting with "Parsing Phase 1" (scanning continues until all paragraphs are scanned or until "Parsing Phase 2" is entered). The current paragraph is temporarily stored in the "Paragraph Collection in the Temporary Storage Area." It is then determined whether it matches the target document's signature representation, such as the presence of pre-set metadata signatures and conformance to signature rules. These signatures and rules can be configured in a variety of ways (e.g., multiple signatures can be set, and signature rules can include spaces between words, special symbols, etc., supporting greedy computation). If the determination is true, the entire paragraph is moved to the "Metadata Paragraph Collection," and the current paragraph's sequence number is recorded as the "Last Paragraph Number of Metadata Found." If the determination is false, the false count is updated and scanning continues with the next paragraph. If no metadata signature is detected for n consecutive times (n is a configurable constant; based on big data research, 10 is the most appropriate setting), or if the document reaches the end of the scan and there are still unprocessed paragraphs in the temporary storage area, the system will enter "Parsing Phase 2." (Note: The value of n can be 10, which means that the scenario is based on no metadata landmark expression found in 10 consecutive paragraphs. This also takes into account the special case that the body of the document to be parsed is too small or missing.) 3. If "Parsing Phase 2" is initiated, the following process will be executed: starting from the "paragraph number where metadata was last found," paragraphs will be scanned from top to bottom (until all paragraphs are scanned or until "Parsing Phase 3" is entered). If the judgment is true, the entire paragraph will be moved to the "Main Text Paragraph Collection," and the current paragraph number will be recorded as the "paragraph number where the main text was last found." If the judgment is false, the false count will be updated and scanning will continue with the next paragraph. If no key text expressions are detected for n consecutive times (n is a configurable constant; based on big data research, 3 is the most appropriate setting), or if the scan reaches the end of the document and there are still unprocessed paragraphs in the temporary storage area, the system will start and enter "Parsing Phase 3."
[0061] 4. If "Parsing Phase 3" is initiated, the following process will be executed: Starting from the next paragraph after the end of "Parsing Phase 2", the system will scan each paragraph from top to bottom (until all paragraphs are scanned or "Parsing Phase 4" is entered). If the judgment is true, the entire paragraph will be moved to the "Reference Paragraph Collection", and the current paragraph number will be recorded as the "paragraph number of the last reference found"; if the judgment is false, the false count will be updated and the scanning of the next paragraph will continue. If no reference signature is detected for n consecutive times (n is a configurable constant; based on big data research, a setting of 1 is most appropriate), or if the system reaches the end of the document and there are still unprocessed paragraphs in the temporary storage area, the system will start and enter "Parsing Phase 4".
[0062] 5. If "Parsing Phase 4" is started, the following process is executed: starting from the next paragraph where "Parsing Phase 3" ends, scan each paragraph from top to bottom (scan until all paragraphs are scanned), and store the current paragraph in the "Metadata Paragraph Collection".
[0063] 6. Finally, merge all footer paragraphs of the document into the metadata paragraph collection.
[0064] It should be noted that, according to the conventional structure of journal documents, the text following the reference is generally metadata. Therefore, when implementing the embodiments of this application, all the content following the reference is marked as metadata and will not be marked as text. Moreover, when the parser subsequently parses these texts in turn, if none of them can be parsed and the type of metadata cannot be identified, it will be marked as "unrecognizable metadata". In some embodiments, for paragraphs marked as metadata, if they cannot be parsed, they will be identified as "unrecognizable metadata", and this applies not only to the text following the reference.
[0065] Based on the above embodiments, as an optional embodiment, the embodiment of the present application determines the document part to which each paragraph in the document belongs, paragraph by paragraph, based on preset symbolic representations of each document part, including: Initialize the target document part as metadata, and perform the document part attribution operation on the document paragraph by paragraph to determine the document part to which each paragraph belongs; wherein, for each paragraph, perform the attribution operation on the paragraph, such as Figure 4 Shown, including: If the current target document is partially metadata, determine whether the paragraph matches the metadata's signature expression; if so, determine that the paragraph belongs to the metadata, update the last paragraph of the metadata to the paragraph, and end the paragraph attribution operation; if not, set the paragraph as a pending paragraph and update the first count of the accumulated pending paragraphs; If it is determined that the first count does not reach the first threshold, ending the attribution operation on the paragraph; If it is determined that the first count reaches a first threshold, updating the target document portion to the body text, clearing the count, and performing an attribution operation starting from the first paragraph after the last paragraph of the metadata; In the case where the current target document portion is the main text, determining whether the paragraph conforms to the landmark expression of the reference; If the paragraph does not conform to the landmark expression of the reference, then determining that the paragraph conforms to the landmark expression of the main text, updating the last paragraph of the main text to the paragraph, and ending the attribution operation for the paragraph; If the paragraph matches the landmark expression of the reference, the paragraph is determined to be the first paragraph of the reference, the target document portion is updated to the reference, and the attribution operation of the paragraph is completed; If the current target document is partially a reference, determine whether the paragraph meets the landmark expression of the reference; if so, determine that the paragraph belongs to the reference, update the last paragraph of the metadata to the paragraph, and end the attribution operation for the paragraph; if not, set the paragraph as a pending paragraph and update the second count of the accumulated pending paragraphs; If it is determined that the second count does not reach the second threshold and the paragraph is not the last paragraph of the document, then ending the attribution operation for the paragraph; If it is determined that the second count reaches a second threshold or is the last paragraph of the document, all paragraphs after the last paragraph of the reference are taken as paragraphs of metadata.
[0066] It can be seen from the above embodiments that the end of the main text of this application is to find the first paragraph of the reference, and when judging whether a paragraph belongs to the main text, considering that the content of the main text is very changeable and it is impossible to cover all the main text features, the present application adopts an indirect judgment method, that is, if it is found that a paragraph does not conform to the iconic expression of the reference, then the paragraph is considered to belong to the main text. This method can adapt to unknown types of text expressions and improve recognition accuracy.
[0067] Based on the above embodiments, as an optional embodiment, when the current target document portion is a body text, determining that the paragraph meets the iconic expression of the target document portion includes: If it is determined that the text type of the paragraph is a table, then it is determined that the paragraph meets the symbolic expression of the text; If it is determined that the text type of the paragraph is text, then determining whether the text of the paragraph conforms to the iconic expression of the reference; If it is determined that the text of the paragraph does not conform to the iconic expression of the reference, then it is determined that the paragraph conforms to the iconic expression of the main text.
[0068] That is to say, the embodiment of the present application takes into account that in general, tables will not appear in the metadata and reference sections, so the table is used as one of the iconic expressions of the text. If the current target document section is the text, then if the text type of a paragraph is a table, it is determined that the paragraph meets the iconic expression of the text, and it is determined that the paragraph belongs to the text. If the text type of the paragraph is text, that is, the paragraph consists only of text, the document part to which the paragraph belongs is determined by the elimination method: whether the text of the paragraph meets the iconic expression of the reference is judged. If the text of the paragraph does not meet the iconic expression of the reference, it is determined that the paragraph belongs to the text.
[0069] In some embodiments, the iconic expression of a reference includes multiple characteristic words, such as "reference", "references", "Bibliography", etc. When a paragraph contains the above characteristic words, it is determined that the paragraph belongs to a reference.
[0070] Based on the above embodiments, the paragraphs in the embodiments of the present application conform to the iconic expressions of the target document portion, including at least one of the following: The corresponding paragraph includes at least one feature word configured for the target document portion; The corresponding paragraph is at least one feature word configured for the target document portion.
[0071] In the embodiment of the present application, a feature word dictionary can be set for metadata, text and references respectively, and the feature word dictionary includes multiple feature words. By performing word segmentation processing on the paragraph, each word segmentation is searched in the feature word dictionary to see if it exists. If at least one feature word is matched, it is determined that the paragraph has the target document part corresponding to the feature word dictionary. It should be noted that the present application can be further limited to paragraphs with at least one feature word configured for references. If a paragraph only contains feature words for references, such as "references", it can be directly determined that the paragraph is a reference.
[0072] Based on the above embodiments, the embodiment of the present application determines the document part to which each paragraph in the document belongs, paragraph by paragraph, based on the preset symbolic representations of each document part, including: The document to be parsed begins scanning using a top-down, paragraph-by-paragraph scanning strategy, and "Parsing Phase 1" begins (scanning until all paragraphs are scanned or until "Parsing Phase 2" is entered). The current paragraph is temporarily stored in the "Paragraph Collection in the Temporary Storage Area." The system then determines whether the paragraph contains preset metadata feature words and meets feature rules. Feature words and rules can be set in a variety of ways (for example, multiple feature words can be set, and feature rules can include spaces between words, special symbols, etc., supporting greedy calculation). If the judgment is true, the entire paragraph in the temporary storage area is moved to the "Metadata Paragraph Collection," and the current paragraph's sequence number is recorded as the "paragraph sequence number where metadata was last found." If the judgment is false, the count is counted and scanning continues with the next paragraph. If no metadata features are detected for X consecutive times, or if the document is scanned to the end and there are still unprocessed paragraphs in the temporary storage area, the system will start and enter "Parsing Phase 2." If "Parsing Phase 2" is started, the following process is executed: Scan paragraphs from top to bottom starting from the "paragraph number where metadata was last found" (scan until all paragraphs are scanned or enter "Parsing Phase 3"). Determine the paragraph type. If the paragraph is a table type, directly store the paragraph in the "Body Paragraph Collection". If the paragraph is a text type, determine whether it meets the "Reference Section Start Feature". If it does, start and enter "Parsing Phase 3". If it does not, store the current paragraph in the "Body Paragraph Collection". If "Parsing Phase 3" is started, the following process is executed: Scan each paragraph from top to bottom starting from the next paragraph where "Parsing Phase 2" ends (scan until all paragraphs are scanned or enter "Parsing Phase 4"). If it is an empty paragraph, ignore the current paragraph and scan the next paragraph; determine whether the current paragraph meets the reference characteristics. If it does, store the current paragraph in the "Reference Paragraph Collection"; if it does not, perform context association recognition. If any of the subsequent paragraphs meet the reference characteristics, mark all paragraphs from the subsequent paragraph to the current paragraph (including the current paragraph) as unparseable content, and continue scanning from the next paragraph of the subsequent paragraph; if there is no paragraph that meets the reference characteristics in the subsequent paragraph, start and enter "Parsing Phase 4"; If "Parsing Phase 4" is started, the following process is executed: starting from the next paragraph where "Parsing Phase 3" ends, scan each paragraph from top to bottom (scan until all paragraphs are scanned), and save the current paragraph into the "Metadata Paragraph Collection".
[0073] Finally, all footer paragraphs of the document to be parsed are merged into the metadata paragraph set.
[0074] Based on the above embodiments, as an optional embodiment, different parsing priorities are preset for each parser corresponding to the same document portion. For example, the parser used to parse metadata includes at least one of the following parsers, which are sorted in descending order of parsing priority: DOI parser, Chinese title parser, Chinese author parser, Chinese author affiliation parser, Chinese abstract parser, Chinese keyword parser, document identifier parser, China Library Classification Number and Article Number parser, Chinese author profile and corresponding author parser, manuscript receipt date and revision date parser, Chinese funding project parser, English title parser, English author parser, English author affiliation parser, English abstract parser, English keyword parser, English author profile and corresponding author parser, etc. It should be understood that the names of these parsers clearly indicate the text content they parse. For example, the Chinese title parser is used to parse out the Chinese title in the metadata paragraph, the Chinese author profile and corresponding author parser is used to parse out at least one of the Chinese author profile and corresponding author in the metadata paragraph, and the China Library Classification Number and Article Number parser is used to parse out at least one of the China Library Classification Number and article number in the metadata paragraph.
[0075] In some embodiments, the embodiments of the present application can quantify the parsing priority of each parser, so that the parsing priority of each parser can be determined simply by comparing the numerical values. For example, the parsing priority of the DOI parser can be set to 100, the parsing priority of the Chinese title parser to 99, the parsing priority of the Chinese author parser to 95, the parsing priority of the Chinese author unit parser to 90, the parsing priority of the Chinese abstract parser to 89, the parsing priority of the Chinese keyword parser to 80, the parsing priority of the document identifier parser to 70, the parsing priority of the Chinese Library Classification Number and Article Number parser to 65, the parsing priority of the Chinese author profile and corresponding author parser to 55, the parsing priority of the manuscript receipt date and revision date parser to 50, the parsing priority of the Chinese fund project parser to 48, the parsing priority of the English title parser to 48, the parsing priority of the English author parser to 45, the parsing priority of the English author unit parser to 40, the parsing priority of the English abstract parser to 35, the parsing priority of the English keyword parser to 30, the parsing priority of the English author profile and corresponding author parser to 25, etc. It should be noted that the specific numerical values in the above embodiments are only examples.
[0076] It should be understood that each parser has its own way of parsing paragraph content. For example, The DOI parser can parse out the DOI in a paragraph based on feature word matching. When it finds a string containing the feature word "DOI" and zero or more whitespace characters after "DOI", it removes the Chinese and English colons and spaces and extracts "DOI". The Chinese Author Affiliate Parser can parse out the Chinese author units in a paragraph based on feature word matching. For example, it can determine whether the paragraph contains "Chinese and English abstracts," "keywords," and "reference start feature words." The verification document may not contain "Chinese author units." If so, it indicates that the document has no Chinese author units and the parser will be transferred to the next parser for execution. If the previous parser for this paragraph has successfully parsed the "Chinese title" and "Chinese author," and the feature words in the Chinese author unit feature word library exist, the entire paragraph will be identified as "Chinese author units." Author unit parsers for other languages, such as the English author unit parser, have similar logic and will not be detailed here.
[0077] The Chinese summary parser can parse a paragraph's Chinese summary based on feature word matching. For example, it can match the Chinese summary's feature words (if no match is found, it will be passed to the next parser), remove Chinese and English colons and spaces, and extract the content to obtain the Chinese summary. Furthermore, if a paragraph contains only feature words and no other characters, the next paragraph can be directly identified as a Chinese summary and extracted. Summary parsers for other languages, such as the English summary parser, have similar logic and will not be detailed here.
[0078] The document identification code, China Library Classification Number and article number parser (also called encoding parser) can parse the document identification code information, China Library Classification Number information and article number information based on feature word matching. For example, the parser can process the paragraph, remove the left and right spaces, convert several spaces in the middle into one space, and then split the paragraph by the space, match the split content by feature words, and identify the middle part of the two matched feature words as the information corresponding to the previous feature word. If only one feature word is matched, the corresponding information is identified for the latter part of the feature word. If the feature word is matched, the information is extracted and the Chinese and English colons are removed. The Chinese author biography and corresponding author parser parses out the Chinese author biography and corresponding author based on feature word matching. For example, the parser can match the feature words of the Chinese author biography and the Chinese corresponding author separately. If a paragraph contains both feature words, the parser will identify and extract the corresponding feature content in that order. The logic of the English author biography and corresponding author parser is similar and will not be elaborated here.
[0079] The manuscript receipt date and revision date parser can parse out the manuscript receipt date and revision date based on feature word matching. For example, the parser can match the feature words of the manuscript receipt date and revision date respectively (if no match is found, it will be transferred to the next parser), determine whether the paragraph has both the feature words of the revision date and revision date, and identify and extract the corresponding feature content in sequence.
[0080] The embodiment of the present application parses the paragraph according to each parser corresponding to the document portion to which the paragraph belongs, and obtains each text content in the paragraph, including: According to the order of parsing priority from high to low, the parsers are called in sequence to parse the paragraph.
[0081] It should be noted that the result of the parser in the embodiment of the present application can be the execution of the next parser (or the parsing is successful). In this case, it means that the current parser has parsed the corresponding text content in the document, and the next parser can continue to parse it. In some cases, the result of the parser can also be the end of the parsing of the current paragraph or the failure of the parsing. In this case, it is necessary to end the parsing of the current paragraph and parse the next paragraph. It should be noted that parsing errors generally occur when a program error occurs. According to experience, it may be that a special type cannot be recognized normally. For example, the user adds an electronic music file to the document (which belongs to the OLE file type in docx). If the program does not recognize it well, parsing failure may occur.
[0082] In some embodiments, when parsing a document, the number of consecutive parsing failures output by each parser can also be counted. If the number of consecutive parsing failures output by a parser exceeds a preset threshold, it means that the content parsed by the parser has not appeared in many consecutive paragraphs. At this time, the parser can be stopped from being called in the parsing of subsequent paragraphs, thereby improving the overall parsing speed.
[0083] Based on the above embodiments, as an optional embodiment, the type of each parser is a first parser or a second parser; The first parser is configured to no longer participate in parsing subsequent paragraphs after parsing the current paragraph to obtain text content. That is, when the first parser parses a paragraph to obtain text content, the first parser is not called when parsing subsequent paragraphs. The second parser is used to continue parsing subsequent paragraphs after parsing the current paragraph to obtain text content. That is, when the second parser parses a paragraph to obtain text content, the second parser is called when parsing each paragraph after the paragraph.
[0084] The embodiment of the present application divides each parser into a first parser and a second parser, so that after the first parser parses the corresponding text content of a paragraph, it will not participate in the parsing of subsequent paragraphs, which can effectively improve the parsing efficiency.
[0085] See Figure 5, which exemplarily shows a flow chart of an embodiment of the present application for sequentially calling the various parsers to parse a paragraph according to the order of parsing priority from high to low, as shown in the figure, including: S401, using the current reference parser to parse the paragraph to obtain the text content of the paragraph; wherein the first reference parser is the parser with the highest parsing priority; S402: Update the reference parser to the next parser of the current parser according to the order of parsing priority; S403: Determine whether the reference parser is the second parser. If so, execute S401; if not, execute S404. S404: Determine whether the reference parser has obtained the text content when parsing the previous paragraph. If so, execute S405; if not, execute S403. S405 . Update the reference parser to the next parser of the current reference parser according to the order of parsing priority, and return to execute S403 .
[0086] Through the above process, the present application can skip the stage where all first parsers that have obtained parsed content re-parse the paragraphs in the document.
[0087] Based on the above embodiments, as an optional embodiment, the document portion includes metadata, and the text content of the metadata includes document identification code information, China Library Classification Number information, and article number information. Accordingly, the multiple parsers include a coding parser, and the coding parser parses at least one of the document identification code information, China Library Classification Number information, and article number information in the following manner: Identify spaces in a paragraph and their locations, delete spaces on both sides of the paragraph, and reduce consecutive spaces that are not on both sides of the paragraph by one space; Divide the paragraph into multiple text segments according to the updated spaces, and perform feature word matching on each text segment; If there are two first feature words in the text segment, the text between the two first feature words is used as the information corresponding to the first first feature word of the two first feature words, and the text after the second first feature word is used as the information corresponding to the second feature word; If only one first feature word is matched in the text segment, the text following the matched first feature word in the text segment is used as the corresponding information.
[0088] According to the rules of journal literature, the present application embodiment finds that the document identifier information, Chinese Library Classification number information, and article number information usually appear in the same line (paragraph). In order to be able to parse out the above three types of information from a line of content at one time, the present application first needs to identify the spaces in the paragraph and the positions where the spaces are located, and then delete the spaces on both sides of the paragraph, and reduce the consecutive spaces that are not on both sides of the paragraph to one space. For example, a certain paragraph is: Document identifier: A Chinese Library Classification number: B Article number: C (Note that A, B, and C in this paragraph are only for illustration and not real values) Since there are 3 spaces between "A" and "中" in the above paragraph, the 3 spaces are reduced to 1. Similarly, the 3 spaces between "B" and "文" also need to be reduced to 1. Thus, the above paragraph can be split into the following 3 text fragments based on the updated spaces: 1. Document identifier: A 2. Chinese Library Classification number: B 3. Article number: C In order to parse out the document identifier, Chinese Library Classification number, and article number in the paragraph, the present application uses "Document identifier", "Chinese Library Classification number", and "Article number" as feature words, so that the positions of the document identifier information, Chinese Library Classification number information, and article number information in the paragraph can be accurately identified. Specifically, the present application matches each text fragment with the above 3 feature words. If only one feature word is matched in each text fragment, the text after the matched feature word in the text fragment is used as the corresponding text content. For example, for the above text fragment 1, "A" can be identified as the document identifier information. In some cases, there may be two or more feature words in a text fragment. At this time, the present application embodiment uses the text between two adjacent feature words as the text content corresponding to the previous feature word. The present application embodiment finds that in the actual scenario, the author may miss writing at least one of the document identifier information, Chinese Library Classification number information, and article number information. For example, a certain paragraph is: Document identifier <space> Chinese Library Classification number B Article number: C At this time, the text fragment "Document identifier <space> Chinese Library Classification number B" includes two feature words "Document identifier code" and "Chinese Library Classification number". However, since there is no other text between the two feature words, it can be known that the document identifier is missing. However, since there is still text "B" after "Chinese Library Classification number", "B" is parsed as the Chinese Library Classification number information of the text.
[0089] In this embodiment of the application, the three metadata of "Document Identifier Code, China Library Classification Number, and Article Number" can appear in the same paragraph or in different paragraphs, and the time sequence of this information may change. For example, sometimes the "Document Identifier Code" is written first (or in the previous paragraph), and sometimes the "Article Number" is written first. This embodiment of the application provides a method for parsing the three metadata in the same paragraph or in different paragraphs, supporting the following scenarios: Scenario 1. Manuscript received: xx Revision date: xx Scenario 2. Revision Date: xx Received Date: xx Scenario 3. Manuscript received: xx Repair date: xx Scenario 4. Revision Date: xx Date of receipt That is, the order is not affected when they are in the same row, and the order is not affected when they are in different rows.
[0090] Based on the above embodiments, as an optional embodiment, the embodiment of the present application further includes a parser for identifying title information and author information: a title-author parser, which parses the title and author in the document according to the confidence level: Obtaining a first confidence level for parsing the paragraph as title information based on at least one of the number and type of characters in the paragraph and the number of second feature words configured for title information; Obtaining a second confidence level for parsing the paragraph into author information based on at least one of whether a specified symbol exists in the paragraph and the number of third feature words configured for author information; If the first confidence level is higher than the second confidence level, parsing the paragraph into title information; If the first confidence level is lower than the second confidence level, the paragraph is parsed into author information.
[0091] That is to say, when parsing the title information and author information, the embodiment of the present application takes into account the problem that the title information and author information are easily confused in some cases - for example, when "The clarity, coherence and consolidation of Wang Yangming's philosophy of mind" is parsed by existing technology, it is easy to be parsed as author information because the sentence contains a person's name. By calculating the relationship between the confidence levels of whether the paragraph is parsed as title information or author information, the accuracy of the parsing can be significantly improved.
[0092] It should be noted that the title information in the embodiments of this application can be in Chinese or in other languages, such as English, and the author information can be in Chinese or in other languages, such as zhangfutao, Zhang futao, ZHANG Futao, futao-ZHANG, etc., and this embodiment of the application does not make specific restrictions. Precisely because this application does not limit the specific language, the parameters required to calculate the confidence level for author information or title information in different languages may vary.
[0093] Based on the above embodiments, as an optional embodiment, obtaining a first confidence level for parsing the paragraph as title information based on the number and type of characters in the paragraph and the number of second feature words configured for title information includes: Obtaining a first sub-confidence level for parsing the paragraph into title information based on the number of characters and the types of the characters in the paragraph; Counting the number of second feature words in the paragraph, and obtaining a second sub-confidence for parsing the paragraph into title information based on the number, wherein the magnitude of the second sub-confidence is proportional to the number; The first confidence criterion is determined according to at least one of the first sub-confidence criterion and the second sub-confidence criterion.
[0094] Accordingly, obtaining a second confidence level for parsing the paragraph into author information based on at least one of whether a specified symbol exists in the paragraph and the number of third characteristic words configured for author information exists includes: If characters of a specified type exist in the paragraph, a third sub-confidence level for parsing the paragraph as author information is obtained based on whether a discontinuous sequence of digits exists in the paragraph. The paragraph is divided into a plurality of text segments. If a predetermined number of characters in each text segment are third characteristic words, a fourth sub-confidence level for parsing the paragraph as author information is obtained based on the number of third characteristic words present. The second confidence level is obtained based on the sum of the third and fourth sub-confidence levels. If the specified type of characters do not exist in the paragraph, a fifth sub-confidence level for parsing the paragraph as author information is obtained based on the length of the paragraph after deleting the specified characters, and a sixth sub-confidence level for parsing the paragraph as author information is obtained based on whether the first preset number of characters in the paragraph are third characteristic words. The second confidence criterion is determined based on at least the nuclei in the fifth sub-confidence criterion and the sixth sub-confidence criterion.
[0095] The following explains the analysis of the confidence of Chinese titles and Chinese authors.
[0096] If the number of characters in a paragraph exceeds 6 characters and it only contains characters in the specified languages (such as Chinese and English), the confidence level of the paragraph belonging to a Chinese title is increased by 200 points. Moreover, for each occurrence of a characteristic word of a title in the paragraph, the confidence level of parsing the paragraph as title information (hereinafter referred to as the paragraph belonging to title information) is increased by 40 points. Thus, by calculating the first confidence level, and this application also calculates the second confidence level of parsing the paragraph as Chinese author information (hereinafter referred to as the paragraph belonging to Chinese author information) in the following manner; In the case where there are specified symbols (such as spaces, commas, semicolons, etc.) in the paragraph: If multiple names (Chinese authors) of two or more are recognized, the confidence level of the paragraph belonging to a Chinese author is increased by 40 points; If there are multiple non - consecutive Arabic numerals in the text, the confidence level of the paragraph belonging to an author is increased by 40 points; (for example, in this case: Zhang San 1; Li Si 2; Wang Wu 2;) Use the specified symbols to split the text into multiple parts, and check whether the first or the first two Chinese characters of each part are in the "Chinese author characteristic word library". If so, the confidence level of each matched author is increased by 90 points.
[0097] In the case where there are no specified symbols (such as spaces, commas, semicolons, etc.) in the paragraph: Remove symbols such as spaces and parentheses in the text. If the length of the processed text is less than or equal to 4 Chinese characters, the confidence level of the paragraph belonging to a Chinese author is increased by 40 points.
[0098] Check whether the first or the first two Chinese characters of the text are in the "Chinese author characteristic word library". If so, the confidence level of the paragraph belonging to a Chinese author is increased by 100 points; It should be noted that the "Chinese author characteristic word library" mainly consists of the hundred family names and characteristic surnames of ethnic minorities, while the "Chinese title characteristic word library" can include characters and words such as "of", "work", "technology", "development", etc.
[0099] The following uses a specific example to illustrate. A certain paragraph is "Zhang San 1) Li Si 2) Wang Wu 2)", and calculate the author confidence level: The paragraph contains special symbols (spaces and right parentheses), and the author confidence level is increased by 40 points; There are multiple non - consecutive Arabic numerals in the paragraph, and the author confidence level is increased by 40 points; The split parts are: "Zhang San 1", "Li Si 2", "Wang Wu 2". The first Chinese character (Zhang, Li, Wang) of each part is in the Chinese author characteristic word library, and the confidence level of each part of the author is increased by 90 points, totaling 270 points.
[0100] Therefore, this paragraph belongs to the second confidence level of the Chinese author: 40+40+270=350 points.
[0101] Calculate title confidence: If the text is longer than 6 characters and contains only Chinese and English characters, the title confidence score will be increased by 200 points; The text does not contain predefined title feature words.
[0102] Therefore, this paragraph belongs to the first confidence level of the Chinese title: 200 points.
[0103] Since the second confidence score (350 points) is greater than the first confidence score (200 points), the paragraph is finally identified as belonging to the author.
[0104] The confidence rule test data recognition provided by the embodiment of the present application is relatively accurate. In addition to several common scenarios, the following special cases can also be identified. Please refer to Table 1, which shows an example of the score and conclusion table of the special cases identified by the embodiment of the present application. It can be clearly seen from Table 1 that the accuracy of the present application in identifying Chinese titles and Chinese authors is very high, which can meet practical applications.
[0105]
[0106] Table 1 The following explains the analysis of English titles and English author confidence.
[0107] Confidence that the paragraph is parsed as an English title: For each feature word in the "English title feature word library" in a paragraph, the title confidence score increases by 40 points.
[0108] The confidence level of the paragraph being parsed into the English author: Determine if there are special symbols in the text segment (such as spaces, commas, semicolons, etc., in the case of multiple authors). If so, the confidence score for parsing the paragraph as an English author is increased by 40 points; If there are multiple non-consecutive Arabic numerals in the text, the paragraph is interpreted as the English author's confidence score plus 40 points; (for example, in this case: (Zhang san1) Li si2) Wang wu2)) Use special symbols to split the text into several parts. Convert each part to lowercase letters and check whether it is in the "English author feature word library". If it is, the confidence score of parsing the paragraph as an English author is increased by 130 points for each feature word matched. If the part is originally all uppercase English letters, the confidence score of parsing the paragraph as an English author is increased by 170 points. Example: Suppose there is a text paragraph: "Zhang san1) Li si2) Wang wu2)" The confidence that the paragraph is parsed as being written by an English author is: If a paragraph contains special symbols (space, right bracket), the confidence level of the paragraph being parsed as an English author will be increased by 40 points.
[0109] If there are multiple discontinuous Arabic numerals in a paragraph, the confidence level of the paragraph being interpreted as an English author will be increased by 40 points.
[0110] The paragraph is segmented into the following parts: "Zhang", "san1", "Li", "si2", "Wang", and "wu2". Several parts (Zhang, Li, and Wang) are in the "English Author Profile Database". Each part's author confidence score is increased by 130 points, for a total of 390 points.
[0111] Second confidence level: 40 + 40 + 390 = 470 points.
[0112] Confidence calculation for a paragraph being parsed as an English title: Since the text does not contain the predefined title feature words, the first confidence score is 0, so the paragraph is finally parsed as English author information.
[0113] On the basis of the above embodiments, as an optional embodiment, the embodiment of the present application also configures multiple parsers for the main text. In some embodiments, the parsing of each paragraph of the main text may include: a main text title parser, a table parser, a figure sequence and figure title parser, a table sequence and table title parser, a text, a picture and a formula parser, etc. The names of the above parsers can be used to understand the text content parsed by the parser. For example, the main text title parser is used to parse the main text title information and sequence number information in the paragraph, the table parser is used to parse the table in the paragraph, and the figure sequence and figure title parser is used to parse the figure sequence information (the arrangement order number of the figure in the document or report) and figure title information (i.e., the title of the figure) in the paragraph.
[0114] The embodiments of the present application configure multiple parsers for the main text, and there is also a relationship of parsing priority. In some embodiments, the parsing priority of the above parsers is in the following order from high to low: main text title parser, table parser, figure sequence and figure title parser, table sequence and table title parser, text, picture and formula parser.
[0115] In some embodiments, the quantitative value of the parsing priority of the text title parser is 90, the quantitative value of the parsing priority of the table parser is 80, the quantitative value of the parsing priority of the figure sequence and figure title parser is 70, the quantitative value of the parsing priority of the table sequence and table title parser is 15, and the quantitative value of the parsing priority of the text, picture and formula parser is 10.
[0116] Text titles and serial numbers play a crucial role in a document, helping to establish a clear structure and enabling readers to quickly understand the document's hierarchy and main content. Properly designating titles and serial numbers helps guide readers, improving the document's readability and logic. They also facilitate the organization of ideas during the writing process, ensuring the systematic and complete nature of the content.
[0117] The text title parser of the embodiment of the present application parses the paragraph in the following way: If it is determined that the paragraph does not specify a document number according to the preset title style, the body title and serial number of the paragraph are matched in reverse order of the title level.
[0118] It should be noted that titles are usually used in a document in a hierarchical manner, usually including first-level titles, second-level titles, third-level titles, etc., to reflect the logical structure of the content, and use serial numbers such as "I," "(I)," "1.", "(1)" to distinguish titles of different levels.
[0119] In an embodiment of the present application, if a paragraph specifies a document number according to a preset title style (e.g., .docx), the text serial number is matched in a "reverse order matching" manner (6, 5, 4, 3, 2, 1 level titles), and the paragraph is identified as a title of the corresponding level.
[0120] If it is determined that the paragraph is configured with the title style, determine whether the title style is an ordered list of the text content. If it is determined that the preset style is not an ordered list of the text content, parse the paragraph as text title information, and determine the text title and serial number of the paragraph through the title style.
[0121] It should be noted that if a paragraph explicitly specifies a docx title style, it is first determined whether the style is an ordered list of body content. If so, it is transferred to the next parser for parsing; if it is not an ordered list of body content, it is identified as a body title, and the numbering library is maintained at the docx title style level (because docx only marks the style and does not maintain the number, the program cannot directly obtain the body number and can only parse it by itself), and the first-level title is checked to see if it starts numbering from 0.
[0122] In some embodiments, the figure sequence and figure title parser determines whether the paragraph belongs to the figure sequence or figure title based on the "figure sequence feature vocabulary". If it does not, it will flow to the next parser to perform parsing. If it does, it will start parsing and extract and record the figure sequence information and figure title information respectively; the situation of multiple figure titles for a single figure sequence is identified. When the font size of the current paragraph is inconsistent with the font size of the text, and the previous paragraph is the figure sequence and figure title, the current paragraph is identified as the second figure title.
[0123] Figure 6A structural diagram of a document parsing system provided for an embodiment of the present application, as shown in the figure, the embodiment of the present application first performs structural parsing on the document, and the structural parsing process includes 3 or 4 parsing stages: Parsing stage 1: responsible for locating and segmenting the metadata part of the document; Parsing stage 2: responsible for locating and segmenting the main text part of the document; Parsing stage 3: responsible for locating and segmenting the reference part of the document; Parsing stage 4: mainly responds to the scenario where there is English metadata after the reference. Generally, this stage may not be executed according to the actual content of the file to be typeset. Afterwards, for each document part, the parser loader can load the parser set corresponding to the corresponding document part. A parser Each parser in the collection corresponds to the same document part and is used to parse out the corresponding text content in the paragraph. The parser execution scheduler can call each parser in the parser collection in sequence according to the preset order to obtain the text content in each paragraph. When each parser uses the parsing rules to parse the paragraph, it also requires a preset analysis tool. For example, when the Chinese title parser parses the Chinese title in the paragraph, it will use the Chinese title author analyzer. The Chinese title author analyzer includes a title dictionary, a surname dictionary and a confidence scorer. The title dictionary includes feature words representing the title, and the surname dictionary includes feature words for Chinese surnames.
[0124] The embodiment of the present application can identify documents as "metadata section", "text section", and "reference section". This method does not rely on specific styles and can also identify document texts without any format. The embodiment of the present application first structures the document into multiple parts, and then scans each part from top to bottom and section by section, submitting it to a preset parser for parsing and identification. The entire process is efficient and convenient, with no repeated operations and no performance loss. The execution process is fast, and the total time taken does not exceed 5 seconds. After verification, this application is significantly faster than the time taken by competing products (3-6 minutes).
[0125] The embodiment of the present application provides a document parsing device, such as Figure 7 As shown, the document parsing device may include: a document acquisition module 701, a text portion determination module 702, a parser loading module 703 and a parsing module 704, wherein: The document acquisition module 701 is used to acquire the document to be parsed; A text part determination module 702 is configured to determine the document part to which each paragraph in the document belongs, paragraph by paragraph, based on a preset symbolic representation for each document part; The parser loading module 703 is used to load multiple parsers; each parser corresponds to a document part and a text content, and is used to parse the corresponding text content in the corresponding document part according to the corresponding parsing rules; The parsing module 704 is used to parse the document paragraph by paragraph using the multiple parsers, wherein for each paragraph, the paragraph is parsed according to at least one parser among the parsers corresponding to the document part to which the paragraph belongs to obtain the text contents in the paragraph.
[0126] The device of the embodiment of the present application can execute the method provided by the embodiment of the present application, and its implementation principle is similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, and will not be repeated here.
[0127] The embodiments of the present application can be used to provide underlying support for the following scenarios: a) Based on the extracted journal metadata, supplement and improve the metadata of Chinese journals to improve information retrieval efficiency, promote knowledge discovery, and facilitate document management; b) Automatically generate a table of contents for journal articles based on the structured information of the text title to improve readers' reading efficiency; c) Reorganize structured information and complete automatic typesetting, reducing the manual workload generated by hundreds of editing requirements to meet national standards; d) A large amount of structured information is conducive to in-depth statistical analysis of Chinese journal data and facilitates data mining and analysis; e) Structured data can be processed secondary, such as translated, to facilitate cross-language retrieval and promote international academic exchanges.
[0128] In an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the steps of the document parsing method. Compared with the related art, the following can be achieved: by first determining the document part to which each paragraph in the document belongs according to the preset iconic expressions for each document part, thereby laying the foundation for the subsequent targeted parsing of each paragraph with each parser of the document part. For each document part, at least one parser of the document part is used to parse each paragraph of the document part one by one, and each parser performs its own function in the form of a pipeline until the parsing is successful. The architecture adopts a modular and plug-in design concept, which not only simplifies the document content recognition process, but also improves the scalability of the system, making it more flexible.
[0129] In an alternative embodiment, an electronic device is provided, such as Figure 8 As shown, Figure 8The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which may be used for data exchange between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the number of transceivers 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0130] Processor 4001 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0131] Bus 4002 may include a path for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, for example. Bus 4002 may be divided into an address bus, a data bus, a control bus, and so on. For ease of illustration, bus 4002 is represented by a single thick line in the figure, but this does not indicate that there is only one bus or only one type of bus.
[0132] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.
[0133] The memory 4003 is used to store the computer program for executing the embodiment of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the above method embodiment.
[0134] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented.
[0135] An embodiment of the present application also provides a computer program product, including a computer program, which can implement the steps and corresponding contents of the aforementioned method embodiment when executed by a processor.
[0136] In the specification and claims of this application and the accompanying drawings, the terms "first," "second," "third," "fourth," "1," "2," and so on (if any) are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, such that the embodiments of the present application described herein can be practiced in an order other than that shown or described.
[0137] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the order of implementation of these steps is not limited to the order indicated by the arrows. Unless otherwise clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart can include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage in these sub-steps or stages can also be executed at different times respectively. Under different scenarios at the execution time, the execution order of these sub-steps or stages can be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0138] The above description is only an optional implementation method for some implementation scenarios of this application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of this application, the use of other similar implementation methods based on the technical ideas of this application also falls within the protection scope of the embodiments of this application.
Claims
1. A document parsing method, characterized in that: include: Get the document to be parsed; Determining the document section to which each paragraph in the document belongs, paragraph by paragraph, based on a predetermined symbolic representation for each document section; Load multiple parsers; each parser corresponds to a document part and a text content, and is used to parse the corresponding text content in the corresponding document part according to the corresponding parsing rules; The document is parsed paragraph by paragraph by the multiple parsers, wherein for each paragraph, the paragraph is parsed according to at least one parser among the parsers corresponding to the document part to which the paragraph belongs, to obtain the text contents in the paragraph.
2. The method according to claim 1, characterized in that The document includes a plurality of document parts having a sequential relationship; The step of determining the document part to which each paragraph in the document belongs, paragraph by paragraph, based on the preset symbolic representations of each document part, includes: Performing a document part attribution operation on the document paragraph by paragraph to determine the document part to which each paragraph belongs; wherein, for each paragraph, performing the attribution operation on the paragraph includes: Determine the current target document part, wherein the target document part of the first paragraph is the first document part; If it is determined that the paragraph matches the landmark expression of the target document part, then determining that the document part to which the paragraph belongs is the target document part, updating the last paragraph of the target document part to the paragraph, and keeping the current target document part unchanged, thereby ending the attribution operation for the current paragraph; If it is determined that the paragraph does not conform to the landmark expression of the target document part, the paragraph is treated as a pending paragraph and the accumulated count of pending paragraphs is updated; if it is determined that the count reaches a preset threshold or the paragraph is the last paragraph of the document, the next document part of the current target document part is treated as the new target document part, and the count is cleared to start from the first paragraph after the last paragraph of the current target document part and re-execute the attribution operation based on the new target document part.
3. The method according to claim 1 or 2, characterized in that The document includes a plurality of document parts having a sequential relationship, and the types of the document parts include metadata, text and references; The step of determining the document part to which each paragraph in the document belongs, paragraph by paragraph, based on the preset symbolic representations of each document part, includes: Initializing a target document portion as metadata, and performing a document portion attribution operation on the document paragraph by paragraph to determine the document portion to which each paragraph belongs; wherein performing the attribution operation on each paragraph includes: If the current target document is partially metadata, determine whether the paragraph matches the metadata's signature expression; if so, determine that the paragraph belongs to the metadata, update the last paragraph of the metadata to the paragraph, and end the paragraph attribution operation; if not, set the paragraph as a pending paragraph and update the first count of the accumulated pending paragraphs; If it is determined that the first count does not reach the first threshold, ending the attribution operation on the paragraph; If it is determined that the first count reaches a first threshold, updating the target document portion to the body text, clearing the count, and performing an attribution operation starting from the first paragraph after the last paragraph of the metadata; In the case where the current target document portion is the main text, determining whether the paragraph conforms to the landmark expression of the reference; If the paragraph does not conform to the landmark expression of the reference, then determining that the paragraph conforms to the landmark expression of the main text, updating the last paragraph of the main text to the paragraph, and ending the attribution operation for the paragraph; If the paragraph matches the landmark expression of the reference, the paragraph is determined to be the first paragraph of the reference, the target document portion is updated to the reference, and the attribution operation of the paragraph is completed; If the current target document is partially a reference, determine whether the paragraph meets the landmark expression of the reference; if so, determine that the paragraph belongs to the reference, update the last paragraph of the metadata to the paragraph, and end the attribution operation for the paragraph; if not, set the paragraph as a pending paragraph and update the second count of the accumulated pending paragraphs; If it is determined that the second count does not reach the second threshold and the paragraph is not the last paragraph of the document, then ending the attribution operation for the paragraph; If it is determined that the second count reaches a second threshold or is the last paragraph of the document, all paragraphs after the last paragraph of the reference are taken as paragraphs of metadata.
4. The method according to claim 2 or 3, characterized in that The plurality of document parts having a sequential relationship include metadata, text and references in sequence; In the case where the current target document portion is a body text, determining that the paragraph conforms to the landmark expression of the target document portion includes: If it is determined that the text type of the paragraph is a table, then it is determined that the paragraph meets the symbolic expression of the text; If it is determined that the text type of the paragraph is text, then determining whether the text of the paragraph conforms to the iconic expression of the reference; If it is determined that the text of the paragraph does not conform to the iconic expression of the reference, then it is determined that the paragraph conforms to the iconic expression of the main text.
5. The method according to claim 2 or 3, characterized in that The paragraph meets the characteristic description of the target document section, including at least one of the following: The corresponding paragraph includes at least one feature word configured for the target document portion; The corresponding paragraph is at least one feature word configured for the target document portion.
6. The method according to claim 2, characterized in that The plurality of document parts having a sequential relationship include metadata, text and references in sequence; In the case that the current target document portion is a reference document, taking the next document portion of the target document portion as a new target document portion includes: The metadata is used as part of the new target document.
7. The method according to claim 1, characterized in that Different parsers corresponding to the same document part have different parsing priorities preset; Parsing the paragraph according to each parser corresponding to the document part to which the paragraph belongs to obtain each text content in the paragraph includes: According to the order of parsing priority from high to low, the parsers are called in sequence to parse the paragraph.
8. The method according to claim 7, characterized in that Each parser is of type either a first parser or a second parser; Wherein, when the first parser parses a paragraph to obtain text content, the first parser is not called when parsing each paragraph after the paragraph; When the second parser parses a paragraph to obtain text content, the second parser is called when parsing each paragraph after the paragraph.
9. The method according to claim 1, characterized in that The document portion includes metadata, and the text content of the metadata includes at least one of document identification code information, Chinese Library Classification Number information, and article number information; The multiple parsers include an encoding parser, which parses the paragraph in the following manner: identifying spaces in the paragraph, and dividing the paragraph into multiple text segments based on the spaces; Performing word segmentation on each text segment and matching the word segmentation result with a first feature word, wherein the first feature word includes at least one of a document identifier, a Chinese Library Classification Number, and an article number; If there are two first feature words in the text segment, the text between the two first feature words is used as the information corresponding to the first first feature word of the two first feature words, and the text after the second first feature word is used as the information corresponding to the second feature word; If only one first feature word is matched in the text segment, the text following the matched first feature word in the text segment is used as the corresponding information.
10. The method according to claim 1, characterized in that The document portion includes metadata, wherein text content of the metadata includes at least one of title information and author information; The multiple parsers include a title author parser, which parses the paragraph in the following manner: Obtaining a first confidence level for parsing the paragraph as title information based on at least one of the number and type of characters in the paragraph and the number of second feature words configured for title information; Obtaining a second confidence level for parsing the paragraph into author information based on at least one of whether a specified symbol exists in the paragraph and the number of third feature words configured for author information; If the first confidence level is higher than the second confidence level, parsing the paragraph into title information; If the first confidence level is lower than the second confidence level, the paragraph is parsed into author information.
11. The method according to claim 10, characterized in that Obtaining a first confidence level for parsing the paragraph into title information based on the number and type of characters in the paragraph and the number of second feature words configured for title information includes: Obtaining a first sub-confidence for parsing the paragraph into title information based on the number of characters and the type of each character in the paragraph; Counting the number of second feature words in the paragraph, and obtaining a second sub-confidence for parsing the paragraph into title information based on the number, wherein the magnitude of the second sub-confidence is proportional to the number; The first confidence criterion is determined according to at least one of the first sub-confidence criterion and the second sub-confidence criterion.
12. The method according to claim 10, characterized in that Obtaining a second confidence level for parsing the paragraph into author information based on at least one of whether a specified symbol exists in the paragraph and the number of third feature words configured for author information includes: If characters of a specified type exist in the paragraph, a third sub-confidence level for parsing the paragraph as author information is obtained based on whether a discontinuous sequence of digits exists in the paragraph. The paragraph is divided into a plurality of text segments. If a predetermined number of characters in each text segment are third characteristic words, a fourth sub-confidence level for parsing the paragraph as author information is obtained based on the number of third characteristic words present. The second confidence level is obtained based on the sum of the third and fourth sub-confidence levels. If the specified type of characters do not exist in the paragraph, a fifth sub-confidence level for parsing the paragraph as author information is obtained based on the length of the paragraph after deleting the specified characters, and a sixth sub-confidence level for parsing the paragraph as author information is obtained based on whether the first preset number of characters in the paragraph are third characteristic words. The second confidence criterion is determined based on at least the nuclei in the fifth sub-confidence criterion and the sixth sub-confidence criterion.
13. The method according to claim 1, wherein The document part includes a body text, and the text content of the body text includes body text title information and serial number information; The multiple parsers include a text title parser, which parses paragraphs in the following manner: If it is determined that the paragraph does not have a document number assigned according to the preset title style, then matching the body title and serial number of the paragraph in reverse order of the title level; If it is determined that the paragraph is configured with the title style, determine whether the title style is an ordered list of the text content. If it is determined that the preset style is not an ordered list of the text content, parse the paragraph as text title information, and determine the text title and serial number of the paragraph through the title style.
14. A document parsing device, characterized in that: include: Document acquisition module, used to obtain the document to be parsed; a text part determination module, configured to determine, paragraph by paragraph, the document part to which each paragraph in the document belongs based on a preset symbolic representation for each document part; A parser loading module is used to load multiple parsers; each parser corresponds to a document part and a text content, and is used to parse the corresponding text content in the corresponding document part according to the corresponding parsing rules; A parsing module is used to parse the document paragraph by paragraph using the multiple parsers, wherein for each paragraph, the paragraph is parsed according to at least one parser among the parsers corresponding to the document part to which the paragraph belongs to obtain the text content in the paragraph.
15. An electronic device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the document parsing method according to any one of claims 1 to 13.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the document parsing method according to any one of claims 1 to 13 is implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the document parsing method according to any one of claims 1 to 13 is implemented.