Document content segmentation method, device and equipment based on document title hierarchical structure

By using a method based on the hierarchical structure of document titles, we solve the problems of incomplete document segmentation and high training costs in the existing technology, achieve simple and efficient document segmentation, adapt to the needs of different industry types, and ensure the retention of semantic information. and the accuracy of segmentation results.

CN118734795APending Publication Date: 2024-10-01DATAGRAND TECH INC
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202410815757.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing document slicing method based on fixed length cannot guarantee semantic integrity. Deep learning technology requires high-cost text annotation and training, and may need to be retrained on documents of different industry types, resulting in complex and inconsistent slicing methods. flexible.

Method used

Using a method based on the document title hierarchical structure, by obtaining the document name, hierarchical document title and paragraph in the document, determine the relationship between the paragraph and the title, segment according to the preset conditions, and update the segmentation result if it is not met to ensure segmentation Semantic integrity of the results.

Benefits of technology

It implements an unsupervised and simple segmentation method, retains semantic information to the greatest extent, quickly determines the semantics of segmentation results, adapts to the document segmentation needs of different industry types, and reduces training costs and complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734795A_ABST
    Figure CN118734795A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a document content segmentation method, device and equipment based on a document title hierarchical structure. The method comprises the steps of obtaining a to-be-segmented document, and identifying a document name, a document title of each level and a document paragraph in the to-be-segmented document; determining a document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document; according to a previous segmentation result of the to-be-segmented document, the current document paragraph and a next document paragraph, determining whether the current document paragraph meets a preset segmentation condition or not; if yes, updating the current document paragraph and the next document paragraph to continue judgment; and if not, generating a current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding document title set. According to the method, the segmentation mode is simple and convenient, the semantic integrity of the segmented fragments can be guaranteed, semantic information is reserved to the maximum extent, and the semantics of the segmentation result can be rapidly determined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a document content segmentation method, device and equipment based on a document title hierarchical structure. Background Art

[0002] With the popularity of question-and-answer applications based on large language models, more and more users are asking questions based on large language models by uploading one or more documents. When responding, the large language model needs to locate the semantic fragments related to the question in the document before answering. Therefore, it is crucial to segment the document.

[0003] In the prior art, a document slicing method based on a fixed length is usually adopted, which cannot guarantee the semantic integrity of the segmented segments and often cuts off sentences, resulting in the segmented segments being unable to contain complete semantics.

[0004] To improve the above document segmentation method, deep learning technology can also be used to semantically segment documents. However, semantic segmentation of documents based on deep learning technology requires high-cost text annotation and training, and the document segmentation method is complicated. In addition, when the industry type of the document is different, retraining may be required. Summary of the invention

[0005] The present invention provides a document content segmentation method, device and equipment based on the document title hierarchical structure, so as to segment the document in a simple segmentation manner and retain the complete semantic information to the greatest extent.

[0006] According to one aspect of the present invention, a document content segmentation method based on a document title hierarchical structure is provided, the method comprising:

[0007] Obtaining a document to be segmented, and identifying a document name, document titles at each level, and document paragraphs in the document to be segmented;

[0008] Determine a document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document;

[0009] The document title set includes the document name and the document titles of each level corresponding to the document paragraphs;

[0010] Determine whether the current document paragraph meets the preset slicing condition according to the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph;

[0011] If yes, then update the current document paragraph and the next document paragraph, and return to the step of determining whether the current document paragraph meets the preset slicing condition based on the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph;

[0012] If not, the current segmentation result is generated according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set.

[0013] According to another aspect of the present invention, there is provided a document content segmentation device based on a document title hierarchical structure, the device comprising:

[0014] A content identification module is used to obtain the document to be segmented, and identify the document name, document titles at each level, and document paragraphs in the document to be segmented;

[0015] A document title set determination module, used to determine the document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document;

[0016] The document title set includes the document name and the document titles of each level corresponding to the document paragraphs;

[0017] The condition judgment module is used to determine whether the current document paragraph meets the preset slicing condition according to the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph;

[0018] A loop judgment module is used to update the current document paragraph and the next document paragraph if the current document paragraph meets the preset slicing condition, and return to the step of determining whether the current document paragraph meets the preset slicing condition based on the previous segmentation result of the document to be segmented, the current document paragraph and the next document paragraph;

[0019] The current segmentation result generating module is used to generate the current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding document title set if the current document paragraph does not meet the preset segmentation condition.

[0020] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0021] at least one processor; and

