Method and apparatus for extracting information from formatted text
Patent Information
- Application Number
- CN202011308474.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-19
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2040-11-19
AI Technical Summary
Existing technologies have low accuracy when extracting information from formatted text, mainly because important metadata and spatial location information are lost during the conversion of formatted text to unformatted text, resulting in inaccurate extraction results.
Information extraction is performed by directly utilizing feature information at the text block level, including data information, metadata information, and spatial location information. This identifies target category text blocks in formatted text and improves accuracy through a binary classification model.
It improves the accuracy of information extraction, has a wide range of applications, is not limited by formatted text templates or whether text blocks span multiple lines, and enhances the accuracy and flexibility of recognition.
Smart Images

Figure CN112487138B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of information technology and artificial intelligence technology, and in particular to a method and apparatus for extracting information from formatted text. Background Technology
[0002] Information extraction (IE) is an important task in natural language processing (NLP). Information extraction can be understood as: extracting shorter, relevant content from longer texts based on user needs, using certain technical means. For example, if a user's need is to extract "the content of their desired job" from a resume, then the process of using certain technical means to achieve this is called information extraction.
[0003] Text includes formatted text (text with layout, TWL) (such as resumes, air waybills, invoices, etc.) and unformatted text. Currently, information extraction methods for text are usually methods for extracting information from unformatted text.
[0004] If information extraction is required from formatted text, the traditional technique involves first converting the formatted text to unformatted text, and then extracting information based on the plain text features in the unformatted text. However, because the conversion process only retains the data information from the formatted text, it leads to low accuracy in information extraction from formatted text. Summary of the Invention
[0005] This application provides a method and apparatus for extracting information from formatted text, which helps to improve the accuracy of information extraction from formatted text.
[0006] To achieve the above objectives, this application provides the following technical solution:
[0007] Firstly, a method for extracting information from formatted text is provided. This method includes: first, determining the text blocks belonging to a target category within the formatted text to be extracted; second, identifying the text blocks belonging to the target category within the formatted text based on text block-level feature information; and third, outputting the identifiers of the text blocks belonging to the target category within the formatted text. The implementing entity of this technical solution can be a terminal or a network device. This technical solution directly uses text block-level feature information to extract information from formatted text. Since text block-level feature information is relatively rich, including not only data information but also metadata information and spatial location information, compared with traditional techniques, selecting appropriate text block-level feature information helps improve the accuracy of information extraction results. Furthermore, this technical solution is not limited by the template of the formatted text, nor by whether the text blocks span multiple lines, thus having a wide range of applications.
[0008] In one possible design, the target category can be any category. In the detailed implementation section below, the target category may include a first category or a second category, etc.
[0009] In one possible design, text blocks belonging to the target category within formatted text are identified based on feature information at the text block level. This includes: determining whether a text block belongs to the target category based on its feature information within the formatted text. Using the text block's own feature information to identify whether it belongs to the target category is simple to implement.
[0010] In one possible design, based on feature information at the text block level, text blocks belonging to a target category in formatted text are identified. This includes: identifying whether a text block to be identified in the formatted text belongs to the target category based on the feature information of the target text block in the formatted text. The target text block is a text block that has a preset positional relationship with the text block to be identified. This technical solution takes into account that "in formatted text, the category to which a text block belongs is influenced by the feature information of text blocks that have a preset positional relationship with that text block." Thus, by selecting appropriate target text blocks, the accuracy of information extraction results can be improved, and the implementation is simple.
[0011] In one possible design, text blocks belonging to the target category within formatted text are identified based on text block-level feature information. This includes: determining whether the text block to be identified belongs to the target category based on the feature information of the text block to be identified within the formatted text and the feature information of the target text block within the formatted text. The target text block is a text block that has a predetermined positional relationship with the text block to be identified. Combining the feature information of the text block itself with the feature information of the text block "having a predetermined positional relationship" to jointly determine whether the text block to be identified belongs to the target category helps improve the accuracy of information extraction results.
[0012] In one possible design, the target text block is a text block within a preset range of the text block to be identified. That is, the target text block is a text block that is relatively close to the text block to be identified, which helps to further improve the accuracy of information extraction results.
[0013] In one possible design, the target text block is a text block located at a preset position relative to the text block to be identified, and adjacent to it. Optionally, the preset position may include at least one of the following: directly above, directly below, directly to the left, or directly to the right. Optionally, the preset position may include a horizontal or vertical position. Thus, selecting an appropriate preset position can help further improve the accuracy of the information extraction results.
[0014] In one possible design, the text block granularity feature information includes at least one of the following: text block data information; text block metadata information; or, text block spatial location information.
[0015] In one possible design, the data information of a text block, also known as the text data information of the text block, includes: information about the text data itself, and information obtained through statistical analysis based on the information about the text data itself.
[0016] In one possible design, the data information of a text block includes at least one of the following: the total length of the strings in the text block; whether the text block contains preset characters or preset strings; the total number of preset characters or preset strings contained in the text block; the proportion of preset characters or preset strings contained in the text block to the total number of characters in the text block; whether the text block contains preset keywords; whether the text block contains preset named entities; or, whether the text block contains preset formatting information. Of course, the specific implementation is not limited to these, and the specific data information included can be determined based on actual needs.
[0017] In one possible design, the metadata information of a text block includes at least one of the following: the font, font size, color, whether it is bold, italic, or underlined. Of course, the specific implementation is not limited to these; the specific metadata information included can be determined based on actual needs.
[0018] In one possible design, the spatial location information of the text block includes at least one of the following: the distance of the text block relative to the page edge of the formatted text, such as at least one of the top margin, bottom margin, left margin, or right margin; or, the distance of the text block relative to a reference text block in the formatted text. The reference text block can be one or more text blocks in the formatted text that have specific data information, specific metadata information, or a specific spatial location.
[0019] In one possible design, determining which text blocks belonging to a target category in formatted text need to be extracted includes: receiving a request message that requests the extraction of text blocks belonging to the target category from the formatted text. In other words, one device can determine which text blocks belonging to the target category need to be extracted from the formatted text upon request from another device.
[0020] In one possible design, before determining which text blocks belonging to the target category need to be extracted from the formatted text, the method further includes: displaying a first user interface containing first and second instruction information. The first instruction information instructs the user to input the formatted text, and the second instruction information instructs the user to input an identifier of the target category. This user-interactive approach helps improve the user experience.
[0021] In one possible design, during the process of identifying text blocks belonging to the target category in formatted text based on text block-level feature information, the method further includes: displaying a second user interface containing third instruction information to indicate to the user that an information extraction process is being performed. This user interface-based human-computer interaction helps improve the user experience.
[0022] In one possible design, outputting identifiers for text blocks belonging to the target category within the formatted text includes displaying a third user interface, which contains these identifiers. This user-interface-based human-computer interaction helps improve the user experience.
[0023] In one possible design, based on text block-level feature information, text blocks belonging to the target category in formatted text are identified. This includes: first, obtaining a binary classification model that characterizes whether a text block belongs to the target category; then, inputting the text block-level feature information into the binary classification model to obtain the output result. This possible design transforms the identification of text block categories into a binary classification problem, which is simple to implement and not limited to the type and template of formatted text, nor to whether the text blocks in the formatted text span multiple lines, thus having a wide range of applications.
[0024] In one possible design, obtaining a binary classification model includes: acquiring N features of the target category, where N features are represented by text block-level feature information as described above, and N is an integer greater than or equal to 1; acquiring a training set comprising multiple text blocks, all of which belong to the target category; performing feature extraction based on the N features for each text block to obtain a feature combination corresponding to the target category; and training the binary classification model based on the multiple feature combinations obtained for the multiple text blocks. This possible design provides a specific implementation method for training a binary classification model. The execution entity of this possible design can be a terminal or a network device; that is, the terminal or network device itself trains and obtains the binary classification model and performs the information extraction process based on the binary classification model.
[0025] In one possible design, the method further includes displaying a fourth user interface containing fourth and fifth instruction information. The fourth instruction information indicates to the user the identifier of the target category and N features, while the fifth instruction information indicates to the user the training set. This user interface-based human-computer interaction helps improve the user experience.
[0026] In one possible design, the method further includes displaying a fifth user interface containing sixth instruction information, which indicates to the user that a second classification model is being trained. This user interface-based human-computer interaction helps improve the user experience.
[0027] In one possible design, acquiring the binary classification model includes receiving a binary classification model published by a network device. The entity executing this possible design could be a terminal. That is, the terminal can download the binary classification model from the network device and perform an information extraction process based on the downloaded binary classification model.
[0028] Secondly, an information extraction device for formatted text is provided.
[0029] In one possible design, the formatted text information extraction device is used to execute the formatted text information extraction method provided in the first aspect above. This application can divide the formatted text information extraction device into functional modules based on the method provided in the first aspect above. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. For example, this application can divide the formatted text information extraction device into a determining unit, an identifying unit, and an output unit, etc., according to their functions. The descriptions of the possible technical solutions and beneficial effects of the various functional modules described above can be found in the technical solutions provided in the first aspect above or its corresponding possible designs, and will not be repeated here.
[0030] In another possible design, the information extraction device for formatted text includes a memory and one or more processors coupled together. The memory stores computer instructions, and the processor invokes these instructions to perform any of the methods provided by the first aspect and any of its possible design embodiments.
[0031] Thirdly, this application provides a computer-readable storage medium, such as a non-transient computer-readable storage medium. A computer program (or instructions) is stored thereon, which, when executed on a formatted text extraction device, causes the formatted text extraction device to perform any method provided by any possible implementation of the first aspect described above.
[0032] Fourthly, this application provides a computer program product that, when run on a computer, causes any method provided by any possible implementation of the first aspect to be executed.
[0033] Fifthly, this application provides a chip system comprising: a processor, the processor being configured to retrieve and execute a computer program stored in a memory, performing any of the methods provided in the implementation of the first aspect.
[0034] It is understood that any of the formatted text information extraction devices, computer storage media, or computer program products provided above can be applied to the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.
[0035] In this application, the name of the aforementioned information extraction device with formatted text does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear under other names. As long as the function of each device or functional module is similar to that of this application, it falls within the scope of the claims of this application and its equivalents.
[0036] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description
[0037] Figure 1 This is a schematic diagram of a resume applicable to embodiments of this application;
[0038] Figure 2 This application provides a schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
[0039] Figure 3 A flowchart illustrating a method for extracting information from formatted text, provided in an embodiment of this application;
[0040] Figure 4 A flowchart illustrating another information extraction method provided in this application embodiment;
[0041] Figure 5 A schematic diagram illustrating the changes in the user interface during the information extraction process provided in this application embodiment;
[0042] Figure 6 A flowchart illustrating a method for training a binary classification model provided in an embodiment of this application;
[0043] Figure 7 A schematic diagram illustrating a specific example of training a binary classification model provided in an embodiment of this application;
[0044] Figure 8 This application provides a schematic diagram illustrating the changes in the user interface during the training of a binary classification model.
[0045] Figure 9 A schematic diagram of the structure of an information extraction device for formatted text provided in an embodiment of this application;
[0046] Figure 10 This is a schematic diagram of the structure of a chip system provided in an embodiment of this application;
[0047] Figure 11 A conceptual partial view of a computer program product provided for an embodiment of this application. Detailed Implementation
[0048] The following explains some of the terms and techniques used in this application:
[0049] 1) Formatted text, unformatted text
[0050] The text in a document is organized and arranged according to a certain format to form a formatted text.
[0051] Formatted text contains multiple blocks of text. These blocks typically consist of grouped text data, separated by spaces or other methods. For example, in... Figure 1 In the resume shown, "Kang Xiao*" is a text block, "Current Company:" is a text block, and "Shenzhen ** Co., Ltd." is a text block. Other examples are not listed here. For specific implementation methods of dividing formatted text into multiple text blocks, please refer to existing technologies.
[0052] Formatted text can not only display the data information of a text block, but also metadata information, such as the font, font size, font color, whether it is bold, italic, or underlined; in addition, it can also display the spatial location information of the text block, such as the position of the text block within the formatted text, and the spatial relationship between the text block and other text blocks. For example, text edited in Word can be formatted text.
[0053] In terms of application examples, formatted text can include: resumes, air waybills, invoices, etc.
[0054] Unformatted text consists of only one default format (such as font, line spacing, etc.). Unformatted text only conveys data information. For example, text edited in Notepad is usually unformatted.
[0055] 2) Types of formatted text, templates for formatted text.
[0056] The type of formatted text is determined based on its function. For example, the types of formatted text can include: resumes, air waybills, invoices, etc. Furthermore, the types of formatted text can be further subdivided; for example, invoices can be further divided into special VAT invoices and general VAT invoices.
[0057] Formatted text of the same type can have different templates. The template for formatted text can be determined by the meaning and layout of the text blocks within it. For example, air waybills from different countries typically use different templates. Similarly, resumes can have different templates.
[0058] 3) Keywords
[0059] Keywords, also known as subject terms, are words, phrases, or short sentences that represent the meaning of a text.
[0060] The embodiments of this application do not limit the algorithm used to extract keywords from text. For example, the algorithm may include at least one of the following: term frequency–inverse document frequency (TF-IDF) algorithm, latent dirichlet allocation (LDA) algorithm, or TextRank algorithm, etc.
[0061] 4) Named Entities
[0062] Named entities are entities in text that have a specific meaning, or things that can be identified by proper nouns (or names). A named entity generally represents a unique individual thing. For example, the individual thing can include a person's name, a place name, an organization name, or other proper nouns. In addition, it can also include time, quantity, currency, proportion, etc.
[0063] 5) Other terms
[0064] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0065] In the embodiments of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0066] In this application, the term "at least one" means one or more, and the term "multiple" means two or more. For example, multiple second messages refer to two or more second messages.
[0067] It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0068] It should also be understood that the term "and / or" as used herein refers to and covers any and all possible combinations of one or more of the associated listed items. The term "and / or" describes an association between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " in this application generally indicates that the preceding and following related objects are in an "or" relationship.
[0069] It should also be understood that, in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0070] It should be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0071] It should also be understood that the term “comprising” (also referred to as “includes”, “including”, “comprises” and / or “comprising”) as used in this specification specifies the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0072] It should also be understood that the term "if" can be interpreted as meaning "when" or "upon" or "in response to determination" or "in response to detection." Similarly, depending on the context, the phrases "if determination..." or "if detection [the stated condition or event]" can be interpreted as meaning "when determination..." or "in response to determination..." or "when detection [the stated condition or event]" or "in response to detection [the stated condition or event]."
[0073] It should be understood that the phrases "an embodiment," "an embodiment," and "a possible implementation" used throughout the specification mean that a specific feature, structure, or characteristic related to an embodiment or implementation is included in at least one embodiment of this application. Therefore, the phrases "in an embodiment," "an embodiment," or "a possible implementation" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0074] In traditional techniques, if information extraction is required from formatted text, the usual approach is to first convert the formatted text to unformatted text, and then extract information based on the plain text features (i.e., data information) within the unformatted text. Methods for extracting information from plain text features in unformatted text include:
[0075] Method 1: Use regular expressions (regex or RE) for information extraction. Regular expressions, also known as standard expressions, are a concept in computer science. A regular expression uses a single string to describe and match a series of strings that conform to a certain syntax rule.
[0076] For example, if the regular expression for the category "name" in a template is "name:**", and the user's requirement is to extract text data of the category "name" from new text under that template, then the computer device can use "name:**" to match the text data in the new text and output the matching text data.
[0077] Because regular expressions are strongly dependent on text templates, changing the text template will cause the regular expression to become invalid. Therefore, the applicability of techniques using regular expressions for information extraction is limited. For example, if the format of "name" in a template is "name,**", then the regular expression "name:**" cannot be used for information extraction.
[0078] Method 2: Use named entity recognition (NER) for information extraction.
[0079] This method first requires converting multiple historical formatted texts into unformatted texts. For text data of a specific category within the unformatted text, sequence labeling is then performed. Next, a machine learning model is trained on the sequence-labeled dataset using the NER algorithm. Finally, this machine learning model is used to identify text data of that category within the unformatted text.
[0080] Because formatted text often contains text blocks that span multiple lines, converting it to unformatted text typically involves scanning line by line. Therefore, the text data of such blocks may appear discontinuous and span multiple lines in the unformatted text. This poses a challenge to sequence labeling, thus limiting the applicability of techniques using named entity recognition for information extraction.
[0081] For example, such as Figure 1In the resume shown, the text block "Currently employed, exploring new opportunities" spans multiple lines. When the resume is converted to unformatted text, the four text blocks "Current Status:", "Currently employed, exploring new opportunities", "Registered Residence:", and "Guangdong, Shenzhen" are converted to "Current Status: Currently employed" and "Registered Residence: Guangdong, Shenzhen, exploring new opportunities". Furthermore, "Current Status: Currently employed" is on one line, while "Registered Residence: Guangdong, Shenzhen, exploring new opportunities" is on another line. Therefore, it is clear that the text data "Currently employed, exploring new opportunities" is non-continuous and spans multiple lines in unformatted text.
[0082] Based on this, embodiments of this application provide a method for extracting information from formatted text. This method directly uses text block-level feature information to extract information from formatted text. Since text block-level feature information is relatively rich, including not only data information but also metadata information, spatial location information, etc., compared with traditional techniques, selecting appropriate text block-level feature information helps improve the accuracy of information extraction results. Furthermore, this technical solution is not limited by the template of the formatted text, nor by whether the text block spans multiple lines, thus having a wide range of applications.
[0083] The technical solutions provided in this application can be applied to scenarios that include terminals, or scenarios that include both terminals and network devices. This application does not limit the specific form of the terminals and network devices. For example, the terminal can be a scanner, digital camera, mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, and personal digital assistant (PDA), etc. The network device can be a cloud server, etc.
[0084] When applied in scenarios involving terminals and network devices, the network device can be a cloud server. This cloud server provides cloud services to the terminal, indicating that the network device has a service for extracting information from formatted text. Specifically, this information extraction service is one that "extracts information from text blocks of a certain category within formatted text based on feature information at the text block level." This cloud service can improve the accuracy of formatted text recognition. For example, a terminal can request this cloud service from the network device when it needs to extract information from text blocks of a certain category within formatted text.
[0085] like Figure 2The diagram shown is a hardware structure schematic of a computer device 10 provided in an embodiment of this application. This computer device can be either a terminal or a network device as described above. The computer device 10 may include a processor 11, a memory 12, a communication interface 13, and a bus 14. The processor 11, memory 12, and communication interface 13 are connected via the bus 14.
[0086] The processor 11 is the control center of the computer device 10. It can be a general-purpose central processing unit (CPU) or other general-purpose processors. The general-purpose processor can be a microprocessor or any conventional processor.
[0087] As an example, processor 11 may include one or more CPUs, for example Figure 2 CPU 0 and CPU 1 are shown in the diagram.
[0088] The memory 12 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0089] In one possible implementation, the memory 12 can exist independently of the processor 11. The memory 12 can be connected to the processor 11 via a bus 14 and is used to store data, instructions, or program code. When the processor 11 calls and executes the instructions or program code stored in the memory 12, it can implement the information extraction method for formatted text provided in the embodiments of this application, or the method for training a binary classification model.
[0090] In another possible implementation, the memory 12 can also be integrated with the processor 11.
[0091] Communication interface 13 is used for computer device 10 to connect with other devices via a communication network, which may be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. Communication interface 13 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
[0092] Bus 14 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, a peripheral component interconnect express (PCIe) bus, or an extended industry standard architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 2 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0093] It should be pointed out that, Figure 2 The structure shown does not constitute a limitation on computer device 10, except... Figure 2 In addition to the components shown, the computer device 10 may include more or fewer components than those shown, or combine certain components.
[0094] The technical solutions provided in the embodiments of this application will be described below with reference to the accompanying drawings:
[0095] like Figure 3 The diagram shown is a flowchart illustrating a method for extracting information from formatted text according to an embodiment of this application. Specifically, the information extraction method can be understood as extracting text blocks belonging to one or more categories from formatted text. This embodiment uses the extraction of text blocks belonging to the first category from formatted text as an example for illustration.
[0096] Figure 3 The method shown may include the following steps:
[0097] S101: The terminal determines that it needs to extract text blocks from the formatted text that belong to the first category.
[0098] The formatted text can be any formatted text with information extraction requirements. This application does not limit the type of formatted text, nor does it limit the template of the formatted text.
[0099] In one example, for a paper resume, a user can use a terminal to photograph the resume, obtaining an image. The terminal performs character recognition on the image, thereby translating the information on the paper resume into computer text. For example, the terminal can use optical character recognition (OCR) technology to translate the information on the paper resume into computer text. The text containing this computer text can be used as the formatted text in S101.
[0100] The first category can be any category of text blocks that require identification. Typically, the first category is the category to which one or more text blocks in the formatted text belong.
[0101] In one example, upon receiving instruction information, such as user-inputted instruction information or instruction information sent by other devices (such as network devices or other terminals), the terminal determines that it needs to extract text blocks belonging to a first category from the formatted text. The instruction information includes an identifier of the formatted text and an identifier of at least one category, used to indicate the extraction of text blocks from the formatted text that belong to each of the at least one category. The terminal can use any one of the at least one categories as the first category.
[0102] For example, if a user's requirement is to extract "content of the desired position" from a resume, the formatted text could be the resume itself, and the first category could be the desired position.
[0103] S102: The terminal divides the formatted text into multiple text blocks.
[0104] The specific implementation method for this step can be found in existing technologies, and will not be elaborated here.
[0105] S103: The terminal identifies text blocks belonging to the first category in the formatted text based on the feature information at the text block granularity.
[0106] Optionally, S103 can be implemented using any of the following methods 1-3:
[0107] Method 1: The terminal identifies whether the text block to be identified belongs to the first category based on the feature information of the text block to be identified in the formatted text.
[0108] Method 2: The terminal identifies whether the text block to be identified belongs to the first category based on the feature information of the target text block in the formatted text.
[0109] Method 3: The terminal identifies whether the text block to be identified belongs to the first category based on the feature information of the text block to be identified in the formatted text and the feature information of the target text block in the formatted text.
[0110] The text block to be identified can be any one of the multiple text blocks obtained in S102. For example, the terminal can sequentially identify each text block as the text block to be identified based on its number.
[0111] Optionally, the text block to be recognized is the text block containing the "content of the parameter" in the formatted text.
[0112] Understandably, formatted text often contains parameters and their contents as separate text blocks. One parameter can correspond to one or more parameter contents. For example, in a resume, the phrase "desired position" is one text block, while the content of the desired position, "software engineer," is another. Similarly, in an air waybill, the phrase "shipper information" is one text block, while the content of the shipper information can include "shipper address," "shipper name," and "shipper contact information," etc. If the shipper information specifically includes: Address A, Zhang San, 139****, then "Address A," "Zhang San," and "139****" are each a separate text block.
[0113] Typically, users want to extract the content of parameters, not the parameters themselves. For example, if a user wants to extract the text block for the "desired position" category from a resume, the text block to be identified could be the text block containing the "desired position content". Similarly, if a user wants to extract the text block for the "shipper information" category from an air waybill, the text block to be identified could be the text block containing the "shipper information content".
[0114] Of course, in specific implementations, the text block to be identified can also be other text blocks in the formatted text, and this application embodiment does not limit this.
[0115] Understandably, the data information in a text block cannot fully represent its meaning. For example, the text block "Software Engineer" in a resume has different meanings depending on whether its left neighbor (the text block directly to its left and adjacent to it) is "Desired Position" or "Current Position". Similarly, the text block "Zhang San" in an air waybill has different meanings depending on whether its left neighbor is "Shipper Information" or "Consignee Information".
[0116] Based on this, in some embodiments of this application (such as method 2 or method 3 above), the terminal can identify the category of another text block by combining the feature information of one text block. In method 2 and method 3 above, the target text block is a text block that has a preset positional relationship with the text block to be identified.
[0117] In one implementation, the target text block is a text block within a preset range of the text block to be identified. This preset range can be a regular shape such as a rectangle, circle, ellipse, or semicircle, or it can be an irregular shape; this application embodiment does not limit this. Furthermore, this application embodiment does not limit the size of the preset range.
[0118] In another implementation, the target text block is a text block located at a preset position and adjacent to the text block to be recognized. Optionally, the preset position may include at least one of the following: directly above, directly below, directly to the left, or directly to the right. Optionally, the preset position may include a horizontal or vertical position. The specific preset position(s) can be determined based on the position of the text block(s) in the formatted text that are related to the text block to be recognized.
[0119] For example, taking the two text blocks “desired position” and “desired position content” as examples, “desired position” is usually located to the left or above “desired position content” and is adjacent to “desired position content”. Therefore, if the text block to be identified is “desired position content”, the preset position can be to the left or above.
[0120] The following section explains the feature information at the text block granularity level. Here, the text block can be either the text block to be identified mentioned above, or the target text block mentioned above.
[0121] Optionally, the feature information of the text block includes at least one of the following: the data information of the text block, the metadata information of the text block, or the spatial location information of the text block. These are explained below:
[0122] First, the data information of the text block
[0123] The data information of a text block, also known as the text data information of a text block, can include: information about the text data itself, as well as information obtained through statistical analysis based on the information about the text data itself.
[0124] Optionally, the data information of the text block includes at least one of the following:
[0125] 1) The total length of the strings in the text block.
[0126] The total length of the strings contained in the text to be identified can be represented by the total number of characters contained in the string. For example, if the text block is the string "zhangsan", then the total length of the string in the text block is 8.
[0127] 2) Whether the text block contains preset characters or preset strings.
[0128] 3) The total number of preset characters or preset strings contained in the text block.
[0129] 4) The proportion of preset characters or preset strings contained in the text block to the total number of characters in the text block.
[0130] Optionally, the preset characters can be one or more of letters, numbers, or special characters. Letters can be further divided into uppercase and lowercase letters. For example, special characters can include at least one of the following: *, #, @, %, ﹩, or &, etc.
[0131] Optionally, the preset string can be a string composed of one or more of letters, numbers, or special characters.
[0132] 5) Does the text block contain preset keywords?
[0133] The preset keywords can be extracted from the first category of text blocks in multiple historical formatted texts using a keyword extraction algorithm. There can be one or more preset keywords.
[0134] 6) Whether the text block contains a pre-defined named entity.
[0135] The number of predefined named entities can be one or more.
[0136] 7) Does the text block contain preset formatting information?
[0137] For example, the preset format information can be a date (such as year, month, day) or a time (such as hour and minute).
[0138] Second, the metadata information of the text block.
[0139] Optionally, the metadata information of the text block includes one or more of the following: font (such as KaiTi, SongTi, etc.), font size, color, whether it is bold, whether it is italic, or whether it has an underline.
[0140] Third, the spatial location information of the text block
[0141] The spatial location information of a text block is the position of the text block within the formatted text.
[0142] In one implementation, the location information can be characterized by the distance of the text block relative to the page edge of the formatted text (i.e., the page margin).
[0143] The page margin can be one or more of the following: top page margin, bottom page margin, left page margin, or right page margin. The top page margin is the distance between the text block and the top edge of the formatted text. The bottom page margin is the distance between the text block and the bottom edge of the formatted text. The left page margin is the distance between the text block and the left edge of the formatted text. The right page margin is the distance between the text block and the right edge of the formatted text.
[0144] In another implementation, the location information can be characterized by the distance of the text block relative to a reference text block in the formatted text.
[0145] The reference text block can be any text block within the formatted text.
[0146] Optionally, a reference text block is a text block within the formatted text that contains one or more of the following: specific data information, specific metadata information, or a specific spatial location. For example, in Figure 1 In the resume shown, since the text block “Kang Xiao*” is bold and has the largest font size, it can be used as a reference text block.
[0147] It should be noted that the specific feature information of a text block can be determined based on actual needs. For example, taking the extraction of text blocks related to the desired job title from a resume as an example, assuming that the desired job title is usually displayed in bold, then "whether it is bold" can be used as the feature information of the text block. Similarly, taking the extraction of text blocks related to the graduating institution from a resume as an example, graduating institutions usually include predefined named entities such as "university" and "college," so "whether it contains a university" or "whether it contains a college" can be used as the feature information of the text block.
[0148] Optionally, S103 may include: the terminal acquiring a binary classification (BC) model, which characterizes whether a text block belongs to the first category. Then, the terminal inputs the text block-level feature information into the binary classification model to obtain the output result.
[0149] Taking the identification of whether a text block belongs to the first category as an example, the binary classification model here corresponds to the first category. This binary classification model is used to characterize whether a text block belongs to the first category. The output result is that the text block to be identified belongs to the first category, or the text block to be identified does not belong to the first category. The text block-level feature information input to this binary classification model can be the feature information of the text block to be identified and / or the feature information of the target text block.
[0150] Specifically, the terminal can pre-store a binary classification model corresponding to each category. Each binary classification model is used to determine whether the category of a text block belongs to the category corresponding to that binary classification model. This application embodiment does not limit the source of any binary classification model pre-stored in the terminal for any category; for example, the terminal can execute... Figure 6 The method shown can be used to train a binary classification model corresponding to the category. For example, the terminal can download the binary classification model corresponding to the category from the network device.
[0151] This optional implementation transforms the identification of text block categories into a binary classification problem. It is simple to implement and is not limited to the type and template of formatted text, nor is it limited to whether the text blocks in the formatted text span multiple lines, so it has a wide range of applications.
[0152] After recognizing a text block in the formatted text, the terminal can select another text block from the multiple text blocks in S102 as the text block to be recognized and execute S103 as described above. This process continues until the terminal has selected all text blocks in the formatted text as the text blocks to be recognized and executes S103 as described above; or until the terminal has determined a preset number of text blocks belonging to the first category in the formatted text. Of course, the termination condition is not limited to these. Next, the terminal can execute S104.
[0153] S104: The terminal outputs the identifier of the text block in the formatted text that belongs to the first category.
[0154] The identifier of a text block is used to uniquely identify that text block. For example, the terminal can assign a uniform number to all text blocks in the formatted text, with different text blocks having different numbers, and use each text block's number as its identifier.
[0155] Specifically, if it is determined in S103 that the text block to be recognized belongs to the first category, then the identifier of the text block of the first category output in S104 includes the identifier of the text block to be recognized. If it is determined in S103 that the text block to be recognized does not belong to the first category, then the identifier of the text block of the first category output in S104 does not include the identifier of the text block to be recognized.
[0156] This application does not limit the specific implementation of the method by which the terminal outputs the identifier of the text block belonging to the first category in the formatted text. For example, the terminal can display the identifier of the text block belonging to the first category in the formatted text through a display device (such as a display screen), or it can play the identifier of the text block belonging to the first category in the formatted text through a voice output device (such as a speaker).
[0157] It should be noted that if the terminal treats each text block in the formatted text as a text block to be identified and executes S103, and no text block belonging to the first category is found, the terminal can output information indicating that the formatted text does not contain a text block belonging to the first category. This embodiment of the application does not limit the specific content of this indication information.
[0158] The above describes a method for extracting information from text blocks of the first category. In some embodiments of this application, the terminal can use S101-S104 described above to identify whether a text block in the formatted text belongs to the second category, where the second category is any category other than the first category. Similarly, text blocks of multiple categories can be extracted from the formatted text, thereby achieving information extraction based on multiple categories.
[0159] The information extraction method provided in this application directly uses text block-level feature information to extract information from formatted text. Since text block-level feature information is relatively rich, including not only data information but also metadata and spatial location information, it helps improve the accuracy of information extraction results compared to traditional techniques, provided appropriate text block-level feature information is selected. Furthermore, this technical solution is not limited to formatted text templates or whether text blocks span multiple lines, thus having a wide range of applications.
[0160] It should be noted that in traditional techniques, converting formatted text to unformatted text does not preserve data at the text block level, but rather at the entire text block level. This can lead to inaccurate information extraction during the process, as the complete data of the text block may not be accurately obtained, resulting in low accuracy in extracting information from formatted text. The technical solution provided in this embodiment, however, extracts information directly based on text block-level information. Therefore, even though this embodiment only uses the data of the text block to be identified for information extraction, it differs from traditional techniques and helps improve the accuracy of information extraction from formatted text.
[0161] For example, referring to the example of information extraction using named entity recognition mentioned above, the text block "Currently employed, exploring new opportunities" is non-continuous across multiple lines in unformatted text, which poses difficulties for sequence labeling. Consequently, the accuracy of extracting data information from the text block "Currently employed, exploring new opportunities" in unformatted text is not high. However, in the technical solution provided by the embodiments of this application, the terminal can directly extract the complete data information "Currently employed, exploring new opportunities" from the text block, thus achieving higher accuracy.
[0162] It should be noted that, Figure 3The method illustrated uses a terminal as the execution subject as an example. The steps described above can be replaced by network devices to obtain new embodiments. Alternatively, the information extraction method can also be executed jointly by the terminal and network devices, as shown below. Figure 4 The illustrated embodiments illustrate this.
[0163] like Figure 4 The diagram shown is a flowchart illustrating another information extraction method provided in an embodiment of this application. Figure 4 The method shown may include the following steps:
[0164] S201: The terminal sends a request message to the network device, which requests the extraction of text blocks belonging to a first category from formatted text. Optionally, the request message includes the formatted text and an identifier of the first category.
[0165] S202: Based on the request message, the network device divides the formatted text into multiple text blocks.
[0166] S203: The network device identifies text blocks belonging to the first category in the formatted text based on text block granularity feature information.
[0167] S204: The network device sends an identifier of a text block belonging to the first category in formatted text to the terminal. S204 is the specific implementation method of the network device outputting the identifier of the text block belonging to the first category in formatted text.
[0168] S205: Identifier of a text block belonging to the first category in the formatted text output by the terminal.
[0169] The explanations of relevant terms, the specific implementation methods of relevant steps, and the corresponding beneficial effects in this embodiment can all be found in the above description. Figure 3 The relevant parts of the embodiments shown will not be repeated here.
[0170] It should be noted that the above Figure 3 and Figure 4 The application scenarios of the information extraction method for formatted text provided in this application are merely illustrative examples, and the specific implementation is not limited to these.
[0171] In terms of product implementation, as an example, network devices can... Figure 3 or Figure 4The steps performed by the terminal in the illustrated method are released as a software function module, such as an application (APP), or as a sub-function of an APP, released along with the APP. The terminal can obtain the software function by downloading the APP on a network device.
[0172] Subsequently, the terminal can display the following sequentially: Figure 5 The user interface shown interacts with the user to achieve the software's function (i.e., the function of extracting information from formatted text). Specifically, it may include the following steps:
[0173] Step 1: The terminal displays the first user interface, such as... Figure 5 As shown in Figure a, the first user interface includes a "Input Formatted Text" option box 401, an "Input Target Category" option box 402, and a start button 403.
[0174] Option box 401 is used by the user to input formatted text into the terminal. For example, by clicking option box 401 and selecting the storage path of the compressed file containing the formatted text in the terminal, the user can import the compressed file containing the formatted text into the software module.
[0175] Option box 402 is used by the user to input the target category into the terminal, that is, the target category of the text block, such as the first category, the second category, etc. mentioned above. For example, the user can enter the text information "first category (such as desired position)" in option box 402.
[0176] The start button 403 is used to receive user touch operations so that the terminal can start executing the information extraction method. Specifically, the user can enter the corresponding information in option boxes 401 and 402 and then click the start button 403. After the terminal detects the operation, it starts executing the information extraction method.
[0177] Step 2: After receiving the operation for the start button 403 based on the first user interface, the terminal executes the information extraction method, for example, executing... Figure 3 As shown in S101-S103; or, for example, by interacting with network devices, performing actions such as... Figure 4 S201-S204 are shown.
[0178] Step 3: During the information extraction process, the terminal displays a second user interface, such as... Figure 5 Figure b in the diagram. The second user interface includes a "Information extraction in progress..." option box 404.
[0179] This 404 error message indicates that the terminal is performing an information extraction process. In reality, it could be that the terminal itself is performing the information extraction process, such as... Figure 3 S101-S103 shown may also refer to the interaction between the terminal and the network device to perform an information extraction process, such as performing... Figure 4 S201-S204 are shown.
[0180] Step 4: After the terminal completes the information extraction process, it can display a third user interface, such as... Figure 5 As shown in Figure c, the third user interface contains the information extraction results, namely the identifiers of text blocks belonging to the target category within the formatted text. Figure 3 The example used is text blocks 1, 3, and 5 belonging to the target category in a formatted text.
[0181] It should be noted that Figure 5 The user interface change process shown is merely an example and does not constitute a limitation on the user interface change process during the information extraction process provided in the embodiments of this application.
[0182] like Figure 6 The diagram shown is a flowchart illustrating a method for training a binary classification model according to an embodiment of this application. The method is executed by a computer device, which can be a terminal or a network device.
[0183] Figure 6 The method shown may include the following steps:
[0184] S301: The computer device acquires N features of the first category. These N features are those represented by the text block-level feature information mentioned above, and N is an integer greater than or equal to 1.
[0185] S302: The computer device acquires a training set, which includes multiple text blocks belonging to the first category from multiple historical formatted texts.
[0186] Historical formatted text refers to known formatted text containing text blocks belonging to the first category. Different historical formatted texts can be of the same or different types. Furthermore, different historical formatted texts belonging to the same type can have the same or different templates.
[0187] Each historical formatted text may contain one or more text blocks of the first category.
[0188] In one example, each historical formatted text is manually labeled with text blocks belonging to the first category, and the labeling results are input into a computer device so that the computer device can identify the text blocks belonging to the first category in each historical formatted text.
[0189] For example, if the first category is "name", then since resumes, air waybills, etc., typically contain names, each historical formatted text can be a formatted text containing names, such as a resume or air waybill. Executing S302 specifically includes: the computer device acquiring text blocks from multiple historical formatted texts whose category is "name".
[0190] S303: For each of the multiple text blocks, the computer device performs feature extraction based on the N features to obtain a feature combination corresponding to the first category.
[0191] In one example, S303 is equivalent to: the computer device extracts features from each of the multiple text blocks using N feature extractors, resulting in a feature combination corresponding to the first category. Here, the feature corresponding to each of the N feature extractors is a feature represented by a feature information at the text block granularity level mentioned above.
[0192] A feature extractor is a logical functional module used for feature extraction. A feature extractor can be implemented in software, hardware, or a combination of both; this application does not limit this approach.
[0193] The N features based on the first category can be predefined, such as data information, metadata information, spatial location information, and relationships with other text blocks in the historical formatted text, which are combined with the text blocks of the first category.
[0194] S304: The computer device trains the model based on the combination of features obtained from the multiple text blocks to obtain the binary classification model corresponding to the first category.
[0195] The embodiments of this application do not limit the specific implementation of the binary classification model. For example, the binary classification model can be at least one of the following: deep neural network (DNN), support vector machine (SVM), or extreme gradient boosting (XGBoost).
[0196] like Figure 7 The diagram shown is a schematic representation of the implementation process of a specific example of S302-S304 above.
[0197] Suppose we have three historical formatted text files: three resumes (labeled Resume 1-3), and the first category is the desired job title. After executing S302, the text blocks of the first category in these three historical resumes will be Text Block 1-3, respectively. Here, S302 corresponds to... Figure 7 Step 1 in the process.
[0198] Considering that the text block "Desired Position Content" in a resume typically has the following characteristics:
[0199] First, the "content of the desired position" usually contains specific keywords.
[0200] Second, compared to other text blocks, the "content of the desired position" is usually highlighted (e.g., in bold).
[0201] Third, “desired position” is usually the left neighbor of “desired position content”, and “desired position” can be expressed in various ways, such as “job seeking position”, “applied position”, or “expected position”, etc., and these different expressions contain specific keywords.
[0202] Therefore, for a text block whose first category is "desired job title", N features can include: whether the text block of the first category itself contains the first keyword, whether the text block of the first category itself is bolded, whether the left neighbor of the text block of the first category contains the preset second keyword, etc.
[0203] The first keyword can be obtained by extracting keywords from text blocks 1-3, specifically from the data information "algorithm engineer," "software engineer," and "data analyst." For example, the first keyword could be "engineer." The extraction of the first keyword corresponds to... Figure 7 Step 2 in the process.
[0204] If the left neighbor data information of text blocks 1-3 in resumes 1-3 are "desired position", "job sought", and "applied position", then the second keyword can be obtained by computer equipment through keyword extraction based on "desired position", "job sought", and "applied position", such as the second keyword being "position". The extraction of the second keyword corresponds to... Figure 7 Step 3 in the process.
[0205] Based on this, the feature extraction results obtained by the computer device after executing S303 are shown in Table 1. Here, S303 can correspond to... Figure 7 Step 4 in the process.
[0206] Table 1
[0207]
[0208] Based on Table 1, the "Yes, Yes, Yes" in the row containing text block 1 represents a feature combination obtained by extracting features from N features based on the first category (i.e., "desired job title") from text block 1. Therefore, Table 1 contains 3 feature combinations.
[0209] Table 1 illustrates the example of a structured data table formed by multiple feature extraction results. In actual implementation, the specific storage method of these multiple feature combinations is not limited in this application embodiment.
[0210] Based on this example, when executing S304, training is performed based on the feature combinations in Table 1 to obtain a binary classification model corresponding to the desired job. Here, S304 can correspond to... Figure 7 Step 5 in the process.
[0211] Based on the binary classification model corresponding to the expected job obtained from this example, the above process is performed. Figure 3 or Figure 4 When using the information extraction method shown, the first category is the desired job title, and the specific feature information of the target text block is: whether the text block is bolded, whether the text block contains the keyword "engineer", and whether the left neighbor of the text block contains the keyword "job title".
[0212] Figure 7 The method shown is illustrated using the training of a binary classification model corresponding to the first category as an example. In actual implementation, computer equipment can follow... Figure 7 The method shown trains binary classification models corresponding to multiple categories.
[0213] In product implementation, since training a binary classification model requires significant computing and storage resources, it is typically trained by network devices, which then distribute the trained model for terminals to download and use to perform information extraction methods. Alternatively, network devices can directly use the binary classification model to perform information extraction methods. Of course, this application does not exclude the technical solution of having a terminal train the binary classification model and directly use it to perform information extraction methods.
[0214] like Figure 8 The diagram shown illustrates the changes in the user interface during the training of a binary classification model according to an embodiment of this application. Specifically, it may include the following steps:
[0215] Step 1: The network device displays a fourth user interface, such as... Figure 8 As shown in Figure a, the fourth user interface includes a "Input target category identifier and corresponding features" option box 801, an "Input training set" option box 802, and a start button 803.
[0216] Option box 801 is used to instruct the user to input the identifier of the target category and the features corresponding to the target category, i.e., the category identifier corresponding to the binary classification model trained in this instance, and the text block granularity features used when identifying text blocks of that category. For example, based on Figure 7 In the illustrated embodiment, the user can enter the "desired position" in option box 801 and the three features from Table 1 in option box 802.
[0217] Option box 802 is used to prompt the user to input the training set. For example, combined with Figure 7 In the illustrated embodiment, the user can enter "feature information of text blocks 1-3" in option box 802, where the features indicated by the feature information are the three features shown in Table 1.
[0218] The start button 803 is used to receive user touch operations so that the network device can begin executing the method of training a binary classification model. Specifically, the user can enter the corresponding information in option boxes 801 and 802 and then click the start button 803. After the network device detects the operation, it begins executing the method of training a binary classification model.
[0219] Step 2: After receiving the user's operation on the start button 803 based on the fourth user interface, the network device begins to execute the method for training the binary classification model, as described above. Figure 6 The method shown.
[0220] Step 3: During the process of training the binary classification model, the network device can display a fifth user interface, such as... Figure 8 As shown in Figure b, the fifth user interface may include a "Training..." option box 804 to prompt the user that the network device is currently training a binary classification model.
[0221] Step 4: After the network device has trained the binary classification model, it can display a sixth user interface, such as... Figure 8 As shown in Figure c, the sixth user interface may include a "Training Complete" checkbox 805 to notify the user that the network device has completed training the binary classification model.
[0222] It should be noted that, Figure 8 The illustrated user interface change process is merely an example and does not limit the user interface change process during the training of the binary classification model provided in this application embodiment. Furthermore, the network device can also test the trained binary classification model and, upon successful testing, publish the model.
[0223] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0224] This application embodiment can be used to extract information from formatted text (such as the above method example) based on the above method example. Figure 3 The terminal or in the illustrated embodiment Figure 4 The network device in the illustrated embodiment is divided into functional modules. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0225] like Figure 9 As shown, Figure 9 A schematic diagram of the structure of a formatted text information extraction device 70 provided in an embodiment of this application is shown. This formatted text information extraction device 70 is used to perform the above-described formatted text information extraction method, for example, performing... Figure 3 The steps performed by the terminal in the method for extracting information from formatted text, as shown, include, for example, executing... Figure 4 The steps performed by the network device in the method for extracting information from formatted text are illustrated. For example, the formatted text extraction apparatus 70 may include a determining unit 701, an identifying unit 702, and an output unit 703.
[0226] The determining unit 701 is used to determine the text blocks belonging to the target category in the formatted text that need to be extracted. The recognizing unit 702 is used to recognize the text blocks belonging to the target category in the formatted text based on the feature information at the text block granularity. The output unit 703 is used to output the identifiers of the text blocks belonging to the first category in the formatted text. For example, combined with... Figure 3 The determining unit 701 can be used to execute S101, the identifying unit 702 can be used to execute S103, and the output unit 703 can be used to execute S104. For example, combined with... Figure 4The determining unit 701 can be used to execute the receiving step corresponding to S201, the identifying unit 702 can be used to execute S203, and the output unit 703 can be used to execute S204.
[0227] Optionally, the recognition unit 702 is specifically used to: identify whether the text block to be recognized belongs to the target category based on the feature information of the text block to be recognized in the formatted text.
[0228] Optionally, the recognition unit 702 is specifically used to: identify whether the text block to be recognized in the formatted text belongs to the target category based on the feature information of the target text block in the formatted text; wherein, the target text block is a text block that has a preset positional relationship with the text block to be recognized.
[0229] Optionally, the recognition unit 702 is specifically used to: identify whether the text block to be recognized belongs to the target category based on the feature information of the text block to be recognized in the formatted text and the feature information of the target text block in the formatted text.
[0230] Optionally, the target text block is a text block within a preset range of the text block to be recognized.
[0231] Optionally, the target text block is a text block located at a preset position of the text block to be identified and adjacent to the text block to be identified.
[0232] Optionally, the text block granularity feature information includes at least one of the following: text block data information; text block metadata information; or, text block spatial location information.
[0233] Optionally, the data information of the text block includes at least one of the following: the total length of the strings in the text block; whether the text block contains preset characters or preset strings; the total number of preset characters or preset strings contained in the text block; the proportion of preset characters or preset strings contained in the text block to the total number of characters in the text block; whether the text block contains preset keywords; whether the text block contains preset named entities; or, whether the text block contains preset format information.
[0234] Optionally, the metadata information of the text block includes at least one of the following: the font, font size, color, whether it is bold, whether it is italic, or whether it is underlined.
[0235] Optionally, the spatial location information of the text block includes at least one of the following: the distance of the text block relative to the page edge of the formatted text; or, the distance of the text block relative to a reference text block in the formatted text.
[0236] Optionally, the information extraction device 70 for formatted text further includes: an acquisition unit 704, used to acquire a binary classification model, which characterizes whether a text block belongs to a target category. In this case, the recognition unit 702 is specifically used to: input the feature information at the text block level into the binary classification model to obtain the output result.
[0237] Optionally, in the process of acquiring the binary classification model, the acquisition unit 704 is specifically used to: acquire N features of the target category, where N features are features represented by text block-level feature information, and N is an integer greater than or equal to 1; acquire a training set, which includes multiple text blocks, all of which belong to the target category; for each text block, perform feature extraction based on the N features to obtain a feature combination corresponding to the target category; and train the binary classification model based on the multiple feature combinations obtained for the multiple text blocks. For example, combined with... Figure 6 The acquisition unit 704 can be used to execute S301-S304.
[0238] Optionally, the information extraction device 70 for formatted text may further include a receiving unit 705.
[0239] Optionally, the receiving unit 705 is used to receive the binary classification model published by the network device.
[0240] Optionally, the receiving unit 705 is used to receive a request message, which is used to request the extraction of text blocks belonging to the target category from the formatted text.
[0241] Optionally, the information extraction device 70 further includes a display unit 706. It should be noted that the output unit 703 and the display unit 706 may be the same or different. For example, when the output unit 703 outputs information based on voice, the two are different; however, when the output unit 703 outputs information based on text, the two can be the same. Figure 9 The example used to illustrate the differences between the two is this.
[0242] Optionally, the display unit 706 is used to display a first user interface before the determining unit 701 determines that text blocks belonging to the target category in the formatted text need to be extracted. The first user interface includes first instruction information and second instruction information. The first instruction information is used to instruct the user to input the formatted text, and the second instruction information is used to instruct the user to input the identifier of the target category.
[0243] Optionally, the display unit 706 is used to display a second user interface when the recognition unit 702 performs the process of recognizing text blocks belonging to the target category in the formatted text based on the feature information at the text block granularity. The second user interface contains third instruction information, which is used to indicate to the user that the information extraction process is being performed.
[0244] Optionally, display unit 706 is used to display a third user interface, which contains identifiers of text blocks belonging to the target category in formatted text.
[0245] Optionally, the display unit 706 is used to display a fourth user interface before the acquisition unit 704 acquires the N features of the target category and the training set. The fourth user interface contains a fourth instruction information and a fifth instruction information. The fourth instruction information is used to instruct the user to input the identifier of the target category and the N features, and the fifth instruction information is used to instruct the user to input the training set.
[0246] Optionally, the display unit 706 is used to display a fifth user interface during the training process performed by the acquisition unit 704. The fifth user interface contains a sixth instruction information, which is used to indicate to the user that a second classification model is being trained.
[0247] For a detailed description of the above-mentioned optional methods, please refer to the foregoing method embodiments, which will not be repeated here. Furthermore, the explanation of any of the formatted text information extraction devices 70 provided above, as well as the description of their beneficial effects, can be found in the corresponding method embodiments described above, and will not be repeated here.
[0248] As an example, combined Figure 2 The functions implemented by some or all of the determining unit 701, recognizing unit 702, and acquiring unit 704 in the information extraction device 70 for formatted text can be achieved through... Figure 2 Processor 11 in the middle executes Figure 2 The program code in memory 12 is used for implementation. If the formatted text extraction device 70 is a terminal, the output unit 703 can be implemented through a display device (such as a display screen) and / or a voice output device (such as a speaker). If the formatted text extraction device 70 is a network device, the output unit 703 can be implemented through... Figure 2 The transmitting unit in communication interface 23 is used for implementation. The receiving unit 705 can be implemented through... Figure 2 The receiving unit in the communication interface 23 is implemented. The display unit 706 can be implemented by a display device (such as a display screen).
[0249] This application also provides a chip system, such as... Figure 10 As shown, the chip system includes at least one processor 81 and at least one interface circuit 82. As an example, when the chip system 80 includes a processor and an interface circuit, the processor can be... Figure 10 The processor 81 shown in the solid box (or the processor 81 shown in the dashed box) can be an interface circuit. Figure 10The interface circuit 82 is shown in the solid box (or the dashed box). When the chip system 80 includes two processors and two interface circuits, the two processors include... Figure 10 The processor 81 shown in the solid box and the processor 81 shown in the dashed box, these two interface circuits include Figure 10 Interface circuit 82 is shown in both solid and dashed boxes. No limitations are imposed on this.
[0250] The processor 81 and the interface circuit 82 can be interconnected via a line. For example, the interface circuit 82 can be used to receive signals (e.g., signals from a vehicle speed sensor or an edge service unit). As another example, the interface circuit 82 can be used to send signals to other devices (e.g., the processor 81). Exemplarily, the interface circuit 82 can read instructions stored in memory and send those instructions to the processor 81. When the instructions are executed by the processor 81, the information extraction device for formatted text can perform the steps in the above embodiments. Of course, the chip system may also include other discrete components, and this application embodiment does not specifically limit this.
[0251] Another embodiment of this application provides a computer-readable storage medium storing instructions that, when executed on a formatted text extraction device, cause the formatted text extraction device to perform... Figure 3 The method embodiments shown in the diagram illustrate the various steps executed by the terminal in the method flow, or the execution of... Figure 4 The method embodiments shown illustrate the various steps performed by the network device in the method flow. Furthermore, the formatted text extraction device can also be used to perform... Figure 6 The illustrated method embodiment shows the various steps performed by the computer device in the method flow.
[0252] In some embodiments, the disclosed method may be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of art.
[0253] Figure 11 A conceptual partial view of a computer program product provided in an embodiment of this application is shown schematically. The computer program product includes a computer program for executing computer processes on a computing device.
[0254] In one embodiment, a computer program product is provided using a signal carrying medium 90. The signal carrying medium 90 may include one or more program instructions that, when executed by one or more processors, can provide the above-mentioned... Figure 3 or Figure 4 or Figure 6The described function or part of the function. Therefore, for example, refer to... Figure 3 One or more features of S101 to S104 can be assumed by one or more instructions associated with the signal carrying medium 90. Furthermore, Figure 11 The program instructions in the document also describe example instructions.
[0255] In some examples, the signal carrying medium 90 may include a computer-readable medium 91, such as, but not limited to, a hard disk drive, a compact disc (CD), a digital video optical disc (DVD), a digital magnetic tape, a memory, read-only memory (ROM), or random access memory (RAM), etc.
[0256] In some implementations, the signal carrying medium 90 may include a computer recordable medium 92, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, and so on.
[0257] In some implementations, the signal carrying medium 90 may include a communication medium 93, such as, but not limited to, digital and / or analog communication media (e.g., fiber optic cables, waveguides, wired communication links, wireless communication links, etc.).
[0258] The signal-bearing medium 90 can be transmitted by a wireless communication medium 93 (e.g., a wireless communication medium conforming to the IEEE 802.11 standard or other transmission protocols). One or more program instructions can be, for example, computer-executable instructions or logical implementation instructions.
[0259] In some examples, such as targeting Figure 11 The described information extraction device for formatted text can be configured to provide various operations, functions, or actions in response to one or more program instructions in a computer-readable medium 91, a computer-recordable medium 92, and / or a communication medium 93.
[0260] It should be understood that the arrangements described herein are for illustrative purposes only. Therefore, those skilled in the art will understand that other arrangements and other elements (e.g., machines, interfaces, functions, sequences, and functional groups, etc.) can be used instead, and some elements may be omitted depending on the desired outcome. Furthermore, many of the described elements are functional entities that can be implemented as discrete or distributed components, or in any suitable combination and location with other components.
[0261] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When these computer instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks, SSDs).
[0262] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for extracting information from formatted text, characterized in that, The method includes: Identify the text blocks belonging to the target category that need to be extracted from the formatted text; Based on text block-level feature information, a binary classification model is used to identify text blocks belonging to the target category in the formatted text; the text block-level feature information includes at least one of the following: feature information of the text block to be identified in the formatted text, feature information of the target text block in the formatted text; the text block-level feature information includes at least one of the following: data information of the text block; metadata information of the text block; or, spatial location information of the text block; The data information of the text block includes at least one of the following: the total length of the strings in the text block; whether the text block contains preset characters or preset strings; the total number of preset characters or preset strings contained in the text block; the proportion of preset characters or preset strings contained in the text block to the total number of characters in the text block; whether the text block contains preset keywords; whether the text block contains preset named entities; or, whether the text block contains preset format information. The metadata information of the text block includes at least one of the following: the font, font size, color, whether it is bold, whether it is italic, or whether it is underlined; The spatial location information of the text block includes at least one of the following: the distance of the text block relative to the page edge of the formatted text; or, the distance of the text block relative to a reference text block in the formatted text; and outputting the identifier of the text block in the formatted text that belongs to the target category.
2. The method according to claim 1, characterized in that, The feature information based on text block granularity, identifying text blocks belonging to the target category in the formatted text, includes: Based on the feature information of the text block to be identified in the formatted text, it is determined whether the text block to be identified belongs to the target category.
3. The method according to claim 1, characterized in that, The feature information based on text block granularity, identifying text blocks belonging to the target category in the formatted text, includes: Based on the feature information of the target text block in the formatted text, identify whether the text block to be identified in the formatted text belongs to the target category; Alternatively, based on the feature information of the text block to be identified in the formatted text and the feature information of the target text block in the formatted text, it can be identified whether the text block to be identified belongs to the target category; The target text block is a text block that has a preset positional relationship with the text block to be identified.
4. The method according to claim 3, characterized in that, The target text block is a text block within a preset range of the text block to be identified; Alternatively, the target text block is a text block located at a preset position on the text block to be identified and adjacent to the text block to be identified.
5. The method according to any one of claims 1 to 4, characterized in that, The process of determining which text blocks belonging to the target category need to be extracted from the formatted text includes: A request message is received, which is used to request the extraction of text blocks belonging to the target category from the formatted text.
6. The method according to any one of claims 1 to 4, characterized in that, Before determining which text blocks belonging to the target category need to be extracted from the formatted text, the method further includes: A first user interface is displayed, which includes first instruction information and second instruction information. The first instruction information is used to instruct the user to input the formatted text, and the second instruction information is used to instruct the user to input the identifier of the target category.
7. The method according to any one of claims 1 to 4, characterized in that, In the process of executing the text block-level feature information to identify text blocks belonging to the target category in the formatted text, the method further includes: A second user interface is displayed, which contains a third instruction message indicating that the user is performing an information extraction process.
8. The method according to any one of claims 1 to 4, characterized in that, The step of outputting the identifiers of text blocks belonging to the target category in the formatted text includes: A third user interface is displayed, which contains identifiers of text blocks belonging to the target category in the formatted text.
9. The method according to any one of claims 1 to 4, characterized in that, The feature information based on text block granularity, identifying text blocks belonging to the target category in the formatted text, includes: Obtain a binary classification model, wherein the binary classification model characterizes whether a text block belongs to the target category; The feature information at the text block granularity is input into the binary classification model to obtain the output result.
10. The method according to claim 9, characterized in that, The acquisition of the binary classification model includes: Obtain N features of the target category, where the N features are features represented by the feature information at the text block granularity, and N is an integer greater than or equal to 1; Obtain a training set, which includes multiple text blocks, all of which belong to the target category; For each of the plurality of text blocks, feature extraction based on the N features is performed to obtain a feature combination corresponding to the target category; The binary classification model is obtained by training multiple feature combinations obtained from the multiple text blocks.
11. The method according to claim 10, characterized in that, The method further includes: A fourth user interface is displayed, which includes a fourth instruction and a fifth instruction. The fourth instruction is used to instruct the user to input the identifier of the target category and the N features, and the fifth instruction is used to instruct the user to input the training set.
12. The method according to claim 10, characterized in that, During the training process, the method further includes: The fifth user interface is displayed, which contains a sixth instruction message indicating that the user is training the binary classification model.
13. The method according to claim 9, characterized in that, The acquisition of the binary classification model includes: The binary classification model is received from the network device.
14. An information extraction device for formatted text, characterized in that, The device includes: The determination unit is used to identify the text blocks belonging to the target category that need to be extracted from the formatted text; The identification unit is used to identify text blocks belonging to the target category in the formatted text based on text block-level feature information using a binary classification model; the text block-level feature information includes at least one of the following: feature information of the text block to be identified in the formatted text, feature information of the target text block in the formatted text; the text block-level feature information includes at least one of the following: data information of the text block; metadata information of the text block; or, spatial location information of the text block; The data information of the text block includes at least one of the following: the total length of the strings in the text block; whether the text block contains preset characters or preset strings; the total number of preset characters or preset strings contained in the text block; the proportion of preset characters or preset strings contained in the text block to the total number of characters in the text block; whether the text block contains preset keywords; whether the text block contains preset named entities; or, whether the text block contains preset format information. The metadata information of the text block includes at least one of the following: the font, font size, color, whether it is bold, whether it is italic, or whether it is underlined; The spatial location information of the text block includes at least one of the following: the distance of the text block relative to the page edge of the formatted text; or, the distance of the text block relative to a reference text block in the formatted text. The output unit is used to output the identifiers of the text blocks in the formatted text that belong to the target category.
15. The apparatus according to claim 14, characterized in that, The identification unit is specifically used for: Based on the feature information of the text block to be identified in the formatted text, it is determined whether the text block to be identified belongs to the target category.
16. The apparatus according to claim 14, characterized in that, The identification unit is specifically used for: Based on the feature information of the target text block in the formatted text, identify whether the text block to be identified in the formatted text belongs to the target category; Alternatively, based on the feature information of the text block to be identified in the formatted text and the feature information of the target text block in the formatted text, it can be identified whether the text block to be identified belongs to the target category; The target text block is a text block that has a preset positional relationship with the text block to be identified.
17. The apparatus according to claim 15, characterized in that, The target text block is a text block within a preset range of the text block to be identified; Alternatively, the target text block is a text block located at a preset position on the text block to be identified and adjacent to the text block to be identified.
18. The apparatus according to any one of claims 14 to 17, characterized in that, The device further includes: A receiving unit is configured to receive a request message, the request message being used to request the extraction of text blocks belonging to the target category from the formatted text.
19. The apparatus according to any one of claims 14 to 17, characterized in that, The device further includes: The display unit is configured to display a first user interface before the determining unit determines that text blocks belonging to the target category in the formatted text need to be extracted. The first user interface includes first instruction information and second instruction information. The first instruction information is used to instruct the user to input the formatted text, and the second instruction information is used to instruct the user to input the identifier of the target category.
20. The apparatus according to any one of claims 14 to 17, characterized in that, The device further includes: The display unit is used to display a second user interface, which is used to display third indication information, which is used to indicate to the user that the information extraction process is being performed.
21. The apparatus according to any one of claims 14 to 17, characterized in that, The output unit is specifically used to: display a third user interface, the third user interface containing identifiers of text blocks belonging to the target category in the formatted text.
22. The apparatus according to any one of claims 14 to 17, characterized in that, The device further includes: An acquisition unit is used to acquire a binary classification model, wherein the binary classification model characterizes whether a text block belongs to the target category; The recognition unit is specifically used to input the feature information of the text block granularity into a binary classification model to obtain the output result.
23. The apparatus according to claim 22, characterized in that, The acquisition unit is specifically used for: Obtain N features of the target category, where the N features are features represented by the feature information at the text block granularity, and N is an integer greater than or equal to 1; Obtain a training set, which includes multiple text blocks, all of which belong to the target category; For each of the plurality of text blocks, feature extraction based on the N features is performed to obtain a feature combination corresponding to the target category; The binary classification model is obtained by training multiple feature combinations obtained from the multiple text blocks.
24. The apparatus according to claim 23, characterized in that, The device further includes: The display unit is configured to display a fourth user interface before the acquisition unit acquires the N features of the target category and the training set. The fourth user interface includes a fourth instruction information and a fifth instruction information. The fourth instruction information is used to instruct the user to input the identifier of the target category and the N features, and the fifth instruction information is used to instruct the user to input the training set.
25. The apparatus according to claim 23, characterized in that, The device further includes: The display unit is used to display a fifth user interface during the training process performed by the acquisition unit. The fifth user interface includes a sixth instruction information, which is used to indicate to the user that the binary classification model is being trained.
26. The apparatus according to claim 22, characterized in that, The device further includes: A receiving unit is used to receive the binary classification model published by the network device.
27. An information extraction device for formatted text, characterized in that, include: A memory and a processor, the memory for storing a computer program, the processor for invoking the computer program to perform the method according to any one of claims 1-13.
28. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method described in any one of claims 1-13.
Citation Information
Patent Citations
Marriage dispute judgment document element extraction method and device
CN111753538A