A text content extraction method and device
Patent Information
- Application Number
- CN202311493820.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-09
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-11-09
AI Technical Summary
但是,现有的提取方式通常是通过识别文字的方式,实现文本内容的读取,在这种情况下,用户需自主定位所需内容的位置,以实现内容的准确提取
[0074]本申请实施例提供的文本内容提取方法及装置,通过识别待读取文本的文本格式,确定待读取文本所适用的文本读取方式;当文本读取方式为多模型联合读取时,通过逐字读取待读取文本,获得待读取文本的离散结构化数据;其中,离散结构化数据包括从待读取文本中读取出的多个文本token;通过语义分析模型,逐一对离散结构化数据中的每个文本token进行矩阵编码,并在矩阵编码过程中将每个文本token的阅读语义,添加至每个文本token的token编码矩阵中,整合得到待读取文本的逻辑结构化数据;基于逻辑结构化数据和内容提取需求,确定所述待读取文本的内容提取方式;当内容提取方式为模型提取时,通过大语言识别模型,基于逻辑结构化数据和内容提取需求,生成满足内容提取需求的文本提取结果。这样,可以结合于待读取文本所涉及的每个文本token的阅读语义,实现文本内容的准确提取,以此,可以提高内容提取结果的准确性;同时,还能够在提取时,结合用户的内容提取需求,选择合适的内容提取方式,进而,在能够保证提取内容准确性的同时,还能够保证文本内容的提取效率。
Smart Images