[0022] a memory communicatively connected to the at least one processor; wherein,

[0023] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the document content segmentation method based on the document title hierarchy structure described in any embodiment of the present invention.

[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the document content segmentation method based on the document title hierarchy structure described in any embodiment of the present invention when executed.

[0025] According to another aspect of the present invention, a computer program product is provided, including a computer program, which, when executed by a processor, implements the document content segmentation method based on the document title hierarchy structure described in any embodiment of the present invention.

[0026] The technical solution of the embodiment of the present invention obtains the document to be segmented, and identifies the document name, document titles of each level, and document paragraphs in the document to be segmented; determines the document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document; wherein the document title set includes the document name and the document titles of each level corresponding to the document paragraph; determines whether the current document paragraph meets the preset slicing condition according to the previous segmentation result of the document to be segmented, the current document paragraph, and the next document paragraph; if so, updates the current document paragraph and the next document paragraph, and returns to the step of determining whether the current document paragraph meets the preset slicing condition according to the previous segmentation result of the document to be segmented, the current document paragraph, and the next document paragraph; if not, generates the current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set, thereby solving the document segmentation problem, ensuring the semantic integrity of the segmented segments through an unsupervised and simple segmentation method, retaining the semantic information to the greatest extent, and facilitating the rapid determination of the semantics of the segmentation result.

[0027] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0029] Figure 1 is a flowchart of a document content segmentation method based on a document title hierarchical structure provided according to Embodiment 1 of the present invention;

[0030] Figure 2 This is a schematic diagram of a document structure provided according to Embodiment 1 of the present invention;

[0031] Figure 3 This is a document segmentation flow chart provided according to the first embodiment of the present invention;

[0032] Figure 4 is a schematic diagram of table processing provided according to the first embodiment of the present invention;

[0033] Figure 5 is a flowchart of a document content segmentation method based on a document title hierarchical structure provided according to a second embodiment of the present invention;

[0034] Figure 6 is a structural schematic diagram of a document content segmentation device based on a document title hierarchical structure provided according to a third embodiment of the present invention;

[0035] Figure 7 It is a structural schematic diagram of an electronic device for implementing the document content segmentation method based on the document title hierarchical structure according to an embodiment of the present invention. DETAILED DESCRIPTION

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

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

[0038] Embodiment 1

[0039] Figure 1This is a flowchart of a document content segmentation method based on a document title hierarchy structure provided according to the first embodiment of the present invention. This embodiment is applicable to the situation of conducting question and answer based on a document. The method can be executed by a document content segmentation device based on a document title hierarchy structure. The document content segmentation device based on a document title hierarchy structure can be implemented in the form of hardware and / or software. The document content segmentation device based on a document title hierarchy structure can be configured in an electronic device such as a computer or a smart terminal. Figure 1 As shown, the method includes:

[0040] Step 110: Obtain the document to be segmented, and identify the document name, document titles at each level, and document paragraphs in the document to be segmented.

[0041] In practice, a document usually has a certain semantic structure. Figure 2 Schematic diagram of a document structure provided according to the first embodiment of the present invention. Figure 2 As shown, the document includes multiple levels of titles. Exemplarily, in a chapter of the document, a level 1 title, a level 2 title, a level 3 title, and a level 4 title may be included.

[0042] In the embodiment of the present invention, the title can be used as a summary of the paragraph content. The document name can be used as the parent title of all level 1 titles in each chapter of the document. When identifying the document to be segmented, the document name, the document titles of each level, and the document paragraphs in the document to be segmented can be determined according to the location of the text in the document, the set format information, etc.

[0043] For example, for a document with a table of contents, the document titles at each level can be determined based on the table of contents information in the document. In the body of a document, the content between two document titles can be considered as document paragraphs. The document name can be determined based on the naming of the document, or the document name can be a text that meets the specified format requirements at a specified location in the document.

[0044] For another example, for a document without a table of contents, the document titles at each level can be determined based on the position in the document, font size, and preset identifiers. Figure 2 As shown, a Level 1 title can be left-aligned in the document, with a font size of 3, and have chapter identifiers such as "1", "2", etc. A Level 2 title can be left blank for 2 characters in the first line of the document, with a font size of 4, and have chapter identifiers such as "1.1", "2.1", or "2.2", etc.

[0045] Step 120: Determine a document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document.

[0046] The document title set includes the document name and document titles at various levels corresponding to the document paragraphs.

