Document partitioning method and device and electronic equipment

Through the preset segmentation point vector index library and layout information detection, unsupervised document segmentation is realized, which solves the problems of insufficient generalization and high manual annotation cost in the existing technology, and improves the recall rate and accuracy of document segmentation. Generalizability.

CN118569208APending Publication Date: 2024-08-30GUANGZHOU CVTE ARTIFICIAL INTELLIGENCE INNOVATION RES INST CO LTD +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310187051.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing document parsing methods have insufficient generalization in the text segmentation process and cannot cover a variety of text expressions. Moreover, supervised segmentation methods require a large number of labeled samples, and the cost of manual labeling is high.

Method used

A preset segmentation point vector index library is used to detect text segmentation points, and secondary detection is performed through layout information to establish an unsupervised document segmentation method, reducing reliance on manual annotation.

Benefits of technology

It improves the recall rate and generalization of document chunking, reduces the implementation cost of document chunking, and avoids the need for manual annotation of training corpus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569208A
    Figure CN118569208A
Patent Text Reader

Abstract

The invention discloses a document partitioning method and device. The method comprises the following steps: acquiring a document to be partitioned, and extracting a content text of each line of the document; according to a preset segmentation point vector index database, detecting whether the content text of each line is a text segmentation point or not; obtaining format information of the content text of the text segmentation point, and determining the format information as target format information; obtaining format information corresponding to the content text of each line in the document; comparing the format information with the target format information to determine all text segmentation points of the document; and partitioning the document according to all the text segmentation points. On the basis of the segmentation point vector index database, a mode of searching the text segmentation points through the format information is added, so that the recall rate of the document segmentation is improved, generalization is better, in addition, training corpora which are manually labeled are not needed in the process, and the implementation cost of the document segmentation is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a document segmentation method, device and electronic device. Background Art

[0002] Document parsing refers to extracting the information that the user wants to obtain or the keyword information that represents the central meaning of the document from the document. For example, resume parsing refers to extracting the candidate's name, phone number, email address, company, time period, job responsibilities, graduation school and other fields from the resume document. The current document parsing method usually extracts text from the document first, then divides the extracted text into multiple different content blocks such as basic information, work experience, project experience, and educational experience, and finally extracts the corresponding structured fields from different content blocks. Among them, when the text content extracted from the document is divided into blocks, it is generally segmented by a preset delimiter or a manually compiled common delimiter dictionary; or the entity information identified by the manually compiled keyword dictionary or named entity recognition model is combined with the manually formulated heuristic rules to match the text segmentation lines from the document text to complete the segmentation of the text content; or the document is classified by using a trained supervised classification model to determine the blocks.

[0003] In the process of implementing the embodiments of the present application, the applicant discovered that the related technology uses preset delimiters, keyword sets, and manual rules, which have the problem of insufficient generalization and inability to cover a variety of text expressions; the supervised segmentation method for classifying text lines requires a large number of labeled samples to train the model, but it is relatively difficult to obtain labeled samples, and the cost of manual labeling is also high. Summary of the invention

[0004] The main technical problem solved by the implementation method of the present application is to improve the recall rate of document segmentation and reduce the cost of document segmentation.

[0005] In order to solve the above technical problems, a technical solution adopted in the implementation mode of the present application is: providing a document segmentation method, including: obtaining a document to be segmented, and extracting the content text of each line of the document; detecting whether the content text of each line is a text segmentation point according to a preset segmentation point vector index library; obtaining the layout information of the content text of the text segmentation point, and determining the layout information as the target layout information; obtaining the layout information corresponding to the content text of each line in the document; comparing the layout information with the target layout information to determine all the text segmentation points of the document; and segmenting the document according to all the text segmentation points.

[0006] Optionally, the detecting whether the content text of each line is a text segmentation point according to a preset segmentation point vector index library comprises: representing the content text of each line as a semantic vector; retrieving the segmentation point vector index library according to the semantic vector, and comparing the similarity between the retrieved text segmentation point and the content text of the current line, the segmentation point vector index library comprising a plurality of text segmentation points; when the similarity is greater than a preset threshold value, determining that the content text of the current line is a text segmentation point, otherwise, it is not a text segmentation point.