Figure CN117390179B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method and apparatus for extracting text content. Background Technology
[0002] While browsing text, users may want to extract portions of the text to share or save. However, existing extraction methods typically rely on text recognition to read the content. In this case, users need to manually locate the desired content to achieve accurate extraction.
[0003] Currently, to facilitate text content extraction for users, the method typically combines the keywords entered by the user and finds the text content the user needs by matching keywords. However, in some cases, there is a discrepancy between the content the user needs and the keywords provided by the user. That is, the keywords given by the user are synonyms of words that appear in the text or other semantically similar words. In this case, it is impossible to accurately extract the content the user needs from the text, resulting in poor accuracy of the content extraction results. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a text content extraction method and apparatus, which can combine the reading semantics of each text token during the process of extracting file content to achieve accurate extraction of text content, thereby improving the accuracy of content extraction results.
[0005] This application provides a method for extracting text content, the method comprising:
[0006] By identifying the text format of the text to be read, the appropriate text reading method for the text to be read is determined;
[0007] When the text reading method is multi-model joint reading, the discrete structured data of the text to be read is obtained by reading the text word by word; wherein, the discrete structured data includes multiple text tokens read from the text to be read;
[0008] Using a semantic analysis model, each text token in the discrete structured data is matrix encoded one by one. During the matrix encoding process, the reading semantics of each text token are added to the token encoding matrix of each text token, and the logical structured data of the text to be read is obtained by integrating them.
[0009] Based on the logically structured data and content extraction requirements, the content extraction method of the text to be read is determined;
[0010] When the content extraction method is model extraction, a text extraction result that meets the content extraction requirements is generated based on the logically structured data and the content extraction requirements through a large language recognition model.
[0011] In one possible implementation, when the text reading method is multi-model joint reading, obtaining the discrete structured data of the text to be read by reading the text character by character includes:
[0012] When the text reading method is multi-model joint reading, the text to be read is converted into an image format to obtain the image text of the text to be read;
[0013] The image text is identified using OCR technology to determine the text attribute data of each character in the text to be read.
[0014] By concatenating the text attribute data of each character, the discrete structured data of the text to be read is obtained.
[0015] In one possible implementation, the step of performing matrix encoding on each text token in the discrete structured data one by one using a semantic analysis model, and adding the reading semantics of each text token to the token encoding matrix of each text token during the matrix encoding process, and integrating them to obtain the logical structured data of the text to be read, includes:
[0016] Using a semantic analysis model, each text token in the discrete structured data is matrix-encoded one by one to obtain the token encoding matrix for each text token;
[0017] For each text token, a semantic representation matrix that matches the reading semantics of the text token is determined by using the token encoding matrix of the text token through a multi-layer neural network.
[0018] The semantic representation matrix of the text token is added to the token encoding matrix of the text token to obtain the semantic encoding matrix of the text token;
[0019] The semantic encoding matrix of each text token is concatenated to obtain the logically structured data of the text to be read.
[0020] In one possible implementation, for each text token, determining the semantic representation matrix of the reading semantics matching the text token using the token encoding matrix of the text token through a multi-layer neural network includes:
[0021] For each text token, a semantic representation matrix representing the reading semantics of the text token is predicted by using a multi-layer neural network, combined with the contextual information of the text token in the text to be read, and searching a preset vocabulary using the token encoding matrix of the text token.
[0022] In one possible implementation, determining the content extraction method for the text to be read based on the logically structured data and content extraction requirements includes:
[0023] By matching the logically structured data with the content extraction requirements, it is determined whether there are text extraction results in the logically structured data that meet the content extraction requirements;
[0024] If not, the content extraction method of the text to be read is determined to be model extraction;
[0025] If so, the content extraction method of the text to be read is determined to be text keyword matching.
[0026] In one possible implementation, the text content extraction method further includes:
[0027] When the content extraction method is text keyword matching, the extraction keywords are parsed from the content extraction requirements;
[0028] The text data in the logically structured data that is annotated with the extraction keywords is determined as the text extraction result that meets the content extraction requirements.
[0029] In one possible implementation, when the content extraction method is model extraction, a text extraction result that meets the content extraction requirements is generated using a large language recognition model based on the logically structured data and the content extraction requirements, including:
[0030] By combining the logically structured data and the content extraction requirements, text prompt data is generated; wherein, the text prompt data includes multiple prompt tokens;
[0031] Each prompt token in the text prompt data is matrix encoded one by one to obtain the prompt encoding matrix of the text prompt data;
[0032] Using a multi-layer neural network, based on the cue encoding matrix, multiple target words that match the cue encoding matrix are predicted by determining the probability distribution between each candidate word in the preset word list and the cue encoding matrix.
[0033] Multiple predicted target words are concatenated to generate text extraction results that meet the content extraction requirements.
[0034] In one possible implementation, a graphical user interface (GUI) is provided via a terminal device, the GUI displaying a function selection area; the text to be read is obtained through the following steps:
[0035] In response to the first trigger operation performed on the file reading control in the function selection area, the file upload area and the progress prompt area are displayed in the graphical user interface;
[0036] In response to a file upload operation performed in the file upload area, the file uploaded by the user in the file upload area is identified as a file to be read, and the file reading progress is displayed in real time in the progress indicator area.
[0037] This application embodiment also provides a text content extraction device, the text content extraction device comprising:
[0038] The reading method identification module is used to determine the appropriate text reading method for the text to be read by recognizing the text format of the text to be read;
[0039] The text reading module is used to obtain the discrete structured data of the text to be read by reading the text character by character when the text reading method is multi-model joint reading; wherein, the discrete structured data includes multiple text tokens read from the text to be read;
[0040] The semantic addition module is used to perform matrix encoding on each text token in the discrete structured data one by one through the semantic analysis model, and add the reading semantics of each text token to the token encoding matrix of each text token during the matrix encoding process, and integrate them to obtain the logical structured data of the text to be read.
[0041] The extraction method identification module is used to determine the content extraction method of the text to be read based on the logical structured data and content extraction requirements.
[0042] The result generation module is used to generate text extraction results that meet the content extraction requirements by using a large language recognition model, based on the logically structured data and the content extraction requirements, when the content extraction method is model extraction.
[0043] In one possible implementation, when the text reading method is multi-model joint reading, the text reading module obtains the discrete structured data of the text to be read by reading the text character by character. The text reading module is used for:
[0044] When the text reading method is multi-model joint reading, the text to be read is converted into an image format to obtain the image text of the text to be read;
[0045] The image text is identified using OCR technology to determine the text attribute data of each character in the text to be read.
[0046] By concatenating the text attribute data of each character, the discrete structured data of the text to be read is obtained.
[0047] In one possible implementation, when the semantic addition module performs matrix encoding on each text token in the discrete structured data one by one using a semantic analysis model, and adds the reading semantics of each text token to the token encoding matrix of each text token during the matrix encoding process, and integrates them to obtain the logical structured data of the text to be read, the semantic addition module is used to:
[0048] Using a semantic analysis model, each text token in the discrete structured data is matrix-encoded one by one to obtain the token encoding matrix for each text token;
[0049] For each text token, a semantic representation matrix that matches the reading semantics of the text token is determined by using the token encoding matrix of the text token through a multi-layer neural network.
[0050] The semantic representation matrix of the text token is added to the token encoding matrix of the text token to obtain the semantic encoding matrix of the text token;
[0051] The semantic encoding matrix of each text token is concatenated to obtain the logically structured data of the text to be read.
[0052] In one possible implementation, the semantic addition module, for each text token, uses a multi-layer neural network and the token encoding matrix of the text token to determine a semantic representation matrix that matches the reading semantics of the text token. The semantic addition module is used to:
[0053] For each text token, a semantic representation matrix representing the reading semantics of the text token is predicted by using a multi-layer neural network, combined with the contextual information of the text token in the text to be read, and searching a preset vocabulary using the token encoding matrix of the text token.
[0054] In one possible implementation, when the extraction method identification module determines the content extraction method of the text to be read based on the logically structured data and content extraction requirements, the extraction method identification module is used to:
[0055] By matching the logically structured data with the content extraction requirements, it is determined whether there are text extraction results in the logically structured data that meet the content extraction requirements;
[0056] If not, the content extraction method of the text to be read is determined to be model extraction;
[0057] If so, the content extraction method of the text to be read is determined to be text keyword matching.
[0058] In one possible implementation, the text content extraction device further includes a keyword matching module, which is used for:
[0059] When the content extraction method is text keyword matching, the extraction keywords are parsed from the content extraction requirements;
[0060] The text data in the logically structured data that is annotated with the extraction keywords is determined as the text extraction result that meets the content extraction requirements.
[0061] In one possible implementation, when the content extraction method is model extraction, and the result generation module generates a text extraction result that meets the content extraction requirements based on the logically structured data and the content extraction requirements using a large language recognition model, the result generation module is used to:
[0062] By combining the logically structured data and the content extraction requirements, text prompt data is generated; wherein, the text prompt data includes multiple prompt tokens;
[0063] Each prompt token in the text prompt data is matrix encoded one by one to obtain the prompt encoding matrix of the text prompt data;
[0064] Using a multi-layer neural network, based on the cue encoding matrix, multiple target words that match the cue encoding matrix are predicted by determining the probability distribution between each candidate word in the preset word list and the cue encoding matrix.
[0065] Multiple predicted target words are concatenated to generate text extraction results that meet the content extraction requirements.
[0066] In one possible implementation, a graphical user interface is provided via a terminal device, the graphical user interface displaying a function selection area; the text content extraction device further includes a text upload module, the text upload module being used to acquire the text to be read through the following steps:
[0067] In response to the first trigger operation performed on the file reading control in the function selection area, the file upload area and the progress prompt area are displayed in the graphical user interface;
[0068] In response to a file upload operation performed in the file upload area, the file uploaded by the user in the file upload area is identified as a file to be read, and the file reading progress is displayed in real time in the progress indicator area.
[0069] In one possible implementation, a graphical user interface is provided via a terminal device, the graphical user interface displaying a function selection area; the text content extraction device further includes a requirement configuration module, the requirement configuration module being used to configure the content extraction requirements through the following steps:
[0070] In response to a second trigger operation performed on the file extraction control in the function selection area, a requirement configuration area and a progress indicator area are displayed in the graphical user interface;
[0071] In response to the requirement configuration operation performed in the requirement configuration area, the configuration of the content extraction requirement is completed, and the requirement configuration progress is displayed in real time in the progress prompt area.
[0072] This application embodiment also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the text content extraction method described above are performed.
[0073] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the text content extraction method described above.
[0074] The text content extraction method and apparatus provided in this application identify the text format of the text to be read and determine the appropriate text reading method for the text to be read. When the text reading method is multi-model joint reading, the discrete structured data of the text to be read is obtained by reading the text character by character. The discrete structured data includes multiple text tokens read from the text to be read. Through a semantic analysis model, each text token in the discrete structured data is matrix encoded one by one, and the reading semantics of each text token is added to the token encoding matrix of each text token during the matrix encoding process, and the logical structured data of the text to be read is integrated. Based on the logical structured data and content extraction requirements, the content extraction method of the text to be read is determined. When the content extraction method is model extraction, a large language recognition model is used to generate a text extraction result that meets the content extraction requirements based on the logical structured data and content extraction requirements. In this way, the reading semantics of each text token involved in the text to be read can be combined to achieve accurate extraction of text content, thereby improving the accuracy of content extraction results. At the same time, the appropriate content extraction method can be selected based on the user's content extraction needs during extraction, thus ensuring both the accuracy and efficiency of text content extraction.
[0075] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0076] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0077] Figure 1 A flowchart illustrating a text content extraction method provided in this application embodiment;
[0078] Figure 2 This is one of the graphical user interface diagrams provided in the embodiments of this application;
[0079] Figure 3 This is a second schematic diagram of a graphical user interface provided in an embodiment of this application;
[0080] Figure 4 This is one of the structural schematic diagrams of a text content extraction device provided in an embodiment of this application;
[0081] Figure 5 This is a second schematic diagram of the structure of a text content extraction device provided in an embodiment of this application;
[0082] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0083] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.
[0084] Research has found that currently, to facilitate text content extraction for users, the method typically combines user-input keywords with keyword matching to find the desired text content. However, in some cases, there is a discrepancy between the content the user needs and the keywords provided by the user. That is, the keywords given by the user are synonyms or other semantically similar words that appear in the text. In such cases, it is impossible to accurately extract the content the user needs from the text, resulting in poor accuracy of the content extraction results.
[0085] Based on this, this application provides a text content extraction method that can combine the reading semantics of each text token involved in the text to be read to achieve accurate extraction of text content, thereby improving the accuracy of the content extraction results. At the same time, it can also select an appropriate content extraction method based on the user's content extraction needs during extraction, thus ensuring both the accuracy and efficiency of text content extraction.
[0086] Please see Figure 1 , Figure 1 This is a flowchart illustrating a text content extraction method provided in an embodiment of this application. Figure 1 As shown in the figure, the text content extraction method provided in this application embodiment includes:
[0087] S101. By recognizing the text format of the text to be read, determine the text reading method applicable to the text to be read.
[0088] S102. When the text reading method is multi-model joint reading, the discrete structured data of the text to be read is obtained by reading the text character by character.
[0089] S103. Using a semantic analysis model, each text token in the discrete structured data is matrix encoded one by one. During the matrix encoding process, the reading semantics of each text token are added to the token encoding matrix of each text token, and the logical structured data of the text to be read is obtained.
[0090] S104. Based on the logically structured data and content extraction requirements, determine the content extraction method for the text to be read.
[0091] S105. When the content extraction method is model extraction, a text extraction result that meets the content extraction requirements is generated based on the logical structured data and the content extraction requirements through a large language recognition model.
[0092] The text content extraction method provided in this application selects a suitable text reading method based on the text format of the text to be read. This avoids using complex text reading methods, as reading simple text formats not only fails to improve the accuracy of the reading results but also reduces the efficiency of text reading. Furthermore, during the text reading process, considering that reading the text character by character using recognition technology to obtain discrete structured data cannot cover the reading semantics of the text, a semantic analysis model is used to incorporate the reading semantics of each text token while performing matrix encoding on the discrete structured data. This allows for the extraction of text content by leveraging reading semantics, thereby improving the accuracy of the extraction results. Simultaneously, before extracting the text content, a suitable content extraction method is selected based on the content extraction requirements to avoid using an unsuitable content extraction method, which would reduce the efficiency of content extraction.
[0093] This feature supports reading text in various formats, including formats that are difficult to read such as PDF, WORD, OFD, scanned documents, and images; as well as formats that are easy to read such as TXT and EXCEL.
[0094] For easily readable text formats such as TXT and EXCEL, existing text reading tools (e.g., pandas) can be used to read the text content. Using complex text reading methods for this type of text content (e.g., AI models) will not only fail to improve the accuracy of the reading results, but will also reduce the efficiency of reading the text. Therefore, before reading text, it is necessary to select an appropriate text reading method based on the text format of the text to be read.
[0095] In step S101, the text format of the text to be read uploaded by the user is identified, the text format of the text to be read is determined, and the text reading method to be adopted for reading the text to be read is determined in combination with the text format of the text to be read.
[0096] Here, considering that text content reading and text content extraction are two different text processing stages; when reading text content, the user needs to upload the text to be read; while when extracting text content, the user needs to configure the content extraction requirements. It is evident that as the text processing stages change, the interface for the user to perform related operations should also change. If all the functional configuration areas (or configuration items) involved in all text processing stages are displayed on the same interface, it is highly likely that obstructed areas will appear in the graphical user interface; or, if the scope of each functional configuration area is too small, users are prone to operational errors, increasing the response frequency of the terminal device.
[0097] Therefore, in this embodiment of the application, users can trigger different interface displays for different file processing stages, so that users can complete the relevant file processing stages.
[0098] In one implementation, a graphical user interface (GUI) is provided via a terminal device, the GUI displaying a function selection area; the text to be read is obtained through the following steps:
[0099] Step 11: In response to the first trigger operation performed on the file reading control in the function selection area, display the file upload area and the progress prompt area in the graphical user interface.
[0100] In this step, when a user has a file reading need, they can trigger the file reading control in the function selection area to display the file upload area and progress prompt area in the graphical user interface. Specifically, in response to the first trigger operation performed by the user on the file reading control in the function selection area, the file upload area is displayed in the graphical user interface so that the user can complete the upload of the file to be read in the file upload area.
[0101] In addition, to facilitate users in viewing the text reading progress, a progress indicator area is displayed in the graphical user interface so that users can understand the file reading progress through the content displayed in the progress indicator area.
[0102] In the solution provided in this application, the user can trigger the execution of the first trigger operation by pressing the control corresponding to the first trigger operation (e.g., a file reading control). Specifically, the user can press the control corresponding to the first trigger operation using a finger, a mouse, or a preset combination of keys. Alternatively, the user can press the control corresponding to the first trigger operation using the L1 button, R1 button on the gamepad, or the Ctrl key, Alt key, and A key on the keyboard. The preset keys can be manually set according to the user's needs. Or, the user can also trigger the execution of the first trigger operation through voice control or preset trigger actions.
[0103] Step 12: In response to the file upload operation performed in the file upload area, identify the file uploaded by the user in the file upload area as the file to be read, and display the file reading progress in real time in the progress prompt area.
[0104] In this step, users can upload files by performing a file upload operation in the file upload area. Specifically, in response to the file upload operation performed by the user in the file upload area, the file uploaded by the user in the file upload area is identified as the file to be read. Furthermore, the file reading progress is displayed in real time in the progress prompt area so that users can keep track of the file reading progress.
[0105] In the solution provided in this application, users can trigger the file upload operation by pressing the control corresponding to the file upload operation (e.g., a file upload control). Specifically, users can press the control corresponding to the file upload operation using their finger, mouse, or preset key combinations. They can also press the control corresponding to the file upload operation using the L1 button, R1 button on the gamepad, or the Ctrl key, Alt key, and A key on the keyboard. The preset keys can be manually set according to user needs. Alternatively, users can also trigger the file upload operation through voice control or preset trigger actions.
[0106] Please see Figure 2 , Figure 2 This is one of the schematic diagrams of a graphical user interface provided as an embodiment of this application. For example... Figure 2As shown, the graphical user interface 2a displays a function selection area 2b, and the function selection area 2b displays a file reading control 2c. In response to the first trigger operation performed by the user on the file reading control 2c, the graphical user interface 2a displays a file upload area 2d and a progress indicator area 2e. The file upload operation performed by the user in the file upload area 2d can complete the upload of the file to be read.
[0107] The text to be uploaded can be dragged and dropped into the file upload area 2d. Alternatively, the desired file can be selected using the file selection control (not shown in the figure) set in the file upload area 2d. The choice of which to use depends on the actual situation and is not limited here.
[0108] Here, the text reading method can be either multi-model joint reading or direct reading; different text reading methods are used for files of different text formats; for example, when the text format is an easily readable text format such as TXT or EXCEL, the direct reading method can be used, and existing text reading tools (such as pandas) can be used to read the text content.
[0109] When the text format is a difficult-to-read format such as PDF, WORD, OFD, scanned document, or image, a multi-model joint reading approach can be adopted, which uses multiple pre-trained text recognition models to jointly read the text content.
[0110] In step S102, when the text reading method is multi-model joint reading, OCR technology can be used to read the text to be read word by word, so as to obtain the discrete structured data of the text to be read by reading the text word by word.
[0111] The discrete structured data includes multiple text tokens read from the text to be read; each text token can represent the read text, phrases, tables, etc., and also includes information such as the position, font, and font size of the text.
[0112] Here, when reading the text to be read, OCR recognition technology can be used to extract the discrete structured data of the text to be read.
[0113] In one implementation, step S102 includes:
[0114] S1021. When the text reading method is multi-model joint reading, the text to be read is converted into an image format to obtain the image text of the text to be read.
[0115] In this step, when the text to be read is read using a multi-model joint reading method, the text to be read is converted into an image format to obtain at least one image text of the text to be read; then, text recognition is performed using OCR technology.
[0116] S1022. Using OCR technology to recognize the image text, determine the text attribute data of each character in the text to be read.
[0117] In this step, OCR technology is used to recognize each character in the text image to be read, so as to determine the text attribute data of each character in the text to be read.
[0118] The text attribute information may include the position of the text in the text to be read, the font, the font size, and other information.
[0119] S1023. Concatenate the text attribute data of each character to obtain the discrete structured data of the text to be read.
[0120] In this step, the text attribute data of each character is concatenated according to the order of each character in the file to be read, so as to complete the initial reading of the text to be read and obtain the discrete structured data of the text to be read.
[0121] Here, considering that discrete structured data is discrete character data and does not include the reading semantics of text, the reading semantics of the file cannot play an auxiliary role in the text extraction process when extracting content. However, reading semantics can effectively improve the accuracy of the file content extraction results. Therefore, in this embodiment of the application, when reading the file, the reading semantics of the read text is taken as part of the text reading process to lay the groundwork for the subsequent text extraction process.
[0122] In step S103, when extracting reading semantics, a semantic analysis model can be used to perform matrix encoding on each text token in the discrete structured data, while adding the determined reading semantics of each text token to the token encoding matrix of each text token, so as to integrate and obtain logical structured data of the text to be read, which includes the reading semantics of the text to be read.
[0123] The semantic analysis model can be a natural language processing model such as the Transformer model.
[0124] Here, a multi-layer neural network can be used to determine the reading semantics of each text token, thereby transforming discrete structured data into logically structured data with reading logic.
[0125] In one implementation, step S103 includes:
[0126] S1031. Using a semantic analysis model, each text token in the discrete structured data is matrix encoded one by one to obtain the token encoding matrix of each text token.
[0127] In this step, a pre-trained semantic analysis model is used to perform matrix encoding on each text token included in the discrete structured data to obtain the token encoding matrix for each text token. In turn, the multi-layer neural network can extract reading semantics based on the token encoding matrix.
[0128] Here, the semantic analysis model can be trained using sample tokens and their sample encoding matrices. Specifically, the sample tokens can be used as input features, and the sample encoding matrices of the sample tokens can be used as output features to train a pre-built semantic analysis model, thereby obtaining a trained semantic analysis model.
[0129] S1032. For each text token, a semantic representation matrix matching the reading semantics of the text token is determined using a multi-layer neural network and the token encoding matrix of the text token.
[0130] In this step, a multi-layer neural network can be used to recognize the reading semantics of text tokens. For each text token, the text token is input into the multi-layer neural network. Through the multi-layer neural network, the semantic representation matrix of the reading semantics that matches the text token is determined using the token encoding matrix of the text token.
[0131] The multi-layer neural network can include multiple self-attention layers, residual connection layers, feedforward layers, regularization layers, and other neuron layers; the multi-head attention layer includes multiple self-attention layers. Here, when matching the reading semantics of a text token, the reading semantics of the text token can be determined by analyzing the context of the text token.
[0132] In one implementation, step S1032 includes: for each text token, using a multi-layer neural network, combining the contextual information of the text token in the text to be read, searching a preset vocabulary using the token encoding matrix of the text token, and predicting a semantic representation matrix that represents the reading semantics of the text token.
[0133] In this step, for each text token, the token encoding matrix of the text token is input into a multi-layer neural network. The multi-layer neural network analyzes the contextual information of the text token in the text to be read, and uses the token encoding matrix of the text token to search a pre-constructed word list. By calculating the probability distribution between the text token and each candidate word, the reading semantics of the text token are predicted, and the semantic representation matrix corresponding to the reading semantics is determined.
[0134] Specifically, firstly, the token encoding matrix of the text token is passed through a self-attention layer and multiplied by the pre-trained first coefficient matrix Wq, second coefficient matrix Wk, and third coefficient matrix Wv to obtain the query matrix, keyword matrix, and value matrix corresponding to the text token.
[0135] Secondly, the query matrix of the text token is multiplied by the keyword matrix of the transposed text token, and the result is divided by the arithmetic square root of the length of the keyword matrix of the text token. After passing through the softmax function, it is multiplied by the value matrix of the text token to obtain the sub-encoding matrix corresponding to the text token.
[0136] Here, after the text token passes through multiple self-attention layers, multiple sub-encoding matrices corresponding to the text token are obtained. After concatenating the multiple sub-encoding matrices corresponding to the text token, they are multiplied by the fourth coefficient matrix Wo to obtain the intermediate encoding matrix of the text token.
[0137] Then, the intermediate encoding matrix of the text token is processed by a feedforward neural network, added to the intermediate encoding matrix of the text token, and then regularized.
[0138] Finally, the regularized result is further processed through a linear layer and a softmax function. By calculating the probability distribution between the text token and each candidate word in the pre-constructed vocabulary, the reading semantics of the text token are predicted, and the semantic representation matrix corresponding to the reading semantics is determined.
[0139] S1033. Add the semantic representation matrix of the text token to the token encoding matrix of the text token to obtain the semantic encoding matrix of the text token.
[0140] S1034. Concatenate the semantic encoding matrix of each text token to obtain the logical structured data of the text to be read.
[0141] In this step, the semantic encoding matrix of each text token is concatenated according to the order of each text token in the file to be read, and integrated to obtain logically structured data of the text to be read with reading logic.
[0142] Here, after obtaining the logically structured data of the text to be read, the text reading process is complete. At this point, the text content can be extracted using the logically structured data with reading logic. When extracting text content, considering that different content extraction needs require different extraction methods, for simpler content extraction needs, keyword matching and other methods can be used to directly extract the text extraction results required for the content extraction needs from the logically structured data. However, for some more complex content extraction needs, it is not possible to directly extract the text extraction results required for the content extraction needs from the logically structured data. In this case, it is necessary to use a large language recognition model to extract the text extraction results.
[0143] In step S104, based on the logical structured data of the text to be read and the content extraction requirements, the difficulty of text extraction is analyzed. That is, it is determined whether the text content to be extracted as indicated by the text extraction requirements can be directly obtained from the logical structured data, thereby determining the content extraction method of the text to be read.
[0144] In one implementation, step S104 includes:
[0145] S1041. By matching the logically structured data with the content extraction requirements, determine whether there are text extraction results in the logically structured data that meet the content extraction requirements.
[0146] In this step, by matching logically structured data with content extraction requirements, it is determined whether there are text extraction results in the logically structured data that meet the content extraction requirements; that is, whether it is possible to directly extract the text extraction results that meet the content extraction requirements from the logically structured data.
[0147] S1042. If not, determine that the content extraction method of the text to be read is model extraction.
[0148] In this step, if there is no text extraction result in the logically structured data that meets the content extraction requirements; that is, if the text extraction result that meets the content extraction requirements cannot be directly extracted from the logically structured data, then the content extraction method of the text to be read is determined to be model extraction.
[0149] S1043. If so, determine that the content extraction method of the text to be read is text keyword matching.
[0150] In this step, if there are text extraction results in the logically structured data that meet the content extraction requirements, that is, the text extraction results that meet the content extraction requirements can be directly extracted from the logically structured data, then the content extraction method of the text to be read is determined to be text keyword matching.
[0151] Considering the slow document extraction speed of the "large language model", this approach determines the content extraction method of the text to be read. Only when the document content is complex (in which case, the content extraction method is model extraction) will the "large language model" be used to extract the results. In this way, simple documents can be extracted at a faster speed, and the use of the large language model for content extraction is avoided when the document content is simple, which alleviates the problem of slow document extraction speed to some extent.
[0152] In step S105, when the content extraction method of the text to be read is model extraction, a pre-trained large language recognition model is used to generate a text extraction result that meets the content extraction requirements based on the read logically structured data with reading logic and the content extraction requirements input by the user.
[0153] In one implementation, step S105 includes:
[0154] S1051. Based on the logically structured data and the content extraction requirements, generate text prompt data.
[0155] In this step, the logically structured data generated by the semantic analysis model and the content extraction requirements (prompt) input by the user are combined to generate a complete prompt, i.e., text prompt data; and the text prompt data is used to achieve the desired result.
[0156] The text prompt data includes multiple prompt tokens.
[0157] S1052. Perform matrix encoding on each prompt token in the text prompt data one by one to obtain the prompt encoding matrix of the text prompt data.
[0158] In this step, each prompt token included in the text prompt data is matrix encoded one by one to obtain the encoding matrix of each prompt token; the encoding matrices of each prompt token are combined to obtain the prompt encoding matrix of the text prompt data.
[0159] S1053. Using a multi-layer neural network, based on the cue encoding matrix, by determining the probability distribution between each candidate word in the preset word list and the cue encoding matrix, multiple target words that match the cue encoding matrix are predicted.
[0160] In this step, a multi-layer neural network can be used to predict each target word involved in the text extraction results; the multi-layer neural network is used to determine the probability distribution between each candidate word in the preset word list and the prompt encoding matrix; the preset word list is sampled according to the probability distribution to predict multiple target words that match the prompt encoding matrix.
[0161] Among them, a multi-layer neural network may include neuron layers such as multi-head self-attention layers, residual connection layers, feedforward layers, and regularization layers; a multi-head attention layer includes multiple self-attention layers.
[0162] Specifically, firstly, the cue encoding matrix is passed through a self-attention layer and compared with the pre-trained first coefficient matrix W. q The second coefficient matrix W k and the third coefficient matrix W v Multiply them to obtain the query matrix, keyword matrix, and value matrix corresponding to the hint encoding matrix.
[0163] Next, the query matrix is multiplied by the transposed keyword matrix, and the result is divided by the arithmetic square root of the length of the keyword matrix. After passing through the softmax function, it is multiplied by the value matrix to obtain the sub-encoding matrix corresponding to the hint encoding matrix.
[0164] Here, after the cue encoding matrix passes through multiple self-attention layers, multiple sub-encoding matrices corresponding to the cue encoding matrix are obtained. These multiple sub-encoding matrices are concatenated and then combined with the fourth coefficient matrix W. o Multiplying them yields the intermediate encoding matrix.
[0165] Then, the intermediate encoding matrix is processed by the feedforward neural network and added to the intermediate encoding matrix before being regularized.
[0166] Finally, the regularized result is further processed through a linear layer and a softmax function to determine the probability distribution between each candidate word in the preset vocabulary and the prompt encoding matrix. Based on the probability distribution, the preset vocabulary is sampled to predict multiple target words that match the prompt encoding matrix.
[0167] S1054. Concatenate the predicted target words to generate a text extraction result that meets the content extraction requirements.
[0168] In another embodiment, the text content extraction method further includes:
[0169] Step a: When the content extraction method is text keyword matching, extract the keywords from the content extraction requirements.
[0170] In this step, when the content extraction method of the text to be read is text keyword matching, the extraction keywords on which the text extraction process is based are parsed from the content extraction requirements; where the extraction keywords are the keywords entered by the user when configuring the content extraction requirements.
[0171] Here, for logically structured data, in the process of incorporating the reading semantics of text tokens, the reading semantics can be regarded as the keyword tags of each text data. In this way, when extracting text, the text content can be extracted by matching keywords.
[0172] Step b: The text data in the logically structured data that is annotated with the extraction keywords is identified as the text extraction result that meets the content extraction requirements.
[0173] In this step, the text data in the logically structured data is marked with keyword tags. When extracting text results from the logically structured data according to the content extraction requirements, the extracted keywords can be searched to identify the text data in the logically structured data marked with the extracted keywords as the text extraction results that meet the content extraction requirements.
[0174] In one implementation, a graphical user interface (GUI) is provided via a terminal device, the GUI displaying a function selection area; the content extraction requirements are configured through the following steps:
[0175] Step 21: In response to the second trigger operation performed on the file extraction control in the function selection area, display the requirement configuration area and the progress prompt area in the graphical user interface.
[0176] In this step, when a user has a file extraction requirement, they can trigger the file extraction control in the function selection area to display the requirement configuration area and progress prompt area in the graphical user interface. Specifically, in response to the second trigger operation performed by the user on the file extraction control in the function selection area, the requirement configuration area is displayed in the graphical user interface so that the user can complete the configuration of the content extraction requirement in the requirement configuration area.
[0177] In addition, to facilitate users in viewing the text extraction progress, a progress indicator area is displayed in the graphical user interface so that users can understand the file extraction progress through the content displayed in the progress indicator area.
[0178] In the solution provided in this application, the user can trigger the execution of the second trigger operation by pressing the control corresponding to the second trigger operation (e.g., a file extraction control). Specifically, the user can press the control corresponding to the second trigger operation using a finger, a mouse, or a preset combination of keys. Alternatively, the user can press the control corresponding to the second trigger operation using the L1 button, R1 button on a gamepad, or the Ctrl key, Alt key, and A key on a keyboard. The preset keys can be manually set according to the user's needs. Or, the user can trigger the execution of the second trigger operation through voice control or preset trigger actions.
[0179] Step 22: In response to the requirement configuration operation performed in the requirement configuration area, complete the configuration of the content extraction requirement, and display the requirement configuration progress in real time in the progress prompt area.
[0180] In this step, users can configure content extraction requirements by performing requirement configuration operations in the requirement configuration area. Specifically, in response to the requirement configuration operations performed by the user in the requirement configuration area, the information entered by the user in the requirement configuration area is determined as the content extraction requirements based on when extracting file content. Furthermore, the file content extraction progress is displayed in real time in the progress prompt area so that users can keep track of the file content extraction progress in real time.
[0181] In the solution provided in this application, users can trigger the execution of a requirement configuration operation by pressing the control corresponding to the requirement configuration operation (e.g., a requirement configuration control). Specifically, users can press the control corresponding to the requirement configuration operation using their fingers, a mouse, and / or preset key combinations. Users can also press the control corresponding to the requirement configuration operation using the L1 button, R1 button on the gamepad, or the Ctrl key, Alt key, and A key on the keyboard. The preset keys can be manually set according to user needs. Alternatively, users can also trigger the execution of the requirement configuration operation through voice control or preset trigger actions.
[0182] Please see Figure 3 , Figure 3 This is a second schematic diagram of a graphical user interface provided as an embodiment of this application. For example... Figure 3 As shown, the graphical user interface 3a displays a function selection area 3b, and the function selection area 3b displays a file extraction control 3c. In response to the second trigger operation performed by the user on the file extraction control 3c, the graphical user interface 3a displays a requirement configuration area 3d and a progress prompt area 3e. The user can complete the configuration of the content extraction requirement by performing the requirement configuration operation in the requirement configuration area 3d.
[0183] The text content extraction method provided in this application embodiment determines the appropriate text reading method by identifying the text format of the text to be read. When the text reading method is multi-model joint reading, the discrete structured data of the text to be read is obtained by reading the text character by character. The discrete structured data includes multiple text tokens read from the text to be read. Through a semantic analysis model, each text token in the discrete structured data is matrix encoded one by one, and the reading semantics of each text token is added to the token encoding matrix of each text token during the matrix encoding process, and integrated to obtain the logical structured data of the text to be read. Based on the logical structured data and content extraction requirements, the content extraction method of the text to be read is determined. When the content extraction method is model extraction, a large language recognition model is used to generate a text extraction result that meets the content extraction requirements based on the logical structured data. In this way, the reading semantics of each text token involved in the text to be read can be combined to achieve accurate extraction of text content, thereby improving the accuracy of content extraction results. At the same time, the appropriate content extraction method can be selected based on the user's content extraction needs during extraction, thus ensuring both the accuracy and efficiency of text content extraction.
[0184] Please see Figure 4 , Figure 5 , Figure 4 This is one of the structural schematic diagrams of a text content extraction device provided in the embodiments of this application. Figure 5 This is a second schematic diagram of a text content extraction device provided in an embodiment of this application. Figure 4 As shown, the text content extraction device 400 includes:
[0185] The reading method identification module 410 is used to determine the text reading method applicable to the text to be read by identifying the text format of the text to be read;
[0186] The text reading module 420 is used to obtain the discrete structured data of the text to be read by reading the text character by character when the text reading method is multi-model joint reading; wherein, the discrete structured data includes multiple text tokens read from the text to be read;
[0187] The semantic addition module 430 is used to perform matrix encoding on each text token in the discrete structured data one by one through the semantic analysis model, and add the reading semantics of each text token to the token encoding matrix of each text token during the matrix encoding process, and integrate them to obtain the logical structured data of the text to be read.
[0188] The extraction method identification module 440 is used to determine the content extraction method of the text to be read based on the logical structured data and content extraction requirements.
[0189] The result generation module 450 is used to generate text extraction results that meet the content extraction requirements by using a large language recognition model, based on the logical structured data and the content extraction requirements, when the content extraction method is model extraction.
[0190] Furthermore, when the text reading module 420 is used in a multi-model joint reading mode, it reads the text to be read character by character to obtain the discrete structured data of the text to be read. The text reading module 420 is used for:
[0191] When the text reading method is multi-model joint reading, the text to be read is converted into an image format to obtain the image text of the text to be read;
[0192] The image text is identified using OCR technology to determine the text attribute data of each character in the text to be read.
[0193] By concatenating the text attribute data of each character, the discrete structured data of the text to be read is obtained.
[0194] Furthermore, when the semantic addition module 430 performs matrix encoding on each text token in the discrete structured data one by one using a semantic analysis model, and adds the reading semantics of each text token to the token encoding matrix of each text token during the matrix encoding process, and integrates them to obtain the logical structured data of the text to be read, the semantic addition module 430 is used to:
[0195] Using a semantic analysis model, each text token in the discrete structured data is matrix-encoded one by one to obtain the token encoding matrix for each text token;
[0196] For each text token, a semantic representation matrix that matches the reading semantics of the text token is determined by using the token encoding matrix of the text token through a multi-layer neural network.
[0197] The semantic representation matrix of the text token is added to the token encoding matrix of the text token to obtain the semantic encoding matrix of the text token;
[0198] The semantic encoding matrix of each text token is concatenated to obtain the logically structured data of the text to be read.
[0199] Furthermore, the semantic addition module 430, for each text token, uses a multi-layer neural network and the token encoding matrix of the text token to determine a semantic representation matrix that matches the reading semantics of the text token. The semantic addition module 430 is used for:
[0200] For each text token, a semantic representation matrix representing the reading semantics of the text token is predicted by using a multi-layer neural network, combined with the contextual information of the text token in the text to be read, and searching a preset vocabulary using the token encoding matrix of the text token.
[0201] Furthermore, when the extraction method identification module 440 determines the content extraction method of the text to be read based on the logically structured data and content extraction requirements, the extraction method identification module 440 is used to:
[0202] By matching the logically structured data with the content extraction requirements, it is determined whether there are text extraction results in the logically structured data that meet the content extraction requirements;
[0203] If not, the content extraction method of the text to be read is determined to be model extraction;
[0204] If so, the content extraction method of the text to be read is determined to be text keyword matching.
[0205] Furthermore, such as Figure 5 As shown, the text content extraction device 400 further includes a keyword matching module 460, which is used for:
[0206] When the content extraction method is text keyword matching, the extraction keywords are parsed from the content extraction requirements;
[0207] The text data in the logically structured data that is annotated with the extraction keywords is determined as the text extraction result that meets the content extraction requirements.
[0208] Furthermore, when the content extraction method is model extraction, and the result generation module 450 generates a text extraction result that meets the content extraction requirements based on the logically structured data and the content extraction requirements using a large language recognition model, the result generation module 450 is used to:
[0209] By combining the logically structured data and the content extraction requirements, text prompt data is generated; wherein, the text prompt data includes multiple prompt tokens;
[0210] Each prompt token in the text prompt data is matrix encoded one by one to obtain the prompt encoding matrix of the text prompt data;
[0211] Using a multi-layer neural network, based on the cue encoding matrix, multiple target words that match the cue encoding matrix are predicted by determining the probability distribution between each candidate word in the preset word list and the cue encoding matrix.
[0212] Multiple predicted target words are concatenated to generate text extraction results that meet the content extraction requirements.
[0213] Furthermore, such as Figure 5 As shown, a graphical user interface is provided through a terminal device, which displays a function selection area; the text content extraction device 400 also includes a text upload module 470, which is used to obtain the text to be read through the following steps:
[0214] In response to the first trigger operation performed on the file reading control in the function selection area, the file upload area and the progress prompt area are displayed in the graphical user interface;
[0215] In response to a file upload operation performed in the file upload area, the file uploaded by the user in the file upload area is identified as a file to be read, and the file reading progress is displayed in real time in the progress indicator area.
[0216] Furthermore, such as Figure 5 As shown, a graphical user interface is provided through a terminal device, which displays a function selection area; the text content extraction device 400 also includes a requirement configuration module 480, which is used to configure the content extraction requirements through the following steps:
[0217] In response to a second trigger operation performed on the file extraction control in the function selection area, a requirement configuration area and a progress indicator area are displayed in the graphical user interface;
[0218] In response to the requirement configuration operation performed in the requirement configuration area, the configuration of the content extraction requirement is completed, and the requirement configuration progress is displayed in real time in the progress prompt area.
[0219] The text content extraction device provided in this application embodiment determines the appropriate text reading method for the text to be read by recognizing its text format. When the text reading method is multi-model joint reading, the discrete structured data of the text to be read is obtained by reading the text character by character. The discrete structured data includes multiple text tokens read from the text to be read. Through a semantic analysis model, each text token in the discrete structured data is matrix encoded one by one, and the reading semantics of each text token is added to the token encoding matrix of each text token during the matrix encoding process, thus integrating to obtain the logical structured data of the text to be read. Based on the logical structured data and content extraction requirements, the content extraction method of the text to be read is determined. When the content extraction method is model extraction, a large language recognition model is used to generate a text extraction result that meets the content extraction requirements based on the logical structured data. In this way, the reading semantics of each text token involved in the text to be read can be combined to achieve accurate extraction of text content, thereby improving the accuracy of content extraction results. At the same time, the appropriate content extraction method can be selected based on the user's content extraction needs during extraction, thus ensuring both the accuracy and efficiency of text content extraction.
[0220] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 600 includes a processor 610, a memory 620, and a bus 630.
[0221] The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 is running, the processor 610 and the memory 620 communicate via the bus 630. When the machine-readable instructions are executed by the processor 610, they can perform the operations described above. Figure 1 The steps of the text content extraction method in the illustrated method embodiment are described in detail in the method embodiment, and will not be repeated here.
[0222] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the text content extraction method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.
[0223] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0224] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0225] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0226] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0227] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0228] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for extracting text content, characterized in that, The text content extraction method includes: By identifying the text format of the text to be read, the appropriate text reading method is determined; when the text format is easy to read, a direct reading method is used; when the text format is difficult to read, a multi-model joint reading method is used. When the text reading method is multi-model joint reading, the discrete structured data of the text to be read is obtained by reading the text character by character; wherein, the discrete structured data includes multiple text tokens read from the text to be read; the discrete structured data is composed of concatenated text attribute data of each character extracted from the text to be read; Using a semantic analysis model, each text token in the discrete structured data is matrix encoded one by one. During the matrix encoding process, the reading semantics of each text token are added to the token encoding matrix of each text token, and the logical structured data of the text to be read is obtained by integrating them. Based on the logically structured data and content extraction requirements, the content extraction method for the text to be read is determined; the content extraction method is either text keyword matching or model extraction. When the content extraction method is model extraction, a large language recognition model is used to generate a text extraction result that meets the content extraction requirements based on the logically structured data and the content extraction requirements. Specifically, this includes: generating text prompt data by combining the logically structured data and the content extraction requirements; wherein, the text prompt data includes multiple prompt tokens; performing matrix encoding on each prompt token in the text prompt data one by one to obtain the prompt encoding matrix of the text prompt data; using a multi-layer neural network, based on the prompt encoding matrix, predicting multiple target words that match the prompt encoding matrix by determining the probability distribution between each candidate word in a preset word list and the prompt encoding matrix; concatenating the predicted multiple target words to generate a text extraction result that meets the content extraction requirements.
2. The text content extraction method according to claim 1, characterized in that, When the text reading method is multi-model joint reading, the discrete structured data of the text to be read is obtained by reading the text character by character, including: When the text reading method is multi-model joint reading, the text to be read is converted into image format to obtain the image text of the text to be read; The image text is identified using OCR technology to determine the text attribute data of each character in the text to be read. By concatenating the text attribute data of each character, the discrete structured data of the text to be read is obtained.
3. The text content extraction method according to claim 1, characterized in that, The process involves using a semantic analysis model to perform matrix encoding on each text token in the discrete structured data, and adding the reading semantics of each text token to its token encoding matrix during the matrix encoding process. This integration yields the logically structured data of the text to be read, including: Using a semantic analysis model, each text token in the discrete structured data is matrix-encoded one by one to obtain the token encoding matrix for each text token; For each text token, a semantic representation matrix that matches the reading semantics of the text token is determined by using the token encoding matrix of the text token through a multi-layer neural network. The semantic representation matrix of the text token is added to the token encoding matrix of the text token to obtain the semantic encoding matrix of the text token; The semantic encoding matrix of each text token is concatenated to obtain the logically structured data of the text to be read.
4. The text content extraction method according to claim 3, characterized in that, For each text token, a semantic representation matrix matching the reading semantics of that text token is determined using a multi-layer neural network and the token encoding matrix of that text token. This includes: For each text token, a semantic representation matrix representing the reading semantics of the text token is predicted by using a multi-layer neural network, combined with the contextual information of the text token in the text to be read, and searching a preset vocabulary using the token encoding matrix of the text token.
5. The text content extraction method according to claim 1, characterized in that, The step of determining the content extraction method for the text to be read based on the logically structured data and content extraction requirements includes: By matching the logically structured data with the content extraction requirements, it is determined whether there are text extraction results in the logically structured data that meet the content extraction requirements; If not, the content extraction method of the text to be read is determined to be model extraction; If so, the content extraction method of the text to be read is determined to be text keyword matching.
6. The text content extraction method according to claim 5, characterized in that, The text content extraction method also includes: When the content extraction method is text keyword matching, the extraction keywords are parsed from the content extraction requirements; The text data in the logically structured data that is annotated with the extraction keywords is determined as the text extraction result that meets the content extraction requirements.
7. The text content extraction method according to claim 1, characterized in that, A graphical user interface is provided through a terminal device, and the graphical user interface displays a function selection area; The text to be read is obtained through the following steps: In response to the first trigger operation performed on the file reading control in the function selection area, the file upload area and the progress prompt area are displayed in the graphical user interface; In response to a file upload operation performed in the file upload area, the file uploaded by the user in the file upload area is identified as a file to be read, and the file reading progress is displayed in real time in the progress indicator area.
8. The text content extraction method according to claim 1, characterized in that, A graphical user interface is provided through a terminal device, and the graphical user interface displays a function selection area; Configure the content extraction requirements using the following steps: In response to a second trigger operation performed on the file extraction control in the function selection area, a requirement configuration area and a progress indicator area are displayed in the graphical user interface; In response to the requirement configuration operation performed in the requirement configuration area, the configuration of the content extraction requirement is completed, and the requirement configuration progress is displayed in real time in the progress prompt area.
9. A text content extraction device, characterized in that, The text content extraction device includes: The reading method identification module is used to determine the appropriate text reading method for the text to be read by recognizing the text format of the text to be read; when the text format is an easy-to-read text format, a direct reading method is used; when the text format is an difficult-to-read text format, a multi-model joint reading method is used. The text reading module is used to obtain discrete structured data of the text to be read by reading the text character by character when the text reading method is multi-model joint reading; wherein, the discrete structured data includes multiple text tokens read from the text to be read; the discrete structured data is composed of concatenated text attribute data of each character extracted from the text to be read; The semantic addition module is used to perform matrix encoding on each text token in the discrete structured data one by one through the semantic analysis model, and add the reading semantics of each text token to the token encoding matrix of each text token during the matrix encoding process, and integrate them to obtain the logical structured data of the text to be read. The extraction method identification module is used to determine the content extraction method of the text to be read based on the logical structured data and content extraction requirements; the content extraction method is either text keyword matching or model extraction. The result generation module is used to generate text extraction results that meet the content extraction requirements when the content extraction method is model extraction, by using a large language recognition model, based on the logically structured data and the content extraction requirements. Specifically, the result generation module is used to: generate text prompt data by combining the logically structured data and the content extraction requirements; wherein the text prompt data includes multiple prompt tokens; perform matrix encoding on each prompt token in the text prompt data to obtain the prompt encoding matrix of the text prompt data; use a multi-layer neural network, based on the prompt encoding matrix, predict multiple target words that match the prompt encoding matrix by determining the probability distribution between each candidate word in a preset word list and the prompt encoding matrix; and concatenate the predicted multiple target words to generate text extraction results that meet the content extraction requirements.