[0047] For example, the document title set may be composed of all levels of document titles from the chapter where the document paragraph is located to the first-level title of the chapter, and the document name. Figure 2 As shown, the current segmentation result includes the paragraph content under "2.1 Level 2 Title". The document title set corresponding to the paragraph content may include: "Document Name", "2 Level 1 Title" and "2.1 Level 2 Title". For another example, the current segmentation result includes the paragraph content under "1.1.1.1 Level 4 Title", the document title set corresponding to the paragraph content may include: "Document Name", "1 Level 1 Title", "1.1 Level 2 Title", "1.1.1 Level 3 Title", and "1.1.1.1 Level 4 Title".

[0048] Alternatively, the document title set may consist of all document titles preceding the section in which the document paragraph is located, and the document name. Figure 2 As shown, the current segmentation result includes the paragraph content under "2.1 Level 2 Title". Then the document title set corresponding to the paragraph content may include: "Document Name", "1 Level 1 Title", "1.1 Level 2 Title", "1.1.1 Level 3 Title", "1.1.1.1 Level 4 Title", "1.1.2 Level 3 Title", "1.1.2.1 Level 4 Title", "1.1.2.2 Level 4 Title", "1.1.3 Level 3 Title", "1.1.4 Level 3 Title", "1.2 Level 2 Title", "1.2.1 Level 3 Title", "1.2.2 Level 3 Title", "1.3 Level 2 Title", "2 Level 1 Title" and "2.1 Level 2 Title".

[0049] In an embodiment of the present invention, by determining a document title set for a document and adding titles of each level to the segmentation results during document segmentation, the segmentation results can have summary content, so that the large language model can quickly determine the semantics of the paragraph content during training and prediction, so as to perform rapid question-and-answer responses.

[0050] Step 130: Determine whether the current document paragraph meets the preset slicing condition according to the previous slicing result of the document to be segmented, the current document paragraph, and the next document paragraph.

[0051] The current document paragraph of the current segmentation can be determined based on the previous segmentation result. For example, the paragraph after the previous segmentation result can be used as the current document paragraph. When the document to be segmented is initially segmented, the previous segmentation result can be empty; at this time, the current document paragraph can be determined by searching the paragraph content from the first level title, the second level title, the third level title, etc. according to the document name.

[0052] The next document paragraph may be the paragraph next to the current document paragraph. When the current document paragraph is the last paragraph of the document to be segmented, the next document paragraph may be empty.

[0053] The current document paragraph meeting the preset slicing condition may mean that the current slice length meets the preset slice length requirement. Alternatively, the current document paragraph meeting the preset slicing condition may mean that the number of current slice paragraphs meets the preset slice paragraph number requirement. Alternatively, the current document paragraph meeting the preset slicing condition may mean that the paragraph contents in the current slice are all located under the same preset document title.

[0054] The preset document title may be the lowest document title to which the first paragraph content in the current segment paragraph belongs. Figure 2 As shown, the first paragraph content in the current segmented paragraph is the paragraph content under "2.1 Level 2 Title", and the preset document title can be "2.1 Level 2 Title". That is, all the paragraph content under "2.1 Level 2 Title" and the corresponding document title set can be segmented to generate the current segmentation result.

[0055] In an optional implementation of an embodiment of the present invention, whether the current document paragraph meets the preset slicing conditions is determined based on the previous segmentation result of the document to be segmented, the current document paragraph and the next document paragraph, including: when the paragraph content from the previous segmentation result to the current document paragraph and the corresponding document title set are less than or equal to the preset slicing length, it is determined that the current document paragraph meets the preset slicing conditions.

[0056] The paragraph contents from the previous segmentation result to the current document paragraph and the corresponding document title set may refer to: all paragraph contents from the previous segmentation result to the current document paragraph, and the document title set corresponding to each paragraph content. In order to reduce the redundancy of the document title set, the duplicate titles in the document title set may be removed. Alternatively, only the document title set of the current document paragraph may be selected as the document title set corresponding to the paragraph contents from the previous segmentation result to the current document paragraph.

[0057] In the embodiment of the present invention, the length of a Chinese character or an English word can be defined as a length.

[0058] Step 140: Update the current document paragraph and the next document paragraph.

[0059] When the current document paragraph meets the preset slicing condition, the current document paragraph and the next document paragraph may be updated. Specifically, updating the current document paragraph and the next document paragraph may include: updating the next document paragraph to the current document paragraph; and updating the next document paragraph to the next document paragraph corresponding to the current document paragraph. Return to step 130 to continue judging and determine whether the current document paragraph meets the preset slicing condition.