[0007] Optionally, the method also includes: establishing the segmentation point vector index library; the establishing of the segmentation point vector index library includes: constructing a text segmentation point library; representing each text segmentation point in the text segmentation point library as a semantic vector; indexing the semantic vectors corresponding to all text segmentation points to obtain the segmentation point vector index library.

[0008] Optionally, representing each text segmentation point in the text segmentation point library as a semantic vector includes: dividing the text segmentation point into a character sequence, the character sequence including each character in the text segmentation point; inserting CLS characters and SEP characters at the beginning and end of the character sequence, respectively, to obtain a new character sequence; inputting the new character sequence into a preset language model, and outputting a vector of each character in the new character sequence; and using the vector corresponding to the CLS character as the semantic vector of the text segmentation point.

[0009] Optionally, obtaining the layout information corresponding to the content text of each line in the document specifically includes: obtaining the text size, text color, font, bold status, underline status, and italic status corresponding to the content text of each line in the document.

[0010] Optionally, comparing the layout information with the target layout information to determine all the text segmentation points of the document includes: comparing the layout information corresponding to the content text of each line in the document with the target layout information; when the layout information is the same as the target layout information, determining that the content text corresponding to the layout information is the text segmentation point.

[0011] In order to solve the above technical problems, another technical solution adopted by the implementation mode of the present application is: to provide a document segmentation device, including: a text extraction module, used to obtain the document to be segmented, and extract the content text of each line of the document; a first text segmentation point detection module, used to detect whether the content text of each line is a text segmentation point according to a preset segmentation point vector index library; a target layout information determination module, used to obtain the layout information of the content text of the text segmentation point, and determine the layout information as the target layout information; a layout information acquisition module, used to obtain the layout information corresponding to the content text of each line in the document; a second text segmentation point detection module, used to compare the layout information with the target layout information to determine all the text segmentation points of the document; a segmentation module, used to segment the document according to all the text segmentation points.

[0012] To solve the above technical problems, another technical solution adopted in the implementation mode of the present application is: to provide an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the document segmentation method as described above.

[0013] In order to solve the above technical problems, another technical solution adopted in the implementation mode of the present application is: providing a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device executes the document segmentation method as described above.

[0014] In order to solve the above technical problems, another technical solution adopted in the implementation mode of the present application is: providing a computer program product, wherein the computer program product includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by an electronic device, the electronic device executes the document segmentation method as described above.

[0015] Different from the related art, the document segmentation method, device, electronic device, non-volatile computer-readable storage medium and computer program product provided in the embodiments of the present application perform a preliminary check on the document to be segmented through a preset segmentation point vector index library to obtain text segmentation points, and then detect the text segmentation points again based on the layout information of the determined text segmentation points and the layout information of each other line of content text in the document, and finally segment the document to be segmented based on all the text segmentation points. The implementation method provided by the present application adds a method of searching for text segmentation points through layout information on the basis of the segmentation point vector index library, thereby improving the recall rate of document segmentation and better generalization. In addition, the process does not require manually annotated training corpus, reducing the implementation cost of document segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] One or more embodiments are exemplarily described by corresponding drawings, which do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and the figures in the drawings do not constitute proportional limitations unless otherwise stated.

[0017] Figure 1 It is a flowchart of a document segmentation method provided in an embodiment of the present application;

[0018] Figure 2 It is a flowchart of a method for detecting whether the content text of each line is a text segmentation point according to a preset segmentation point vector index library provided in an embodiment of the present application;

[0019] Figure 3 It is a structural schematic diagram of a document segmentation device provided in an embodiment of the present application;

[0020] Figure 4 It is a hardware structure diagram of an electronic device 30 for executing a document segmentation method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0022] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device schematic diagram or the order in the flow chart.

[0023] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.

