Text extraction method, device, storage medium and electronic device
By masking the numerical fields in the extracted text and inputting them into the pre-trained text classification model, the problem of low accuracy in the identification of numerical fields in the prior art is solved, and effective extraction of numerical fields is achieved and category identification.
Patent Information
- Application Number
- CN202010743097.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-29
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2040-07-29
AI Technical Summary
Existing text extraction methods are difficult to meet user needs. Traditional rule templates can only achieve numerical matching and cannot identify numerical categories. However, named entity recognition algorithms based on machine learning or deep models have the problem of low recognition accuracy.
By obtaining the numerical fields in the text to be extracted, extracting the numerical fields and obtaining their locations, performing masking processing, inputting the text into the pre-trained text classification model, determining the category of the numerical fields, thereby achieving effective extraction and Category identification.
It improves the accuracy of the recognition of numerical field types, and can achieve effective extraction of numerical fields and obtain their categories at the same time, meeting the needs of users.
Smart Images

Figure CN111858942B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a text extraction method, device, storage medium and electronic device. Background Art
[0002] The existing text extraction method is to extract the numerical fields in the text through traditional rule templates or named entity recognition algorithms.
[0003] In the process of implementing the present invention, the inventors found that the prior art has the following problems: the existing text extraction methods have the problem of being difficult to meet user needs.
[0004] For example, traditional rule templates can only match numerical values but cannot identify the categories of numerical values. Although named entity recognition algorithms based on machine learning or deep models can identify the categories of numerical values, they also have the problem of relatively low recognition accuracy. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a text extraction method, device, storage medium and electronic device to solve the problem that it is difficult to meet user needs in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a text extraction method, which includes: obtaining a text to be extracted, wherein the text to be extracted includes a numerical field; extracting the numerical field from the text to be extracted and obtaining the position of the numerical field; masking the numerical field in the text to be extracted according to the position of the numerical field to obtain the masked text; inputting the masked text into a pre-trained text classification model to determine the category of the numerical field, wherein the pre-trained text classification model is obtained based on training data, and the training data includes multiple masked historical texts and the category of the historical numerical field corresponding to each historical text; using the numerical field and the category of the numerical field as the extraction result of the text to be extracted.
[0007] Therefore, the embodiment of the present application extracts numerical fields from the text to be extracted, and masks the numerical fields in the text to be extracted according to the positions of the numerical fields to obtain the masked text, and also inputs the masked text into a pre-trained text classification model to determine the category of the numerical field, and also uses the extracted numerical fields and the categories of the numerical fields obtained by the text classification model as extraction results. Therefore, through the above scheme, the embodiment of the present application can not only realize the effective extraction of numerical fields in the text to be extracted, but also obtain the numerical fields and their corresponding categories at the same time, thereby meeting the needs of users.
[0008] In addition, the embodiment of the present application can improve the recognition accuracy of the type of the numerical field by masking the numerical field in the text to be extracted.
[0009] In a possible embodiment, the numerical field in the text to be extracted is masked according to the position of the numerical field to obtain the masked text, including: according to the position of the numerical field, the numerical field in the text to be extracted is replaced with preset characters to obtain the masked text.
[0010] Therefore, the embodiment of the present application replaces the numerical field in the text to be extracted with preset characters, thereby facilitating the text classification model to perform recognition, thereby improving the recognition accuracy of the type of the numerical field.
[0011] In one possible embodiment, the numerical fields include a target numerical field and other numerical fields except the target numerical field, and according to the positions of the numerical fields, the numerical fields in the text to be extracted are masked to obtain the masked text, including: according to the position of the target numerical field, the target numerical field in the text to be extracted is masked to obtain the masked text.
[0012] Therefore, the embodiment of the present application can perform mask processing on the target numerical field, that is, mark the target numerical field, so as to facilitate the text classification model to accurately identify the category of the target numerical field.
[0013] In one possible embodiment, the numerical field includes a target numerical field and other numerical fields except the target numerical field, and according to the position of the numerical field, the numerical field in the text to be extracted is masked to obtain the masked text, including: according to the position of the other numerical fields, the other numerical fields in the text to be extracted are masked to obtain the masked text.
[0014] Therefore, the embodiment of the present application can perform mask processing on other numerical fields except the target numerical field, that is, mark other numerical fields, so as to facilitate the text classification model to accurately identify the category of the target numerical field.
[0015] In a possible embodiment, before inputting the masked text into a pre-trained text classification model, the text extraction method further includes: acquiring training data; and training an initial text classification model using the training data to obtain a pre-trained text classification model.
[0016] Therefore, the embodiment of the present application can pre-train the text classification model, thereby speeding up the recognition efficiency of the text field.
[0017] In a possible embodiment, the categories of the numerical field include at least one of the following categories: original loss, deductible, deductible, and compensation ratio.
[0018] In a possible embodiment, extracting a numerical field from the text to be extracted and obtaining the position of the numerical field includes: extracting the numerical field from the text to be extracted and obtaining the position of the numerical field using a template matching algorithm.
[0019] In the second aspect, an embodiment of the present application provides a text extraction device, which includes: an acquisition module, used to acquire the text to be extracted, wherein the text to be extracted includes a numerical field; an extraction module, used to extract the numerical field from the text to be extracted and obtain the position of the numerical field; a mask module, used to mask the numerical field in the text to be extracted according to the position of the numerical field, and obtain the masked text; an input module, used to input the masked text into a pre-trained text classification model to determine the category of the numerical field, wherein the pre-trained text classification model is obtained based on training data, and the training data includes multiple masked historical texts and the category of the historical numerical field corresponding to each historical text; the acquisition module is also used to use the numerical field and the category of the numerical field as the extraction result of the text to be extracted.
[0020] In a third aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and the computer program is executed by a processor to execute the method described in the first aspect or any optional implementation of the first aspect.
[0021] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the method described in the first aspect or any optional implementation method of the first aspect is performed.
[0022] In a fifth aspect, the present application provides a computer program product, which, when running on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0023] In order to make the above-mentioned objectives, features and advantages to be achieved by the embodiments of the present application more obvious and understandable, the following specifically cites preferred embodiments and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 A flowchart of a text extraction method shown in an embodiment of the present application is shown;
[0026] Figure 2 A flow chart of a method for training a model provided in an embodiment of the present application is shown;
[0027] Figure 3 A structural block diagram of a text extraction device provided in an embodiment of the present application is shown;
[0028] Figure 4 A structural block diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0030] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0031] In recent years, the development of artificial intelligence (AI), especially natural language processing (NLP) technology, has made text processing, especially text extraction, possible.
[0032] In addition, a large amount of business text data has been accumulated in the insurance industry. For example, business data will be entered in each business link, such as reporting, investigation, loss assessment and loss verification. By extracting text information, unstructured text can be converted into structured data, which can provide support for application scenarios such as business process optimization, risk assessment and insurance pricing. Especially in the insurance pricing scenario, by extracting the amount field in the text records of loss assessment and loss verification, various factors related to the calculation of the compensation amount can be obtained, providing support for the development of pricing models for various types of insurance, realizing differentiated pricing of insurance products, promoting innovation of insurance products, establishing the competitive advantage of the brand, and thus obtaining better benefits.
[0033] In addition, the texts in the insurance industry involve a large number of formulas and tables. The key to extracting the amount field in the text is to determine the category and meaning corresponding to the numerical field.
[0034] Currently, text can be extracted through traditional rule templates or named entity algorithms. However, the existing extraction methods are difficult to accurately identify the categories of numerical fields in text, and thus cannot meet subsequent usage requirements.
[0035] Based on this, an embodiment of the present application cleverly proposes a text extraction scheme, by obtaining the text to be extracted, wherein the text to be extracted includes a numerical field, and extracting the numerical field from the text to be extracted, and obtaining the position of the numerical field, and according to the position of the numerical field, masking the numerical field in the text to be extracted to obtain the masked text, and inputting the masked text into a pre-trained text classification model to determine the category of the numerical field, wherein the pre-trained text classification model is obtained based on training data, and the training data includes multiple masked historical texts and the category of the historical numerical field corresponding to each historical text, and finally the numerical field and the category of the numerical field are used as the extraction results of the text to be extracted.
[0036] Therefore, the embodiment of the present application extracts numerical fields from the text to be extracted, and masks the numerical fields in the text to be extracted according to the positions of the numerical fields to obtain the masked text, and also inputs the masked text into a pre-trained text classification model to determine the category of the numerical field, and also uses the extracted numerical fields and the categories of the numerical fields obtained by the text classification model as extraction results. Therefore, through the above scheme, the embodiment of the present application can not only realize the effective extraction of numerical fields in the text to be extracted, but also obtain the numerical fields and their corresponding categories at the same time, thereby meeting the needs of users.
[0037] In addition, the embodiment of the present application can improve the recognition accuracy of the type of the numerical field by masking the numerical field in the text to be extracted.
[0038] In order to facilitate understanding of the embodiments of the present application, some terms in the embodiments of the present application are first explained as follows:
[0039] “Original loss”: It refers to the actual loss amount of the insured.
[0040] "Deduction": It refers to the amount of the insured's actual loss that is not covered by insurance when calculating the amount of compensation.
[0041] "Deductible": It refers to the amount agreed upon in advance by the insurer and the insured. If the loss amount is within the prescribed amount, the insured shall bear the loss on his own and the insurer shall not be responsible for compensation.
[0042] "Compensation ratio": It means that the insurance company does not bear the full compensation liability according to the actual loss, but bears the compensation liability according to the ratio of the actual loss multiplied by the insurance amount and the insurance value.
[0043] See also Figure 1 , Figure 1 A flowchart of a text extraction method shown in an embodiment of the present application is shown. It should be understood that Figure 1 The method shown can be performed by a text extraction device, which can be used in conjunction with the following text extraction device. Figure 3 The text extraction device shown in the figure corresponds to various devices that can execute the method, such as a personal computer, a server or a network device, etc., and the embodiments of the present application are not limited thereto. Figure 1 The text extraction method comprises:
[0044] Step S110, obtaining the text to be extracted, wherein the text to be extracted includes a numerical field.
[0045] It should be understood that the text to be extracted can be the original text or the short text obtained by preprocessing the original text. The original text can be an irregular long text; the short text can be a short text obtained by segmenting the long text.
[0046] It should also be understood that the processes included in the preprocessing can also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0047] For example, preprocessing may include data cleaning, removing garbled characters, removing empty text, and removing special symbols. Among them, data cleaning may refer to the process of re-examining and verifying data, with the purpose of deleting duplicate information, correcting existing errors, and providing data consistency; removing garbled characters may refer to removing garbled characters in text; removing empty text may refer to removing blank text; and removing special symbols may refer to removing special symbols in text.
[0048] It should also be understood that a numeric field can be a numeric value in text.
[0049] For example, when the text to be extracted includes "the claim amount is 5,000 yuan", the numerical field may be 5,000.
[0050] It should be noted here that the text to be extracted can be relevant text in the insurance field or relevant text in other fields, and the embodiments of the present application are not limited to this.
[0051] In order to facilitate understanding of the embodiments of the present application, a description is given below using specific embodiments.
[0052] Specifically, when the original text is obtained, the original text can be preprocessed, and the preprocessed text can be segmented into short texts according to the text structure.
[0053] That is to say, when the text to be extracted is a long text, the long text can be preprocessed to obtain a short text.
[0054] For example, when a long text is obtained, the long text may be segmented into short texts according to punctuation marks.
[0055] Step S120, extracting a numerical field from the text to be extracted, and obtaining the position of the numerical field.
[0056] It should be understood that the position of the numerical field in the text to be extracted can be represented by characters, coordinates, and other preset methods, and the embodiments of the present application are not limited to this.
[0057] For example, a numeric field is located between the Nth character and the Mth character, where N and M are both positive integers.
[0058] It should also be understood that the specific method of extracting the numerical field from the text to be extracted and obtaining the position of the numerical field can be set according to actual needs, and the embodiments of the present application are not limited thereto.
[0059] For example, the template matching algorithm is used to extract the numerical fields in the short text, thereby obtaining each numerical field in the short text and the position of each numerical field in the short text.
[0060] It should also be understood that the specific process of extracting numerical fields in short texts using the template matching algorithm can also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0061] Step S130 , masking the numerical fields in the text to be extracted according to the positions of the numerical fields, to obtain the masked text.
[0062] It should be understood that the specific method of mask processing can be set according to actual needs, and the embodiments of the present application are not limited thereto.
[0063] Optionally, the masking process may be to replace the numerical field in the text to be extracted with preset characters.
[0064] That is to say, the numerical fields in the text to be extracted can be marked by preset characters, so that the recognition accuracy of the text classification model can be improved through this marking method.
[0065] For example, the numerical field in the text to be extracted may be replaced with preset characters according to the position of the numerical field to obtain the masked text.
[0066] It should also be understood that the specific characters of the preset characters can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0067] For example, the preset character may be character X, character A, character B, etc.
[0068] It should also be understood that the numerical fields in the extracted text are masked according to their positions, and the specific process of obtaining the masked text can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0069] Optionally, when the numerical fields include a target numerical field and other numerical fields except the target numerical field, the target numerical field in the text to be extracted may be masked according to the position of the target numerical field to obtain the masked text.
[0070] That is to say, the embodiment of the present application can perform mask processing on the target numerical field, that is, mark the target numerical field, so as to facilitate the text classification model to accurately identify the category of the target numerical field.
[0071] For example, when the text to be extracted is "Claim amount: 8886.89 yuan, self-paid amount: 2124.11 yuan, deductible amount: 100 yuan and compensation ratio: 100%" and the target numerical field is "8886.89", the masked text is "Claim amount: N yuan, self-paid amount: 2124.11 yuan, deductible amount: 100 yuan and compensation ratio: 100%".
[0072] For another example, when the text to be extracted is "Claim amount: 8,886.89 yuan, self-paid amount: 2,124.11 yuan, deductible amount: 100 yuan and compensation ratio: 100%" and the target numerical field is "100%", the masked text is "Claim amount: 8,886.89 yuan, self-paid amount: 2,124.11 yuan, deductible amount: 100 yuan and compensation ratio: N".
[0073] Optionally, when the numerical fields include a target numerical field and other numerical fields except the target numerical field, the other numerical fields in the text to be extracted can be masked according to the position of each numerical field in the other numerical fields to obtain the masked text.
[0074] That is to say, the embodiment of the present application can also perform masking processing on other numerical fields except the target numerical field, that is, mark other numerical fields, so as to facilitate the text classification model to accurately identify the category of the target numerical field.
[0075] For example, when the text to be extracted is "Claim amount: 8886.89 yuan, self-paid amount: 2124.11 yuan, deductible amount: 100 yuan and compensation ratio: 100%" and the target numerical field is "8886.89", the masked text is "Claim amount: 8886.89 yuan, self-paid amount: N yuan, deductible amount: N yuan and compensation ratio: N".
[0076] For another example, when the text to be extracted is "Claim amount: 8,886.89 yuan, self-paid amount: 2,124.11 yuan, deductible amount: 100 yuan and compensation ratio: 100%" and the target numerical field is "100%", the masked text is "Claim amount: N yuan, self-paid amount: N yuan, deductible amount: N yuan and compensation ratio: 100%".
[0077] In addition, it should be noted that, when other fields include multiple numeric fields, the characters replacing each numeric field can be the same characters.
[0078] Step S140, input the masked text into a pre-trained text classification model to determine the category of the numerical field. The pre-trained text classification model is obtained based on training data, and the training data includes multiple masked historical texts and the category of the historical numerical field corresponding to each historical text.
[0079] In order to facilitate understanding of the embodiments of the present application, the following is a description of the embodiments. Figure 2 , Figure 2 A flow chart of a method for training a model provided in an embodiment of the present application is shown. Figure 2 The methods shown include:
[0080] Step S210, obtaining training data, wherein the training data includes a plurality of masked historical texts and the category of the historical numerical field corresponding to each historical text.
[0081] It should be understood that the historical text is similar to the text to be extracted in step S110 in the previous text, and will not be described in detail here. For details, please refer to the relevant description of step S110.
[0082] For example, the history text may include a history value field.
[0083] It should also be understood that the masked historical text is similar to the masked text of step S130 in the previous text, and will not be described in detail here. For details, please refer to the relevant description of the masked text of step S130.
[0084] For example, when the historical numerical fields include a target historical numerical field and other historical numerical fields except the target historical numerical field, the target historical numerical field in the historical text can be masked according to the position of the target historical numerical field to obtain the masked historical text.
[0085] That is, for each historical numerical field extracted, the target historical numerical field in the historical text can be replaced with preset characters, and the category label corresponding to the target historical numerical field can also be marked as the category of the training sample, so that training data can be obtained.
[0086] For another example, when the historical numerical fields include a target historical numerical field and other historical numerical fields except the target historical numerical field, each of the other historical numerical fields in the text to be extracted can be masked according to the position of each of the other historical numerical fields to obtain the masked text.
[0087] That is to say, for each historical numerical field extracted, other historical numerical fields in the historical text except the target historical numerical field can be replaced with preset fields, and the category label corresponding to the target historical numerical field can also be marked as the category of the training sample, so that training data can be obtained.
[0088] In addition, it should be noted that the above two masking methods can achieve similar classification accuracy.
[0089] It should also be understood that the category of the historical numerical field can be set according to actual needs, that is, the category of the historical numerical field can be a preset category, and the embodiments of the present application are not limited to this.
[0090] For example, the categories of the historical numerical field may include at least one of the following categories: original loss, deductible, deductible, and loss ratio.
[0091] Correspondingly, the categories of the numerical fields are similar to the categories of the historical numerical fields, and will not be described in detail here. For details, please refer to the relevant description of the categories of the historical numerical fields.
[0092] For example, the category of the numerical field may also be set according to actual needs, and the embodiments of the present application are not limited to this.
[0093] Step S220: Use the training data to train the initial text classification model to obtain a trained text classification model.
[0094] It should be understood that the specific type of the text classification model can be set according to actual needs, and the embodiments of the present application are not limited to this.
[0095] For example, a text classification model can be a TextCNN model.
[0096] In order to facilitate understanding of the embodiments of the present application, a description is given below using specific embodiments.
[0097] Specifically, multiple masked historical texts can be used as input data of the model, and the category of the historical numerical field corresponding to each historical text can be used as output data of the model. The input data and the output data are used to train the initial text classification model to obtain a trained text classification model.
[0098] It should be noted here that although steps S210 to S220 show the training process of the model, those skilled in the art should understand that when the model is a pre-trained text classification model, steps S210 and S220 can be omitted, and step S230 can be directly executed.
[0099] Step S230, inputting the masked text into a trained text classification model to determine the category of the numerical field.
[0100] Specifically, the masked text may be used as input data and input into a trained text classification model to determine the category of the numerical field.
[0101] For example, in the case where the masked text is obtained by masking the target numerical field in the text to be extracted, please refer to the following Table 1, which shows the correspondence between the masked text and the category label of the numerical field.
[0102] Table 1
[0103]
[0104] As shown in Table 1, the category corresponding to the claim amount is original loss, the category corresponding to the out-of-pocket amount is deduction, the category corresponding to the deductible amount is deductible, and the category corresponding to the compensation ratio is compensation ratio.
[0105] For another example, when the masked text is obtained by masking other numerical fields in the text to be extracted, please refer to the following Table 2, which shows the correspondence between the masked text and the category labels of the numerical fields.
[0106] Table 2
[0107]
[0108] As shown in Table 2, the category corresponding to the claim amount is original loss, the category corresponding to the out-of-pocket amount is deduction, the category corresponding to the deductible amount is deductible, and the category corresponding to the compensation ratio is compensation ratio.
[0109] In addition, it should be noted here that the masking method of the masked text can be the same as the masking method of the masked historical text.
[0110] For example, when a text classification model is trained by masked historical text and the masked historical text is obtained by masking a target historical numerical field in the historical text, the masked text is also obtained by masking a target numerical field in the text to be extracted.
[0111] Step S150: taking the numerical field and the category of the numerical field as the extraction result of the text to be extracted.
[0112] Specifically, when the category labels output by a pre-trained text classification model are obtained, the extraction results can be determined based on the numerical fields and the corresponding category labels.
[0113] Therefore, the embodiment of the present application extracts numerical fields from the text to be extracted, and masks the numerical fields in the text to be extracted according to the positions of the numerical fields to obtain the masked text, and also inputs the masked text into a pre-trained text classification model to determine the category of the numerical field, and also uses the extracted numerical fields and the categories of the numerical fields obtained by the text classification model as extraction results. Therefore, through the above scheme, the embodiment of the present application can not only realize the effective extraction of numerical fields in the text to be extracted, but also obtain the numerical fields and their corresponding categories at the same time, thereby meeting the needs of users.
[0114] In addition, the embodiment of the present application can improve the recognition accuracy of the type of the numerical field by masking the numerical field in the text to be extracted.
[0115] It should be understood that the above text extraction method is only exemplary, and those skilled in the art may make various modifications based on the above method, and the modified schemes also fall within the protection scope of this application.
[0116] See also Figure 3 , Figure 3The structural block diagram of a text extraction device 300 provided in an embodiment of the present application is shown. It should be understood that the text extraction device 300 can execute each step in the above method embodiment. The specific functions of the text extraction device 300 can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here. The text extraction device 300 includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the text extraction device 300. Specifically, the text extraction device 300 includes:
[0117] The acquisition module 310 is used to acquire the text to be extracted, wherein the text to be extracted includes a numerical field; the extraction module 320 is used to extract the numerical field from the text to be extracted and obtain the position of the numerical field; the mask module 330 is used to mask the numerical field in the text to be extracted according to the position of the numerical field to obtain the masked text; the input module 340 is used to input the masked text into a pre-trained text classification model to determine the category of the numerical field, wherein the pre-trained text classification model is obtained based on training data, and the training data includes multiple masked historical texts and the category of the historical numerical field corresponding to each historical text; the acquisition module 310 is also used to use the numerical field and the category of the numerical field as the extraction result of the text to be extracted.
[0118] In a possible embodiment, the masking module 330 is used to replace the numerical field in the text to be extracted with preset characters according to the position of the numerical field to obtain the masked text.
[0119] In a possible embodiment, the numerical field includes a target numerical field and other numerical fields except the target numerical field. The mask module 330 is used to mask the target numerical field in the extracted text according to the position of the target numerical field to obtain the masked text.
[0120] In a possible embodiment, the numerical field includes a target numerical field and other numerical fields except the target numerical field, and the mask module 330 is used to mask the other numerical fields in the extracted text according to the positions of the other numerical fields to obtain the masked text.
[0121] In a possible embodiment, the acquisition module 310 is further used to acquire training data; the training module (not shown) is used to train the initial text classification model using the training data to obtain a pre-trained text classification model.
[0122] In a possible embodiment, the categories of the numerical field include at least one of the following categories: original loss, deductible, deductible, and compensation ratio.
[0123] In a possible embodiment, the extraction module 320 is used to extract the numerical field from the text to be extracted by using a template matching algorithm, and obtain the position of the numerical field.
[0124] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method, and will not be described in detail here.
[0125] Figure 4 FIG. 4 shows a structural block diagram of an electronic device 400 provided in an embodiment of the present application. Figure 4 As shown, the electronic device 400 may include a processor 410, a communication interface 420, a memory 430 and at least one communication bus 440. Among them, the communication bus 440 is used to realize the direct connection and communication of these components. Among them, the communication interface 420 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The processor 410 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 410 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor 410 can also be any conventional processor, etc.
[0126] The memory 430 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory 430 stores computer-readable instructions, and when the computer-readable instructions are executed by the processor 410, the electronic device 400 may execute the various steps in the above method embodiment.
[0127] The electronic device 400 may further include a storage controller, an input / output unit, an audio unit, and a display unit.
[0128] The memory 430, storage controller, processor 410, peripheral interface, input / output unit, audio unit, and display unit are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses 440. The processor 410 is used to execute executable modules stored in the memory 430, such as software function modules or computer programs included in the electronic device 400.
[0129] The input and output unit is used to provide input data to the user to realize the interaction between the user and the server (or local terminal). The input and output unit can be, but is not limited to, a mouse and a keyboard.
[0130] The audio unit provides an audio interface to the user and may include one or more microphones, one or more speakers, and audio circuitry.
[0131] The display unit provides an interactive interface (e.g., a user operation interface) between the electronic device and the user or is used to display image data for the user's reference. In this embodiment, the display unit may be a liquid crystal display or a touch display. If it is a touch display, it may be a capacitive touch screen or a resistive touch screen that supports single-point and multi-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations generated simultaneously from one or more positions on the touch display, and the sensed touch operations are handed over to the processor for calculation and processing.
[0132] Understandably, Figure 4 The structure shown is for illustration only. The electronic device 400 may also include Figure 4More or fewer components as shown, or with Figure 4 Different configurations shown. Figure 4 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0133] The present application provides a storage medium having a computer program stored thereon. The computer program is executed by a processor to execute the method described in the embodiment.
[0134] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the method described in the method embodiment.
[0135] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned method, and will not be elaborated here.
[0136] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0137] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0138] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0139] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk. It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0140] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0141] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A text extraction method, characterized in that: include: Acquire the text to be extracted, wherein the text to be extracted includes a numerical field; Extracting the numerical field from the text to be extracted, and obtaining the position of the numerical field; According to the position of the numerical field, masking is performed on the numerical field in the text to be extracted to obtain the masked text, wherein the masking includes masking the target numerical field and other numerical fields except the target numerical field; Inputting the masked text into a pre-trained text classification model to determine the category of the numerical field, wherein the pre-trained text classification model is obtained based on training data, the training data includes a plurality of masked historical texts and the category of the historical numerical field corresponding to each historical text, the category of the historical numerical field represents the category label corresponding to the target historical numerical field, and the training data is obtained by replacing the target historical numerical field in the historical text with preset characters, and marking the category label corresponding to the target historical numerical field as the category of the training sample; The numerical field and the category of the numerical field are used as the extraction result of the text to be extracted.
2. The text extraction method according to claim 1, characterized in that: The step of performing masking on the numerical field in the to-be-extracted text according to the position of the numerical field to obtain the masked text comprises: According to the position of the numerical field, the numerical field in the text to be extracted is replaced with preset characters to obtain the masked text.
3. The text extraction method according to claim 1 or 2, characterized in that: The numerical fields include a target numerical field and other numerical fields except the target numerical field, and masking the numerical fields in the to-be-extracted text according to the positions of the numerical fields to obtain the masked text includes: According to the position of the target numerical field, the target numerical field in the text to be extracted is masked to obtain the masked text.
4. The text extraction method according to claim 1 or 2, characterized in that: The numerical fields include a target numerical field and other numerical fields except the target numerical field, and masking the numerical fields in the to-be-extracted text according to the positions of the numerical fields to obtain the masked text includes: According to the positions of the other numerical fields, mask processing is performed on the other numerical fields in the text to be extracted to obtain the masked text.
5. The text extraction method according to claim 1, characterized in that: Before inputting the masked text into a pre-trained text classification model, the text extraction method further includes: Acquiring the training data; The training data is used to train an initial text classification model to obtain the pre-trained text classification model.
6. The text extraction method according to claim 1 or 5, characterized in that: The categories of the numerical fields include at least one of the following categories: original loss, deductible, deductible and compensation ratio.
7. The text extraction method according to claim 1, characterized in that: The step of extracting the numerical field from the text to be extracted and obtaining the position of the numerical field includes: The template matching algorithm is used to extract the numerical field from the text to be extracted, and the position of the numerical field is obtained.
8. A text classification device, characterized in that: include: An acquisition module, used for acquiring the text to be extracted, wherein the text to be extracted includes a numerical field; An extraction module, used for extracting the numerical field from the text to be extracted and obtaining the position of the numerical field; A masking module, used for performing masking processing on the numerical field in the text to be extracted according to the position of the numerical field, to obtain the masked text, wherein the masking processing includes masking processing on the target numerical field and other numerical fields except the target numerical field; An input module, used for inputting the masked text into a pre-trained text classification model to determine the category of the numerical field, wherein the pre-trained text classification model is obtained based on training data, the training data includes a plurality of masked historical texts and the category of the historical numerical field corresponding to each historical text, the category of the historical numerical field represents the category label corresponding to the target historical numerical field, and the training data is obtained by replacing the target historical numerical field in the historical text with preset characters, and marking the category label corresponding to the target historical numerical field as the category of the training sample; The acquisition module is further used to use the numerical field and the category of the numerical field as the extraction result of the text to be extracted.
9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the text extraction method according to any one of claims 1 to 7 is executed.
10. An electronic device, characterized in that: The electronic device includes: a processor, a memory and a bus, the memory stores machine-readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the text extraction method as described in any one of claims 1 to 7 is performed.
Citation Information
Patent Citations
Text information extraction method and computer readable storage medium
CN108197099A
Emotion analysis model pre-training method and device and electronic equipment
CN111144507A