[0060] Step 150: Generate a current segmentation result based on the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set.

[0061] In an embodiment of the present invention, when the current document paragraph does not meet the preset slicing condition, the current slicing result can be generated according to the paragraph content between the previous slicing result and the previous document paragraph of the current document paragraph, and the corresponding document title set. At this time, document slicing based on the paragraph content between the previous slicing result and the previous document paragraph is the slicing method that best meets the preset slicing condition.

[0062] Specifically, Figure 3 1 is a flow chart of document segmentation provided according to the first embodiment of the present invention. Figure 3 As shown, paragraph recognition can be performed on the document to be segmented. According to the previous segmentation result of the document to be segmented, locate the current paragraph. Use the preset slice length to start intercepting from the current paragraph. If the current paragraph and the corresponding document title set are less than or equal to the preset slice length, update the next paragraph to the current paragraph and continue intercepting. If the current paragraph and the corresponding document title set are greater than the preset slice length, delete the paragraph content of the latest paragraph and the corresponding document title set to generate the current segmentation result. That is, when the current paragraph and the corresponding document title set are greater than the preset slice length, the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set are used to generate the current segmentation result.

[0063] After generating the current segmentation result, determine whether the segmentation process of the document to be segmented is complete. If the document to be segmented is not complete, update the current segmentation result to the previous segmentation result, and return to locate the current paragraph based on the previous segmentation result of the document to be segmented; determine whether the current document paragraph meets the preset segmentation condition step based on the previous segmentation result of the document to be segmented, the current document paragraph, and the next document paragraph.

[0064] In an embodiment of the present invention, it is determined whether the current document paragraph meets the preset slicing condition based on the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph; and when the current document paragraph does not meet the preset slicing condition, the current slicing result is generated based on the paragraph content between the previous slicing result and the previous document paragraph of the current document paragraph, and the corresponding document title set. Since the preset slicing condition is judged on the current document paragraph, it can be ensured that the segmentation results generated by the segmentation meet the preset slicing condition. Moreover, the richest segmentation results can be generated as much as possible on the basis of satisfying the preset slicing condition. When the current document paragraph does not meet the preset slicing condition, the slicing result is generated by using the previous document paragraph, which can ensure that the generated segmentation result can meet the semantic integrity.

[0065] Based on the above implementation, optionally, the method further includes: when responding to a user request and determining the response content that matches the user request, determining a target segmentation result among the segmentation results based on the correlation between the response content and each segmentation result; and displaying the response content and the target segmentation result.

[0066] In a specific application scenario, a user request may be a question based on a large language model. The response content may be a reply to a user request such as a question. When a user asks a question, a document to be segmented may be given a large language model. Alternatively, the large language model may obtain the document to be segmented in a database based on the user's question. In an electronic device such as a computer, the document to be segmented may be segmented based on the document segmentation method provided in an embodiment of the present invention to obtain a corresponding segmentation result. The electronic device may search for answers in the segmentation results in response to the user's question based on the large language model to determine the response content. The large language model usually determines the response content based on the segmentation result of the document to be segmented. Therefore, when responding, the electronic device may determine the target segmentation result based on the correlation between the response content and the segmentation result.

[0067] The relevance between the response content and the segmentation result can be determined by the electronic device based on character similarity. Alternatively, it can be directly given by the large language model. When displaying the response content, the electronic device can also display the target segmentation result, so that the user can obtain relevant original information on the basis of obtaining the answer to the question, so as to fully understand the question.

[0068] In an optional implementation of an embodiment of the present invention, when a document paragraph includes a picture, the picture title is used as an item in the document title set; when a document paragraph includes a table, the table title is used as an item in the document title set, the text in the table is used as the paragraph content of the document paragraph, and the numbers in the table are stored.

[0069] In practical applications, the documents to be segmented usually include images, tables and other contents. In actual research, the inventors found that images have little effect on document-based question and answer. Therefore, in an embodiment of the present invention, when a document paragraph includes an image, the image title is used as an item in the document title set. The image itself can be deleted. Alternatively, the image can be saved in a database. When the image title is included in the target segmentation result, the image can be obtained from the database according to the image title and displayed.