[0024] The embodiment of the present application provides an unsupervised document segmentation method and device, which is mainly based on the characteristics that the document generally includes text content blocks such as "basic information", "work experience", "education experience", etc., and the characteristics that the text segmentation points in the document generally have the same layout information, and performs segmentation operations on the documents to be segmented. Compared with the dictionary and rule-based methods in the current methods, the method of the embodiment of the present application has better generalization; compared with the supervised machine learning-based methods in the current methods, the method of the embodiment of the present application does not require manually annotated training corpus, which reduces the implementation cost of document segmentation.

[0025] Specifically, see Figure 1 , Figure 1 is a flowchart of a document segmentation method provided in an embodiment of the present application, such as Figure 1 As shown, the method includes:

[0026] S11. Obtain a document to be segmented, and extract the content text of each line of the document.

[0027] In the embodiment of the present application, the document refers to information composed of structured fields and displayed in text and / or images, and the content information of the document is classified by the structured fields so that the document is displayed in the form of content blocks. For example, the document includes but is not limited to resumes, specifications, project plans, patent application documents, etc. For example, a resume document includes content blocks such as basic information, educational experience, work experience, and project experience; the specification includes content blocks such as product configuration, technical parameters, safety instructions, and frequently asked questions; the project plan includes content blocks such as project summary, project content, and project personnel.

[0028] Document parsing refers to extracting the target information that the user wants to obtain from the document, or extracting keywords that represent the core meaning of the document. The process of document parsing usually involves extracting text content from the document, dividing it into blocks according to the text content, and then extracting the important content of each block based on the divided blocks.

[0029] For example, when parsing a resume, we usually extract fields such as the candidate's name, phone number, email address, company, time period, job responsibilities, and school of graduation from the resume document. To achieve this goal, we usually extract text from the resume document, then divide the extracted text into multiple different content blocks such as basic information, work experience, project experience, and educational experience, and finally extract the corresponding structured fields from different content blocks.

[0030] The document to be segmented is similar to the resume document. The result of segmenting the document is that the document is divided into a plurality of content blocks, and the central meanings of the plurality of content blocks are different.

[0031] In an embodiment of the present application, the document to be segmented is segmented by line, and the content text of each line of the document is extracted. When extracting each line of content text, the structure of the document to be extracted can be first determined, and whether each line of text contains valid data can be determined. The rules for extracting the fields of each line can be found from the valid data line, and then the content text of each line can be read through the corresponding code. For the extraction of line text of documents with complex formats, such as resume documents that usually have photos of candidates embedded in them, the format rules of the resume documents can be summarized, and the photos can be removed or corresponded to a line, etc., and the content text of each line of the resume document can be extracted according to the corresponding rules.

[0032] S12: Detect whether the content text of each line is a text segmentation point according to a preset segmentation point vector index library.

[0033] The text segmentation point refers to the starting line of a content block. For example, the title line "Work Experience" in a resume document indicates the beginning of the content block of work experience, so this line is a text segmentation point of the resume document.

[0034] The segmentation point vector index library refers to a library file containing many text segmentation points, each of which is represented as a semantic vector, and indexes are established for the semantic vectors corresponding to the text segmentation points.

[0035] In the embodiment of the present application, the process of dividing the document into blocks is the process of locating the text segmentation points in the document.

[0036] like Figure 2 As shown, the detecting whether the content text of each line is a text segmentation point according to the preset segmentation point vector index library includes:

[0037] S121, representing the content text of each line as a semantic vector;

[0038] S122, searching the segmentation point vector index library according to the semantic vector, and comparing the similarity between the retrieved text segmentation point and the content text of the current line, wherein the segmentation point vector index library includes a plurality of text segmentation points;

[0039] S123: When the similarity is greater than a preset threshold, the content text of the current line is determined to be a text segmentation point; otherwise, it is not a text segmentation point.

[0040] The method of representing each line of text as a semantic vector can be based on statistics or neural network. The main purpose of text vectorization is to represent text as a series of vectors that can express the text semantics. Text vectorization can usually be achieved through word vectorization.

[0041] After each line of the current document is vectorized, the similarity between the content text line and the text segmentation point in the segmentation point vector index library is compared, and the content text with a similarity greater than a threshold is determined as the text segmentation point. The calculation of semantic vector similarity can be achieved by calculating cosine similarity, Euclidean distance, etc.