[0070] In actual research, the inventors also found that most of the contents in the table are data, while question matching and answer search in large language model question and answer mainly rely on text information, and numbers play a relatively small role. Therefore, when a document paragraph includes a table, the table title can be used as an item in the document title set, the text in the table can be used as the paragraph content of the document paragraph, and the numbers in the table can be stored. When processing the table, the table format can be converted first. For example, the table can be converted to plain text format. When segmenting the document to be segmented, only the table title and table text are retained. For example, Figure 4 1 is a schematic diagram of table processing provided according to the first embodiment of the present invention. Figure 4 As shown, during the processing, the text in the table can be retained in plain text format; the numbers in the table can be removed. The numbers in the table can be stored in the database based on the row and column position information.

[0071] Optionally, when the target segmentation result includes a table, the response content and the target segmentation result are displayed, including: determining the target table number corresponding to the target table title based on the target table title in the target segmentation result; forming a target table based on the target table number, and the target table title and target table text in the target segmentation result; and displaying the response content, the target table, and the non-table content in the target segmentation result.

[0072] When forming a target table based on the target table numbers, and the target table titles and target table text in the target segmentation results, the target table numbers and target table text can be arranged according to the row and column position information.

[0073] By performing special processing on images and tables, they can be segmented and processed in a unified manner like paragraph text, while ensuring that the images and tables can be traced back to the original document fragment content.

[0074] The technical solution of this embodiment obtains the document to be segmented, and identifies the document name, document titles of each level, and document paragraphs in the document to be segmented; determines the document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document; wherein the document title set includes the document name and the document titles of each level corresponding to the document paragraph; determines whether the current document paragraph meets the preset slicing condition according to the previous segmentation result of the document to be segmented, the current document paragraph, and the next document paragraph; if so, updates the current document paragraph and the next document paragraph, and returns to the step of determining whether the current document paragraph meets the preset slicing condition according to the previous segmentation result of the document to be segmented, the current document paragraph, and the next document paragraph; if not, generates the current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set, thereby solving the document segmentation problem, and ensuring the semantic integrity of the segmented segments through an unsupervised and simple segmentation method, retaining the semantic information to the greatest extent, which is conducive to quickly determining the semantics of the segmentation result.

[0075] Embodiment 2

[0076] Figure 5 1 is a flowchart of a document content segmentation method based on a document title hierarchical structure provided according to Embodiment 2 of the present invention. This embodiment is a further refinement of the above technical solution. The technical solution in this embodiment can be combined with each optional solution in one or more of the above embodiments. Figure 5 As shown, the method includes:

[0077] Step 510: Obtain the document to be segmented, and identify the document name, document titles at each level, and document paragraphs in the document to be segmented.

[0078] Step 520: Determine a document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document.

[0079] The document title set includes the document name and document titles at various levels corresponding to the document paragraphs.

[0080] In an optional implementation of the embodiment of the present invention, a document title set corresponding to each document paragraph is determined according to the chapter position of each document paragraph in the document, including: determining a first document title set consisting of titles of various levels within the chapter where each document paragraph is located and the document name according to the chapter position of each document paragraph in the document; and determining a second document title set consisting of document titles and document names of all levels arranged before the document paragraph according to the chapter position of each document paragraph in the document.

[0081] For example, Figure 2As shown, the current segmentation result includes the paragraph content under "2.1 Level 2 Title". The first document title set corresponding to the paragraph content may include: "Document Name", "2 Level 1 Title" and "2.1 Level 2 Title". For another example, the current segmentation result includes the paragraph content under "1.1.1.1 Level 4 Title", the first document title set corresponding to the paragraph content may include: "Document Name", "1 Level 1 Title", "1.1 Level 2 Title", "1.1.1 Level 3 Title", and "1.1.1.1 Level 4 Title".

[0082] like Figure 2 As shown, the current segmentation result includes the paragraph content under "2.1 Level 2 Title". Then the second document title set corresponding to the paragraph content may include: "Document Name", "1 Level 1 Title", "1.1 Level 2 Title", "1.1.1 Level 3 Title", "1.1.1.1 Level 4 Title", "1.1.1.2 Level 4 Title", "1.1.2 Level 3 Title", "1.1.2.1 Level 4 Title", "1.1.2.2 Level 4 Title", "1.1.3 Level 3 Title", "1.1.4 Level 3 Title", "1.2 Level 2 Title", "1.2.1 Level 3 Title", "1.2.2 Level 3 Title", "1.3 Level 2 Title", "2 Level 1 Title" and "2.1 Level 2 Title". For another example, if the current segmentation result includes the paragraph content under "1.1.1.1 Level 4 Title", the second document title set corresponding to the paragraph content may include: "Document Name", "1 Level 1 Title", "1.1 Level 2 Title", "1.1.1 Level 3 Title", and "1.1.1.1 Level 4 Title".

[0083] Step 530: Determine whether the current document paragraph meets the preset slicing condition according to the previous slicing result of the document to be segmented, the current document paragraph, and the next document paragraph.

[0084] In an optional implementation of an embodiment of the present invention, whether the current document paragraph meets the preset slicing condition is determined based on the previous segmentation result of the document to be segmented, the current document paragraph and the next document paragraph, including: when the paragraph content from the previous segmentation result to the current document paragraph and the corresponding first document title set are less than or equal to the preset slicing length, it is determined that the current document paragraph meets the preset slicing condition.

[0085] When determining that the current document paragraph meets the preset slicing condition, the specific judgment method is the same as the above content, and the only difference is that the first document title set corresponding to the paragraph content is used at this time.

[0086] Step 540: If the current document paragraph meets the preset slicing condition, the current document paragraph and the next document paragraph are updated.

[0087] After updating the document paragraph, the process may return to step 530 .

[0088] Step 550: If the current document paragraph does not meet the preset segmentation condition, a current segmentation result is generated according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set.

[0089] In an optional implementation of an embodiment of the present invention, a current segmentation result is generated based on paragraph content between a previous segmentation result and a previous document paragraph of a current document paragraph, and a corresponding document title set, including: taking the paragraph content between a previous segmentation result and a previous document paragraph of the current document paragraph, and a corresponding first document title set, as a current candidate segmentation result; calculating a first length difference between a preset slice length and the current candidate segmentation result, and a second length difference between the second document title set and the first document title set; if the first length difference is greater than or equal to the second length difference, generating the current segmentation result based on the paragraph content between a previous segmentation result and a previous document paragraph of the current document paragraph, and a corresponding second document title set; otherwise, taking the current candidate segmentation result as the current segmentation result.

[0090] In an embodiment of the present invention, the first document title set may be used to segment the document paragraphs. When the current candidate segmentation result is obtained by segmentation, the length of the current candidate segmentation result may be compared with the preset slice length. If the first length difference value can satisfy the requirement of replacing the first document title set with the second document title set, the document paragraph segmentation result obtained based on the second document title set is used. If the first length difference value cannot satisfy the requirement of replacing the first document title set with the second document title set, the current candidate segmentation result is used as the current segmentation result.

[0091] Through the above method, the document can be segmented into paragraphs first, so that the segmentation results contain as much specific information as possible (i.e., specific paragraph content) to facilitate users to understand the details. When the document segmentation cannot add new paragraph content, if the current segmentation result supports the insertion of more title information, the segmentation result is made to contain as much title information as possible to facilitate users to understand the summary information of the document. At the same time, based on the document segmentation result, it is also convenient for the reliable training and rapid prediction of the large language model.

[0092] Step 560: When responding to the user request and determining the response content matching the user request, determine the target segmentation result from among the segmentation results according to the correlation between the response content and the segmentation results.

[0093] Step 570: Display the response content and target segmentation results.

[0094] Based on the above implementation, optionally, when a document paragraph includes a picture, the picture title is used as an item in the document title set; when a document paragraph includes a table, the table title is used as an item in the document title set, the text in the table is used as the paragraph content of the document paragraph, and the numbers in the table are stored.

[0095] In an optional implementation of an embodiment of the present invention, when the target segmentation result includes a table, the response content and the target segmentation result are displayed, including: determining a target table number corresponding to the target table title based on the target table title in the target segmentation result; forming a target table based on the target table number, and the target table title and target table text in the target segmentation result; and displaying the response content, the target table, and non-table content in the target segmentation result.

[0096] The technical solution of this embodiment is to obtain the document to be segmented and identify the document name, document titles of each level, and document paragraphs in the document to be segmented; determine the document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document; wherein the document title set includes the document name and the document titles of each level corresponding to the document paragraph; determine whether the current document paragraph meets the preset slicing condition according to the previous segmentation result of the document to be segmented, the current document paragraph, and the next document paragraph; if so, update the current document paragraph and the next document paragraph, and return the result of the previous segmentation result of the document to be segmented, the current document paragraph, and the next document paragraph. The step of determining whether the current document paragraph meets the preset slicing condition is performed; if not, the current segmentation result is generated according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set; when responding to the user request and determining the response content matching the user request, the target segmentation result is determined in each segmentation result according to the correlation between the response content and each segmentation result; the response content and the target segmentation result are displayed, which solves the problem of document segmentation display, and through an unsupervised and simple segmentation method, the semantic integrity of the segmented fragments is guaranteed, and the semantic information is retained to the greatest extent, which is conducive to quickly determining the semantics of the segmentation result and performing response display.