[0042] In some embodiments, the method further includes establishing the segmentation point vector index library. The establishment of the segmentation point vector index library includes: constructing a text segmentation point library; representing each text segmentation point in the text segmentation point library as a semantic vector; indexing the semantic vectors corresponding to all text segmentation points to obtain the segmentation point vector index library. Among them, batches of document data of the same type can be obtained according to the category of the document to be segmented, and then the document data are analyzed to sort out the commonly used text segmentation points of the document of this category, and these text segmentation points form a text segmentation point library. The method of representing the text segmentation point as a semantic vector can be the method mentioned in the above steps, and can also be based on the Bert (Bidirectional Encoder Representations from Transformers) algorithm to semantically represent the text segmentation point. Specifically, the text segmentation point is divided into a character sequence, and the character sequence includes each character in the text segmentation point; CLS characters and SEP characters are respectively inserted at the beginning and end of the character sequence to obtain a new character sequence; the new character sequence is input into a preset language model, and the vector of each character in the new character sequence is output; the vector corresponding to the CLS character is used as the semantic vector of the text segmentation point. Among them, the preset language model can specifically be a Bert model. For example, the text segmentation points of the resume document are divided into a token sequence [t1, t2, ..., tn], where each token is a character in the text line. Then, two special tokens are added before and after the token sequence: CLS and SEP, respectively, to obtain a new token sequence [CLS, t1, t2, ..., tn, SEP]. The new token sequence is input into the Bert model, and each token will get a vector representation. The vector representation corresponding to CLS is used as the semantic vector representation of the text segmentation point. Optionally, before the text segmentation points are semantically represented based on the Bert algorithm, the line text corresponding to the text segmentation points can also be cleaned to remove blanks, special characters, etc. Optionally, the text semantic encoder used in this application is not limited to Bert, but can also be word2vec, RoBERTa, etc.

[0043] Among them, indexing the semantic vectors corresponding to all text segmentation points is to determine the storage structure of the semantic vectors corresponding to all text segmentation points. The index is similar to a directory of semantic vectors corresponding to all text segmentation points, and the corresponding semantic vectors can be quickly found according to the directory. The semantic vector indexing tool annoy can be used to index the semantic vectors corresponding to all text segmentation points, and faiss or other vector indexing tools can also be used.

[0044] The segmentation point vector index library can detect some text segmentation points for the segmented documents. Since the text segmentation points in the segmentation point vector index library are constructed based on a large number of document files, and the document files may be highly personalized, the segmentation point vector index library obtained cannot find all the text segmentation points of the document. For example, each person's resume contains different content, so the resume is highly personalized. For example, some resumes contain "professional skills", "language proficiency", "school status", etc., but there may be no words with a high similarity to these words in the segmentation point index library, so the text segmentation points corresponding to these words cannot be determined in the above process.

[0045] The following steps further detect the text segmentation points of the document based on the document's layout information.

[0046] S13: Acquire the layout information of the content text at the text segmentation point, and determine the layout information as the target layout information.

[0047] It is known that for a document, the text segmentation points therein usually have the same layout information. Therefore, after obtaining a text segmentation point of the document to be segmented, the layout information of the text segmentation point is the layout information of all text segmentation points in the document to be segmented.

[0048] The layout information refers to the text size, text color, font, bold status (whether bold), underline status (whether underlined), italic status (whether it is italic), etc. corresponding to the content text of each line in the document.

[0049] The target layout information is the layout information of the text segmentation point determined according to the segmentation point vector index library. The layout information of other content texts in the document is searched through the target layout information, so as to determine other text segmentation points.

[0050] S14: Obtain the layout information corresponding to the content text of each line in the document.

[0051] When obtaining the layout information of the content text of each line in the document, the layout information of the content text in the format may be searched according to the format of the document (such as DOC, TXT, PPT, etc.).

[0052] S15: Compare the layout information with the target layout information to determine all the text segmentation points of the document.

[0053] The layout information corresponding to the content text of each line in the document is compared with the target layout information; when the layout information is the same as the target layout information, the content text corresponding to the layout information is determined as the text segmentation point.