[0097] Embodiment 3

[0098] Figure 6 1 is a schematic diagram of a document content segmentation device based on a document title hierarchical structure according to Embodiment 3 of the present invention. Figure 6 As shown, the device includes: a content identification module 610, a document title set determination module 620, a condition judgment module 630, a loop judgment module 640, and a current segmentation result generation module 650. Among them:

[0099] The content identification module 610 is used to obtain the document to be segmented, and identify the document name, document titles at each level, and document paragraphs in the document to be segmented;

[0100] The document title set determination module 620 is used to determine the document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document;

[0101] The document title set includes the document name and the document titles at each level corresponding to the document paragraphs;

[0102] The condition judgment module 630 is used to determine whether the current document paragraph meets the preset slicing condition according to the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph;

[0103] A loop judgment module 640 is used to update the current document paragraph and the next document paragraph if the current document paragraph meets the preset slicing condition, and return to the step of determining whether the current document paragraph meets the preset slicing condition based on the previous segmentation result of the document to be segmented, the current document paragraph and the next document paragraph;

[0104] The current segmentation result generating module 650 is used to generate the current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding document title set if the current document paragraph does not meet the preset segmentation condition.

[0105] Optionally, the condition judgment module 630 includes:

[0106] The first condition judgment unit is used to determine that the current document paragraph meets the preset slicing condition when the paragraph content of the current document paragraph and the corresponding document title set from the above slicing result are less than or equal to the preset slicing length.

[0107] Optionally, the document title set determination module 620 includes:

[0108] A first document title set determining unit, configured to determine a first document title set consisting of titles of various levels in the chapter where each document paragraph is located and the document name according to the chapter position of each document paragraph in the document;

[0109] The second document title set determining unit is used to determine a second document title set consisting of document titles and document names of all levels arranged before the document paragraph according to the chapter position of each document paragraph in the document.

[0110] Optionally, the condition judgment module 630 includes:

[0111] The second condition judgment unit is used to determine that the current document paragraph meets the preset slicing condition when the paragraph content of the current document paragraph and the corresponding first document title set from the above slicing result are less than or equal to the preset slicing length.

[0112] Optionally, the current segmentation result generating module 650 includes:

[0113] A current candidate segmentation result determination unit, used to take the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding first document title set as the current candidate segmentation result;

[0114] A length difference determination unit, used to calculate a first length difference between a preset slice length and a current candidate segmentation result, and a second length difference between a second document title set and a first document title set;

[0115] The current segmentation result determination unit is used to generate the current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding second document title set if the first length difference is greater than or equal to the second length difference; otherwise, the current alternative segmentation result is used as the current segmentation result.

[0116] Optionally, the device is also used for:

[0117] When a document paragraph includes an image, the image title is included as an item in the document title set;

[0118] When a document paragraph includes a table, the table title is taken as an item in the document title set, the text in the table is taken as the paragraph content of the document paragraph, and the numbers in the table are stored.

[0119] Optionally, the device further includes:

[0120] The target segmentation result determination module is used to determine the target segmentation result from each segmentation result according to the correlation between the response content and each segmentation result when responding to the user request and determining the response content matching the user request;

[0121] Display module, used to display the response content and target segmentation results;

[0122] When the target segmentation result includes a table, the display module includes:

[0123] A target table number determination unit, used to determine a target table number corresponding to the target table title according to the target table title in the target segmentation result;

[0124] A target table forming unit, used for forming a target table according to the target table numbers, and the target table title and the target table text in the target segmentation result;

[0125] Display unit, used to display response content, target table, and non-table content in target segmentation results.

[0126] The document content segmentation device based on the document title hierarchical structure provided in the embodiment of the present invention can execute the document content segmentation method based on the document title hierarchical structure provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0127] In the technical solutions of the embodiments of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of the document information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0128] Embodiment 4

[0129] Figure 7 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0130] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0131] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0132] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a document content segmentation method based on a document title hierarchy structure.

[0133] In some embodiments, the document content segmentation method based on the document title hierarchy structure can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the document content segmentation method based on the document title hierarchy structure described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the document content segmentation method based on the document title hierarchy structure in any other appropriate manner (for example, by means of firmware).