[0054] S16. Divide the document into blocks according to all the text segmentation points.

[0055] It can be known that the starting line of a content block is the text segmentation point. After finding all the text segmentation points of the document, all the content blocks of the document can be determined, thereby realizing the block operation of the document.

[0056] The above method of searching for text segmentation points through layout information improves the recall rate of determining text segmentation points. For example, suppose a resume contains two text segmentation points, "school status" and "work experience", but the segmentation point vector index library only contains words with semantic similarity to "work experience", and only the text segmentation point "work experience" can be found through semantic indexing. However, the two words "school status" and "work experience" in the resume have the same format layout information, and the text segmentation point "school status" can be found through the layout information of "work experience". Through the above document segmentation method, other documents such as resume documents can be divided into content blocks, and the documents can be further parsed in more detail according to the divided content blocks. The method provided in the embodiment of the present application can be well applied to resume search, candidate screening and other fields.

[0057] The embodiment of the present application provides a document segmentation method, which performs a preliminary check on the document to be segmented through a preset segmentation point vector index library to obtain text segmentation points, and then detects the text segmentation points again according to the layout information of the determined text segmentation points and the layout information of each other line of content text in the document, and finally segments the document to be segmented according to all the text segmentation points. The implementation method provided by the present application adds a method of searching for text segmentation points through layout information on the basis of the segmentation point vector index library, thereby improving the recall rate of document segmentation and better generalization. In addition, the process does not require manually annotated training corpus, which reduces the implementation cost of document segmentation.

[0058] See also Figure 3 , Figure 3 Schematic diagram of the structure of a document segmentation device provided in an embodiment of the present application. Figure 3 As shown, the document segmentation device 20 includes: a text extraction module 21, a first text segmentation point detection module 22, a target layout information determination module 23, a layout information acquisition module 24, a second text segmentation point detection module 25 and a segmentation module 26.

[0059] The text extraction module 21 is used to obtain the document to be segmented and extract the content text of each line of the document; the text segmentation point first detection module 22 is used to detect whether the content text of each line is a text segmentation point based on a preset segmentation point vector index library; the target layout information determination module 23 is used to obtain the layout information of the content text of the text segmentation point, and determine the layout information as the target layout information; the layout information acquisition module 24 is used to obtain the layout information corresponding to the content text of each line in the document; the text segmentation point second detection module 25 is used to compare the layout information with the target layout information to determine all the text segmentation points of the document; the segmentation module 26 is used to segment the document according to all the text segmentation points.

[0060] In some embodiments, the document segmentation device 20 also includes a segmentation point vector index library establishment module 27, and the segmentation point vector index library establishment module 27 is used to construct a text segmentation point library; represent each text segmentation point in the text segmentation point library as a semantic vector; and index the semantic vectors corresponding to all text segmentation points to obtain the segmentation point vector index library.

[0061] It should be noted that the above-mentioned document segmentation device can execute the document segmentation method provided in the embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in the document segmentation device embodiment, please refer to the document segmentation method provided in the embodiment of the present application.

[0062] See also Figure 4 , Figure 4 is a schematic diagram of the hardware structure of an electronic device 30 for executing a document segmentation method provided in an embodiment of the present application, such as Figure 4 As shown, the electronic device 30 includes:

[0063] One or more processors 31 and memory 32, Figure 4 A processor 31 is taken as an example.

[0064] The processor 31 and the memory 32 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0065] The memory 32 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the document segmentation method in the embodiment of the present application (for example, the attached Figure 3The processor 31 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 32, that is, the document segmentation method of the above method embodiment is implemented.

[0066] The memory 32 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created according to the use of the document segmentation device, etc. In addition, the memory 32 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 32 may optionally include a memory remotely arranged relative to the processor 31, and these remote memories may be connected to the document segmentation device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0067] The one or more modules are stored in the memory 32, and when executed by the one or more processors 31, the document segmentation method in any of the above method embodiments is executed, for example, the document segmentation method described above is executed. Figure 1 , Figure 2 Method steps and implementation Figure 3 The functions of the modules in .

[0068] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.

[0069] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to: Personal computer devices: This type of device belongs to the category of personal computers, has computing and processing functions, and generally also has mobile Internet features. Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc. And other electronic devices with data interaction functions.

[0070] The embodiment of the present application provides a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, such as Figure 4 A processor 31 in the embodiment may enable the one or more processors to execute the document segmentation method in any of the above method embodiments, for example, to execute the above described Figure 1, Figure 2 Method steps and implementation Figure 3 The functions of the modules in .

[0071] The present application provides a computer program product, wherein the computer program product includes a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by the electronic device, the electronic device is enabled to execute the document segmentation method in any of the above method embodiments, for example, to execute the above described Figure 1 , Figure 2 Method steps and implementation Figure 3 The functions of the modules in .

[0072] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0073] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0074] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as described above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A document segmentation method, characterized in that: include: Obtain the document to be segmented, and extract the content text of each line of the document; According to a preset segmentation point vector index library, detecting whether the content text of each line is a text segmentation point; Acquire the layout information of the content text at the text segmentation point, and determine the layout information as the target layout information; Obtaining the layout information corresponding to the content text of each line in the document; Comparing the layout information with the target layout information to determine all the text segmentation points of the document; The document is divided into blocks according to all the text segmentation points.

2. The document segmentation method according to claim 1, characterized in that: The detecting whether the content text of each line is a text segmentation point according to a preset segmentation point vector index library includes: Representing the content text of each line as a semantic vector; Retrieving the segmentation point vector index library according to the semantic vector, and comparing the similarity between the retrieved text segmentation point and the content text of the current line, wherein the segmentation point vector index library includes a plurality of text segmentation points; When the similarity is greater than a preset threshold, the content text of the current line is determined to be a text segmentation point, otherwise, it is not a text segmentation point.

3. The document segmentation method according to claim 2, characterized in that: The method further comprises: establishing the segmentation point vector index library; The step of establishing the segmentation point vector index library comprises: Build a text segmentation point library; Representing each text segmentation point in the text segmentation point library as a semantic vector; The semantic vectors corresponding to all text segmentation points are indexed to obtain the segmentation point vector index library.

4. The document segmentation method according to claim 3, characterized in that: The step of expressing each text segmentation point in the text segmentation point library as a semantic vector comprises: Divide the text segmentation point into a character sequence, wherein the character sequence includes each character in the text segmentation point; Inserting a CLS character and a SEP character at the beginning and the end of the character sequence respectively to obtain a new character sequence; Input the new character sequence into a preset language model, and output a vector of each character in the new character sequence; The vector corresponding to the CLS character is used as the semantic vector of the text segmentation point.

5. The document segmentation method according to any one of claims 1 to 4, characterized in that: The obtaining of the layout information corresponding to the content text of each line in the document specifically includes: obtaining the text size, text color, font, bold status, underline status, and italic status corresponding to the content text of each line in the document.

6. The document segmentation method according to claim 5, characterized in that: The comparing the layout information with the target layout information to determine all the text segmentation points of the document includes: Compare the layout information corresponding to the content text of each line in the document with the target layout information; When the layout information is the same as the target layout information, the content text corresponding to the layout information is determined as the text segmentation point.

7. A document segmentation device, characterized in that: include: A text extraction module, used to obtain the document to be segmented and extract the content text of each line of the document; A first text segmentation point detection module, used to detect whether the content text of each line is a text segmentation point according to a preset segmentation point vector index library; A target layout information determination module, used to obtain the layout information of the content text at the text segmentation point, and determine the layout information as the target layout information; A layout information acquisition module, used to acquire the layout information corresponding to the content text of each line in the document; A second text segmentation point detection module, used for comparing the layout information with the target layout information to determine all the text segmentation points of the document; The block segmentation module is used to segment the document into blocks according to all the text segmentation points.

8. An electronic device, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the document segmentation method described in any one of claims 1 to 6.

9. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device executes the document segmentation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by an electronic device, the electronic device executes the document segmentation method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Format document processing method, device and equipment

    CN119169647A