[0134] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0135] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0136] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0137] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0138] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0139] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0140] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0141] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A document content segmentation method based on a document title hierarchical structure, characterized in that: include: Obtaining a document to be segmented, and identifying a document name, document titles at each level, and document paragraphs in the document to be segmented; Determine a document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document; The document title set includes the document name and the document titles of each level corresponding to the document paragraphs; Determine whether the current document paragraph meets the preset slicing condition according to the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph; If yes, then update the current document paragraph and the next document paragraph, and return to the step of determining whether the current document paragraph meets the preset slicing condition based on the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph; If not, the current segmentation result is generated according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set.

2. The method according to claim 1, characterized in that According to the previous segmentation result of the document to be segmented, the current document paragraph and the next document paragraph, determine whether the current document paragraph meets the preset segmentation conditions, including: When the paragraph content of the current document paragraph and the corresponding document title set of the above segmentation result are less than or equal to the preset slicing length, it is determined that the current document paragraph meets the preset slicing condition.

3. The method according to claim 1, characterized in that According to the chapter position of each document paragraph in the document, a document title set corresponding to each document paragraph is determined, including: According to the chapter position of each document paragraph in the document, a first document title set consisting of titles of various levels in the chapter where each document paragraph is located and the document name is determined; According to the chapter position of each document paragraph in the document, a second document title set consisting of document titles and document names of all levels arranged before the document paragraph is determined.

4. The method according to claim 3, characterized in that According to the previous segmentation result of the document to be segmented, the current document paragraph and the next document paragraph, determine whether the current document paragraph meets the preset segmentation conditions, including: When the above segmentation result to the paragraph content of the current document paragraph and the corresponding first document title set is less than or equal to a preset slicing length, it is determined that the current document paragraph meets the preset slicing condition.

5. The method according to claim 4, characterized in that According to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph, and the corresponding document title set, the current segmentation result is generated, including: The paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding first document title set are used as the current candidate segmentation result; Calculating a first length difference between a preset slice length and a current candidate segmentation result, and a second length difference between a second document title set and a first document title set; If the first length difference is greater than or equal to the second length difference, generating a current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding second document title set; Otherwise, the current candidate segmentation result is used as the current segmentation result.

6. The method according to claim 1, characterized in that When the document paragraph includes a picture, the picture title is taken as an item in the document title set; When the document paragraph includes a table, the table title is used as an item in the document title set, the text in the table is used as the paragraph content of the document paragraph, and the numbers in the table are stored.

7. The method according to claim 6, characterized in that Also includes: In response to a user request, when determining a response content matching the user request, determining a target segmentation result from among the segmentation results according to a correlation between the response content and each segmentation result; Displaying the response content and the target segmentation result; Wherein, when the target segmentation result includes a table, displaying the response content and the target segmentation result includes: According to the target table title in the target segmentation result, determining the target table number corresponding to the target table title; Form a target table according to the target table number, and the target table title and target table text in the target segmentation result; The response content, the target table, and the non-table content in the target segmentation result are displayed.

8. A document content segmentation device based on a document title hierarchical structure, characterized in that: include: A content identification module is used to obtain the document to be segmented, and identify the document name, document titles at each level, and document paragraphs in the document to be segmented; A document title set determination module, used to determine the document title set corresponding to each document paragraph according to the chapter position of each document paragraph in the document; The document title set includes the document name and the document titles of each level corresponding to the document paragraphs; The condition judgment module is used to determine whether the current document paragraph meets the preset slicing condition according to the previous slicing result of the document to be segmented, the current document paragraph and the next document paragraph; A loop judgment module is used to update the current document paragraph and the next document paragraph if the current document paragraph meets the preset slicing condition, and return to the step of determining whether the current document paragraph meets the preset slicing condition based on the previous segmentation result of the document to be segmented, the current document paragraph and the next document paragraph; The current segmentation result generating module is used to generate the current segmentation result according to the paragraph content between the previous segmentation result and the previous document paragraph of the current document paragraph and the corresponding document title set if the current document paragraph does not meet the preset segmentation condition.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the document content segmentation method based on the document title hierarchy structure described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the document content segmentation method based on the document title hierarchy structure according to any one of claims 1 to 7 when executed.

Citation Information

Cited By

  • Document segmentation method for large model retrieval enhancement generation

    CN119848188A

  • A document segmentation method for large model retrieval enhanced generation

    CN119848188B

  • Document segmentation method and device, equipment and storage medium

    CN121501757A

  • Multi-strategy Markdown segmentation method and device

    CN122693677A

  • Multi-strategy markdown segmentation method and apparatus

    CN122693677B