Data processing method, device, electronic device and storage medium
By determining the target classification results and attribute values in unstructured text and generating feature sentences, the problem of low efficiency and poor accuracy when converting unstructured data into structured data in the existing technology is solved, and a more efficient and accurate Structured data generation.
Patent Information
- Application Number
- CN202210728901.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-06-24
AI Technical Summary
The existing method of converting unstructured data into structured data is inefficient and inaccurate, resulting in inaccurate determination of structured data and poor results.
By obtaining the unstructured text to be processed, if it is in electronic document format, the target classification results and classification attribute values of each text are determined, and the characteristic sentences and characteristic attribute values are determined based on these results, thereby generating structured data.
It improves the accuracy of feature statements and structured data, and improves the efficiency and accuracy of structured data generation.
Smart Images

Figure CN114996457B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer processing technology, and in particular to a data processing method, device, electronic equipment and storage medium. Background Art
[0002] With the continuous growth of medical data in the medical field, medical data usually contains a large amount of unstructured text data. Unstructured text data usually has problems such as writing errors, missing data, inconsistent terminology, etc., but these data contain a lot of useful information. When extracting useful information, unstructured data is usually converted into structured data, and the required information can be effectively extracted from the structured data.
[0003] At present, the method of converting unstructured data into structured data is usually through template matching, matching the unstructured data with the feature words in the preset structure, and filling in the corresponding feature word positions to obtain structured data. This method uses the header words in the template as the main information, and requires the feature words in the unstructured data to adapt to the header words. Not only is the processing efficiency low, but the matching accuracy is also low, resulting in low accuracy and poor effect in determining the structured data. Summary of the invention
[0004] The present invention provides a data processing method, device, electronic device and storage medium to improve the efficiency and accuracy of determining structured data.
[0005] According to one aspect of the present invention, there is provided a data processing method, the method comprising:
[0006] Get unstructured text to be processed;
[0007] If the text to be processed is in electronic document format, determining a target classification result and a corresponding classification attribute value corresponding to each character;
[0008] Based on each target classification result and the corresponding classification attribute value, determining at least one feature sentence and the corresponding feature attribute value corresponding to the text to be processed;
[0009] Based on each feature attribute value, first structured data is determined from the at least one feature sentence.
[0010] According to another aspect of the present invention, there is provided a data processing device, the device comprising:
[0011] A module for acquiring text to be processed, used for acquiring unstructured text to be processed;
[0012] A target classification result determination module, used for determining a target classification result and a corresponding classification attribute value corresponding to each character if the to-be-processed text is in an electronic document format;
[0013] A feature sentence determination module, used to determine at least one feature sentence and a corresponding feature attribute value corresponding to the text to be processed based on each target classification result and the corresponding classification attribute value;
[0014] The first structured data module is used to determine first structured data from the at least one feature statement based on each feature attribute value.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the data processing method described in any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data processing method described in any embodiment of the present invention when executed.
[0020] The technical solution of the embodiment of the present invention obtains unstructured text to be processed; if the text to be processed is in an electronic document format, determines the target classification result and the corresponding classification attribute value corresponding to each character; based on each target classification result and the corresponding classification attribute value, determines at least one feature sentence and the corresponding feature attribute value corresponding to the text to be processed; based on each feature attribute value, determines the first structured data from at least one feature sentence, thereby solving the problem that the template matching-based method in the prior art converts unstructured data into structured data, resulting in low accuracy and poor effect in determining structured data, and realizes that at least one feature sentence is determined according to the target classification result and the corresponding classification attribute value corresponding to each character in the text to be processed, thereby improving the accuracy of feature sentence determination, and based on each feature sentence and the corresponding feature attribute value, determines the first structured data from at least one feature sentence, thereby improving the efficiency and accuracy of generating structured data.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 is a flow chart of a data processing method provided according to Embodiment 1 of the present invention;
[0024] Figure 2 is a flow chart of a data processing method provided according to Embodiment 2 of the present invention;
[0025] Figure 3 is a schematic diagram of converting unstructured data into structured data according to Embodiment 3 of the present invention;
[0026] Figure 4 is a schematic diagram of a sentence splitting method applicable to Embodiment 3 of the present invention;
[0027] Figure 5 is a structural schematic diagram of a data processing device provided according to a fourth embodiment of the present invention;
[0028] Figure 6 It is a structural schematic diagram of an electronic device for implementing the data processing method of an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] Figure 1 1 is a flowchart of a data processing method provided according to Embodiment 1 of the present invention. This embodiment is applicable to data processing situations. The method can be executed by a data processing device. The data processing device can be implemented in the form of hardware and / or software. The data processing device can be configured in a computing device. Figure 1 As shown, the method includes:
[0033] S110: Obtain unstructured text to be processed.
[0034] The text to be processed can be understood as text that needs to be converted into structured data. Optionally, the text to be processed can be unstructured text data such as web pages or word documents from web crawlers. Unstructured text data refers to data with irregular or incomplete data structure and no fixed format. Fixed formats include but are not limited to text paragraph format, text format, indentation format and spacing format. For example, unstructured text to be processed may include but is not limited to various medical drug formulas or disease treatment instructions, etc.
[0035] In practical applications, the unstructured text imported by the user can be used as the text to be processed. For example, in the medical field, the test order issued by the doctor uploaded by the laboratory department can be used as the unstructured text. When the unstructured text is received, the data in the unstructured text can be preprocessed, such as data cleaning, for example, deleting spaces in the unstructured text, etc. The processed unstructured text can be used as the text to be processed, so that structured data can be obtained based on the text to be processed later. The advantage of this method is: reducing the amount of data processing and improving the efficiency of data processing.
[0036] S120: If the text to be processed is in an electronic document format, determine a target classification result and a corresponding classification attribute value corresponding to each character.
[0037] The electronic document formats may include but are not limited to DOC, PPT, TXT and other formats.
[0038] In practical applications, the format of the text to be processed can be judged. When it is detected that the text to be processed is in the format of an electronic document, the characters in the text to be processed can be recognized to obtain the recognition result corresponding to each character and the probability value corresponding to the recognition result. The recognition result can be used as the target classification result, and the corresponding probability value can be used as the classification attribute value. For example, the text to be processed contains characters such as heart disease, and the target classification result corresponding to "heart" is disease, and the corresponding classification attribute value is 0.3; the target classification result corresponding to "dirty" is disease, and the corresponding classification attribute value is 0.4; the target classification result corresponding to "disease" is disease, and the corresponding classification attribute value is 0.7.
[0039] It should be noted that in order to improve the accuracy of the classification results, when it is detected that the text to be processed is in the electronic document format, the text data in the text to be processed can be converted into recognizable information, such as representing the characters as vectors, and using a text recognition algorithm to identify the vectors corresponding to each character to obtain a recognition result corresponding to each character.
[0040] Optionally, if the text to be processed is in the format of an electronic document, the target classification result and the corresponding classification attribute value corresponding to each character are determined, including: when it is detected that the text to be processed is in the format of an electronic document, based on the mapping relationship between the characters to be matched and the vectors to be selected, the vectors to be used corresponding to each character are retrieved from a preset dictionary library; feature processing is performed on each vector to be used to obtain a code to be used corresponding to each character; each code to be used is input into a preset character classification model to obtain a target classification result and a corresponding classification attribute value corresponding to each character.
[0041] The dictionary library stores a plurality of characters and vector representations corresponding to each character, such as the vector representation corresponding to "disease" is 1, the vector representation corresponding to "symptom" is 2, and the vector representation corresponding to "diagnosis" is 0. Each character has a unique vector representation corresponding to it. The character classification model can be a preset model for character classification.
[0042] In practical applications, the characters read from the text to be processed can be analyzed and matched with the characters in the dictionary library, and the vectors corresponding to each character in the text to be processed can be retrieved from the dictionary library as the vectors to be used according to the mapping relationship between the characters to be matched in the basic element library and the vectors to be selected. A vector set corresponding to the text to be processed can be obtained, such as the vector set e = [w i,1 ;w i,2 ;…;w i,m ],w i,1A vector representing a character. Furthermore, a feature processing model can be used to perform feature processing on each vector to be used, and a high-dimensional vector identifier corresponding to each character can be obtained as the code to be used. For example, the feature processing model can be a Big Bird transformer, which supports longer text inputs, such as e=[w i,1 ;w i,2 ;…;w i,m ] is input into the Big Bird transformer to learn semantic information and obtain high-dimensional encoding information corresponding to the text to be processed [h i,1 ;h i,2 ;…;h i,m ],h i,1 The coding information representing the characters. Furthermore, the codes to be used corresponding to each character can be input into the character classification model to obtain the target classification result and the corresponding classification attribute value corresponding to each character.
[0043] S130: Based on each target classification result and the corresponding classification attribute value, determine at least one feature sentence and a corresponding feature attribute value corresponding to the text to be processed.
[0044] The feature sentence includes the text name and the text content.
[0045] In practical applications, the entire text to be processed can be split into sentences based on each target classification result. For example, a number of consecutive characters with similar or consistent target classification results can be used as a feature sentence. For example, the target classification results corresponding to the five characters "Acupuncture and Massage Department" are all departments, so the Acupuncture and Massage Department can be used as a feature sentence, or the target classification results of the characters "Acupuncture" and "Nake Department" are departments, and the target classification result of "Push" is a disease, so the "Acupuncture and Massage Department" can also be used as a feature sentence. Accordingly, the feature attribute value of the feature sentence can be determined based on the classification attribute values corresponding to the Acupuncture and Massage Department. For example, the average of each classification attribute value can be used as the feature attribute value corresponding to the "Acupuncture and Massage Department". Accordingly, multiple feature sentences and corresponding feature attribute values in the text to be processed can be obtained.
[0046] It should be noted that in order to further improve the accuracy of classification results and prevent the accuracy of feature sentence determination from being affected by the classification result of a certain text, when determining at least one feature sentence and corresponding feature attribute value corresponding to the text to be processed based on each target classification result and the corresponding classification attribute value, the classification results that are different from the target classification results in the sentences containing several texts with the same target classification results can be corrected to determine the feature sentence based on the corrected classification results.
[0047] Optionally, based on each target classification result and the corresponding classification attribute value, at least one feature sentence and a corresponding feature attribute value corresponding to the text to be processed are determined, including: determining at least one classification result to be corrected from each target classification result through a conditional random field, and correcting at least one classification result to be corrected to obtain a classification result to be used corresponding to each character; based on each classification result to be used and the corresponding classification attribute value, at least one feature sentence and a corresponding feature attribute value corresponding to the text to be processed are determined.
[0048] In practical applications, the target classification results corresponding to each character obtained based on the text classification model can be processed by the conditional random field (CRF) to obtain the revised classification results of each character as the classification results to be used. For example, "Acupuncture and Massage Department" is five consecutive characters in the text to be processed. The target classification results of the characters in "Acupuncture" and "Nau Ke" are departments, and the target classification result of "Push" is symptoms. The target classification result of "Push" can be used as the classification result to be revised, and the classification result of "Push" can be revised to the department. At this time, the classification results corresponding to the five characters of "Acupuncture and Massage Department" are all departments. At least one feature sentence and the corresponding feature attribute value can be determined based on the classification result to be used corresponding to each character in the text to be processed and the corresponding classification attribute value.
[0049] S140: Determine first structured data from the at least one feature sentence based on each feature attribute value.
[0050] In practical applications, after obtaining at least one characteristic sentence, it can be determined whether the splitting meets the required splitting requirements based on the obtained characteristic sentences. For example, when all data in the processed text are not split, it can be considered that the splitting requirements are not met. When the preset splitting requirements are met, the obtained characteristic sentences can be regularized to obtain regularized structured data as the first structured data, such as department: acupuncture and massage department-address-attending physician; medicine: medicine name-precautions, etc. The characteristic sentences whose characteristic attribute values are greater than the preset threshold can also be regularized to obtain the first structured data.
[0051] It should be noted that when determining whether the feature statement after splitting meets the required splitting requirements, it can also be determined based on the feature attribute values corresponding to each feature statement. For example, if a feature attribute value is too small, it can be characterized that the feature statement corresponding to the feature attribute value may have an inaccurate splitting problem, and it can be considered that the splitting requirements are not met. It should also be noted that whether the feature statement meets the required splitting requirements can also be determined based on the actual working situation.
[0052] Optionally, based on each feature attribute value, first structured data is determined from at least one feature sentence, including: determining the number of feature attribute values greater than a preset attribute threshold; if the number is greater than the first number threshold, arranging at least one feature sentence to obtain first structured data; or, if the number is not greater than the first number threshold, processing at least one split sentence corresponding to the text to be processed based on a preset title recognition model to obtain at least one target category word corresponding to the text to be processed and a corresponding category attribute value, and based on each category attribute value, determining the first structured data from at least one target category word and the corresponding category content.
[0053] The title recognition model may be a preset model for recognizing titles in text. The split sentences include sentences participating in prediction and sentences repeated in context. Sentences participating in prediction can be understood as sentences participating in model recognition. Context repeated sentences can be input into the model together with sentences participating in prediction, but the model does not recognize them, which plays a role in enhancing context.
[0054] In practical applications, when the number of feature attribute values greater than the preset attribute threshold is greater than the first quantity threshold, it can be considered that the obtained feature sentence meets the required splitting requirements. When the feature sentence meets the required splitting requirements, each feature sentence can be arranged to obtain regularized first structured data. When the split feature sentence does not meet the required splitting requirements, at least one split sentence corresponding to the text to be processed can be processed based on the title recognition model. Optionally, the processing method can be: sentence splitting of the text to be processed to obtain at least one split sentence; inputting at least one split sentence into the title recognition model to obtain at least one target category word and corresponding category attribute value. For example, the text to be processed can be split based on punctuation marks or word and sentence semantics to obtain at least one split sentence. It should be noted that in the process of disassembling the text and determining the split sentences, in order to enhance the contextual representation information of the input text and reduce the situation where the header words are just cut, resulting in low accuracy in determining the target category word. It is also possible to make each split sentence carry a sentence that can enhance the context information but does not participate in model prediction when decomposing the text. For example, when "1234, 567890, 32434" is split, 123456, 34567890, 78903243, 9032434, etc. can be obtained. Among 123456, 1234 is a sentence involved in prediction, and 56 is a context-repeated sentence; among 34567890, 5678 is a sentence involved in prediction, and 34 and 90 are context-repeated sentences; among 78903243, 9032 is a sentence involved in prediction, and 78 and 43 are context-repeated sentences; among 9032434, 3243 is a sentence involved in prediction, and 90 and 4 are context-repeated sentences. Furthermore, each split sentence can be input into the title recognition model, and the model can predict the participating prediction sentences in the split sentences, determine the header words in the participating prediction sentences as the target category words, and the category attribute values corresponding to the target category words. For example, the target category words can be departments, drugs, doctors, etc. After obtaining the target category words, the target category words and the corresponding text content with category attribute values greater than the preset threshold can be regularized to obtain regularized structured data as the first structured data, such as department: acupuncture and massage department-text content; drug: drug name-text content, etc. It is also possible to judge whether the split meets the required split requirements based on the obtained target category words and the corresponding category attribute values. If the preset split requirements are met, the obtained target category words and the corresponding text content can be regularized to obtain the first structured data.
[0055] It should be noted that when determining whether the target classifiers meet the required splitting requirements, it can be determined based on the category attribute values corresponding to each target classifier. For example, if a certain feature attribute value is too small, it can be characterized that the target classifier corresponding to the category attribute value may be inaccurately determined, and it can be considered that the splitting requirements are not met. It should also be noted that whether the target classifier meets the required splitting requirements can also be determined based on the actual working situation.
[0056] Optionally, based on each category attribute value, the first structured data is determined from at least one target category word and the corresponding category content, including: if the category attribute value is greater than the number of preset attribute values and greater than a second quantity threshold, the text content between two adjacent target category words is used as the category content of the previous target category word, and the first structured data is determined based on each target category word and the corresponding category content; or, if the category attribute value is greater than the number of preset attribute values and not greater than the second quantity threshold, the text to be processed is split based on a preset splitting rule to obtain at least one structured content, and the first structured data is determined based on each structured content.
[0057] The preset splitting rule may be a regular expression match, or may be an XML parsing or feature selection algorithm.
[0058] In practical applications, when the number of category attribute values greater than the preset attribute value is greater than the second quantity threshold, it can be considered that the obtained target category word meets the required splitting requirements. When the target category word meets the required splitting requirements, the text content corresponding to each target category word, that is, the category content, can be determined. Optionally, the text content between two adjacent target category words can be used as the category content of the previous target category word. For example, for the target category words department and doctor, the text content between department and doctor can be used as the category content of the department. Further, the target category word and the corresponding text content can be used as a structured sentence, and a plurality of structured sentences can be obtained accordingly. Each structured sentence can be integrated to obtain the first structured data. When the target category word does not meet the required splitting requirements, the preset splitting rules can be used to perform custom rule splitting on the text to be processed to obtain at least one structured content. Each structured content can be regularized to obtain the first structured data corresponding to the text to be processed.
[0059] The technical solution of this embodiment is to obtain an unstructured text to be processed; if the text to be processed is in an electronic document format, determine the target classification result and the corresponding classification attribute value corresponding to each character; based on each target classification result and the corresponding classification attribute value, determine at least one feature sentence and the corresponding feature attribute value corresponding to the text to be processed; based on each feature attribute value, determine the first structured data from at least one feature sentence, thereby solving the problem that the template matching-based method in the prior art converts unstructured data into structured data, resulting in low accuracy and poor effect in determining the structured data, and realizes that at least one feature sentence is determined according to the target classification result and the corresponding classification attribute value corresponding to each character in the text to be processed, thereby improving the accuracy of determining the feature sentence, and based on each feature sentence and the corresponding feature attribute value, the first structured data is determined from at least one feature sentence, thereby improving the efficiency and accuracy of generating structured data.
[0060] Embodiment 2
[0061] Figure 2 This is a flow chart of a data processing method provided according to the second embodiment of the present invention. On the basis of the above embodiment, when it is detected that the text to be processed is in the web page format, the similarity between at least one preset title word and each tag word in the text to be processed can be determined, so as to determine the second structured data corresponding to the text to be processed based on each similarity. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same as or corresponding to the above embodiment are not repeated here.
[0062] like Figure 2 As shown, the method specifically comprises the following steps:
[0063] S210: Obtain unstructured text to be processed.
[0064] S220: If the text to be processed is in a web page format, respectively determine the similarity between at least one preset title word and each tag word in the text to be processed to obtain a similarity matrix.
[0065] The webpage format can be understood as XML format. Each similarity in the similarity matrix can represent the similarity between a title word and a tag word.
[0066] In practical applications, the format of the text to be processed can be judged. When it is detected that the text to be processed is in the format of a web page, the XML automatic parsing of the text to be processed can be performed. For example, each tag word in the text to be processed can be matched and analyzed with each title word in the predefined template, and the semantic similarity between each tag word and each title word can be calculated. In order to improve the accuracy of similarity determination, the text content corresponding to the corresponding tag word can be used to enhance the semantics of the tag word. For example, the name and content of each tag word in the text to be processed can be obtained, and the tag word can be represented based on the name and content. Then, the similarity between the title word in the predefined template and each tag word can be calculated through an algorithm to obtain a similarity matrix.
[0067] S230: Based on the similarity matrix, determine the classification result to be used corresponding to each label word and the corresponding target similarity.
[0068] Among them, the classification results to be used correspond to the preset title words.
[0069] In practical applications, according to the similarity matrix, the title word corresponding to the maximum similarity associated with a certain label word can be used as the classification result of the label word, that is, the classification result to be used. Accordingly, the classification result to be used and the corresponding similarity corresponding to each label word can be obtained, and this similarity is used as the target similarity.
[0070] S240: Based on the target similarities, determine the second structured data from the label words, the classification results to be used corresponding to the label words, and the label contents.
[0071] In practical applications, after obtaining the classification results to be used and the corresponding target similarities corresponding to each label word, the label words with target similarities greater than a preset threshold and the corresponding classification results to be used and label contents can be regularized to obtain the second structured data. Such as department: Acupuncture and Massage Department-label content; Drug: Drug name-label content, etc. It is also possible to determine whether the split meets the required split requirements based on the obtained target similarities. If the preset split requirements are met, the obtained label words and the corresponding classification results to be used and label contents can be regularized to obtain regularized structured data as the first structured data.
[0072] It should be noted that when determining whether the classification results to be used for each label word meet the required splitting requirements, it can be determined based on the target similarity corresponding to each classification result. For example, if a certain target similarity is too small, it can be characterized that the classification results to be used for the label word corresponding to the target similarity may have an inaccurate determination problem, and it can be considered that the splitting requirements are not met. It should also be noted that whether the classification results to be used for the label word meet the required splitting requirements can also be determined based on the actual working situation.
[0073] Optionally, based on each target similarity, second structured data is determined from each label word, and the classification results to be used and label contents corresponding to each label word, including: determining a quantitative value that is greater than a preset similarity; if the quantitative value is greater than a third quantitative threshold, associating each label word with the corresponding classification results to be used and label contents to obtain second structured data; or, if the quantitative value is not greater than the third quantitative threshold, splitting the text to be processed based on a preset splitting rule to obtain at least one structured sentence, and determining the second structured data based on each structured sentence.
[0074] In practical applications, when the target similarity is greater than the preset similarity and the quantitative value is greater than the third quantitative threshold, it can be considered that the obtained label words and the corresponding classification results to be used meet the required splitting requirements. When the required splitting requirements are met, each label word can be associated with the corresponding classification results to be used and the label content. For example, a certain label word and the corresponding classification results to be used and the label content can be used as a structured sentence, and multiple structured sentences can be obtained accordingly. The structured sentences can be integrated to obtain the second structured data. When the required splitting requirements are not met, the preset splitting rules can be used to perform customized rule splitting on the text to be processed to obtain at least one structured sentence. The structured sentences can be regularized to obtain the second structured data corresponding to the text to be processed.
[0075] The technical solution of this embodiment obtains unstructured text to be processed. If the text to be processed is in the format of a web page, the similarity between at least one preset title word and each tag word in the text to be processed is determined to obtain a similarity matrix; based on the similarity matrix, the classification results to be used and the corresponding target similarities corresponding to each tag word are determined; based on each target similarity, the second structured data is determined from each tag word, and the classification results to be used and the tag content corresponding to each tag word. The second structured data is determined from each tag word, and the classification results to be used and the tag content corresponding to each tag word according to the similarity matrix corresponding to the text to be processed, thereby improving the generation efficiency and accuracy of structured data.
[0076] Embodiment 3
[0077] As an alternative embodiment of the above embodiment, Figure 3 This is a schematic diagram of converting unstructured data into structured data according to Embodiment 3 of the present invention. For details, please refer to the following specific content.
[0078] For example, see Figure 3First, you can connect to the database and obtain the unstructured text to be processed from the database. Then you can preprocess the text to obtain the preprocessed text. The preprocessed text can be input into the paragraph splitting model for processing. The processing method can be seen in Figure 3 1 in the box. First, determine whether the text to be processed is in web page format, that is, whether it is in XML format. If it is in web page format, automatically parse and analyze to obtain at least one tag word of the text to be processed. For example, the text to be processed that is parsed into XML format can obtain the name and content of each tag word in the text to be processed, and calculate the similarity between the title word in the predefined template and each tag word by machine learning method to obtain a similarity matrix. The title word corresponding to the maximum similarity value corresponding to each tag word can be used as the classification result to be used. If the automatic parsing split does not meet the required splitting requirements, then determine whether each tag word meets the splitting requirements according to the splitting template. If it does not meet the requirements, the text to be processed is split using the preset splitting rules to obtain at least one structured sentence, and the second structured data is determined based on each structured sentence. The preset splitting rules refer to adding rules by manual means, such as regular matching, XML parsing, feature selection, etc. If the automatic parsing split meets the required splitting requirements, then each tag word is associated with the corresponding classification result to be used and the tag content to obtain the second structured data, and the second structured data is sent to the quality inspection library for random inspection.
[0079] On the basis of the above scheme, if the text to be processed is in electronic document format, that is, not in web page format, the preprocessed text to be processed is mapped into a vector through a predefined dictionary to obtain a vector set corresponding to the text to be processed, such as e = [w i,1 ;w i,2 ;…;w i,m ],w i,1 Furthermore, a feature processing model (such as the BigBird pre-trained model) can be used to perform feature processing on each vector to be used, and a high-dimensional vector identifier corresponding to each character can be obtained as the encoding to be used, such as obtaining the encoding set corresponding to the text to be processed [h i,1 ;h i,2 ;…;h i,m ],h i,1Encoded information representing text. Among them, the maximum length supported by the Bigbird model is 4096, which is 4 times that of ordinary Bert. In order to reduce the number of model parameters, the Bigbird model increases the length of the supported input text and adopts an attention mechanism based on the combination of random attention, window attention and global attention. The time and space complexity required are degenerated to O(n). Furthermore, the encoded information corresponding to the text to be processed can be input into the text classification model to obtain the target classification result and corresponding classification attribute value corresponding to each text. The obtained target classification result is corrected based on the conditional random field (CRF) to obtain the corrected classification result corresponding to each text, and then the entire text to be processed is split according to the classification result. If the splitting result cannot meet the splitting requirements, the sentences in the text to be processed can be split to obtain at least one split sentence. For example, in the process of disassembling the text, in order to enhance the contextual representation information of the input text, reduce the situation where the header word is just cut. This can be achieved by using a sliding window algorithm, see Figure 4 , the black part in the figure is the added context representation information, which does not participate in the result prediction and is used as a context repetition sentence. The white part is the text predicted by the actual model and is used as a sentence involved in the prediction. The split sentence after splitting can be input into the title recognition model, and the title recognition model is used to recognize the title part of the model. Based on the title recognition model, the classifier in the split sentence is predicted. After the prediction is completed, at least one target classifier and a corresponding class attribute value are obtained, and the intermediate content between two adjacent target classifiers can be identified as the class content of the previous target classifier. Further, if the obtained target classifier meets the preset splitting requirements, the first structured data is determined based on each target classifier and the corresponding class content. If the obtained target classifier does not meet the preset splitting requirements, the first structured data is determined based on each target classifier and the corresponding class content. The text to be processed is split based on the preset splitting rules to obtain at least one structured content, and the first structured data is determined based on each structured content. The split structured data can be sent to the quality inspection library. If it does not meet the warehousing standards, the structured data can be manually processed and re-entered into the warehousing. If it meets the warehousing standards, the data format of the text to be processed will be adjusted, and the structured data will be mapped with the preset business title. The mapped structured data will be sent to the database so that data analysis can be performed based on the structured data.
[0080] The technical solution of this embodiment is to obtain an unstructured text to be processed; if the text to be processed is in an electronic document format, determine the target classification result and the corresponding classification attribute value corresponding to each character; based on each target classification result and the corresponding classification attribute value, determine at least one feature sentence and the corresponding feature attribute value corresponding to the text to be processed; based on each feature attribute value, determine the first structured data from at least one feature sentence, thereby solving the problem that the template matching-based method in the prior art converts unstructured data into structured data, resulting in low accuracy and poor effect in determining the structured data, and realizes that at least one feature sentence is determined according to the target classification result and the corresponding classification attribute value corresponding to each character in the text to be processed, thereby improving the accuracy of determining the feature sentence, and based on each feature sentence and the corresponding feature attribute value, the first structured data is determined from at least one feature sentence, thereby improving the efficiency and accuracy of generating structured data.
[0081] Embodiment 4
[0082] Figure 5 is a schematic diagram of the structure of a data processing device provided according to Embodiment 4 of the present invention. Figure 5 As shown, the device includes: a to-be-processed text acquisition module 510, a target classification result determination module 520, a feature sentence determination module 530 and a first structured data module 540.
[0083] Among them, the to-be-processed text acquisition module 510 is used to acquire unstructured to-be-processed text; the target classification result determination module 520 is used to determine the target classification result and the corresponding classification attribute value corresponding to each character if the to-be-processed text is in an electronic document format; the feature sentence determination module 530 is used to determine at least one feature sentence and the corresponding feature attribute value corresponding to the to-be-processed text based on each target classification result and the corresponding classification attribute value; the first structured data module 540 is used to determine the first structured data from the at least one feature sentence based on each feature attribute value.
[0084] The technical solution of this embodiment is to obtain an unstructured text to be processed; if the text to be processed is in an electronic document format, determine the target classification result and the corresponding classification attribute value corresponding to each character; based on each target classification result and the corresponding classification attribute value, determine at least one feature sentence and the corresponding feature attribute value corresponding to the text to be processed; based on each feature attribute value, determine the first structured data from at least one feature sentence, thereby solving the problem that the template matching-based method in the prior art converts unstructured data into structured data, resulting in low accuracy and poor effect in determining the structured data, and realizes that at least one feature sentence is determined according to the target classification result and the corresponding classification attribute value corresponding to each character in the text to be processed, thereby improving the accuracy of determining the feature sentence, and based on each feature sentence and the corresponding feature attribute value, the first structured data is determined from at least one feature sentence, thereby improving the efficiency and accuracy of generating structured data.
[0085] On the basis of the above device, optionally, the target classification result determination module 520 includes a to-be-used vector determination unit, a to-be-used encoding determination unit and a target classification result determination unit.
[0086] A to-be-used vector determination unit, configured to retrieve the to-be-used vector corresponding to each character from a preset dictionary based on the mapping relationship between the to-be-matched characters and the to-be-selected vectors when it is detected that the to-be-processed text is in an electronic document format;
[0087] A code determination unit to be used, used to perform feature processing on each vector to be used to obtain a code to be used corresponding to each character;
[0088] The target classification result determination unit is used to input each code to be used into a preset character classification model to obtain a target classification result and a corresponding classification attribute value corresponding to each character.
[0089] On the basis of the above device, optionally, the feature sentence determination module 530 includes a classification result determination unit to be used and a feature sentence determination unit.
[0090] A classification result determination unit to be used, used to determine at least one classification result to be corrected from each target classification result through a conditional random field, and correct the at least one classification result to be corrected to obtain a classification result to be used corresponding to each character;
[0091] The feature sentence determining unit is used to determine at least one feature sentence and a corresponding feature attribute value corresponding to the text to be processed based on each classification result to be used and the corresponding classification attribute value.
[0092] Based on the above device, optionally, the first structured data module 540 includes a quantity determination unit and a first structured data determination unit.
[0093] A quantity determination unit, used to determine the number of characteristic attribute values greater than a preset attribute threshold;
[0094] The first structured data determining unit is used to arrange the at least one feature sentence to obtain the first structured data if the number is greater than a first number threshold; or,
[0095] If the number is not greater than a first quantity threshold, at least one split sentence corresponding to the text to be processed is processed based on a preset title recognition model to obtain at least one target category word and a corresponding category attribute value corresponding to the text to be processed, and based on each category attribute value, the first structured data is determined from the at least one target category word and the corresponding category content.
[0096] On the basis of the above device, optionally, the first structured data determination unit includes a sentence splitting determination subunit and a target classifier determination subunit.
[0097] A sentence splitting determination subunit is used to perform sentence splitting on the text to be processed to obtain at least one split sentence; wherein the split sentence includes a prediction-participating sentence and a context-repeating sentence;
[0098] The target classifier determination subunit is used to input the at least one split sentence into the title recognition model to obtain the at least one target classifier and a corresponding class attribute value.
[0099] Based on the above device, optionally, the first structured data determining unit includes a first structured data determining subunit.
[0100] The first structured data determination subunit is used to, if the category attribute value is greater than the number of preset attribute values and greater than a second quantity threshold, use the text content between two adjacent target classifiers as the category content of the previous target classifier, and determine the first structured data based on each target classifier and the corresponding category content; or,
[0101] If the category attribute value is greater than the number of preset attribute values but not greater than the second quantity threshold, the text to be processed is split based on a preset splitting rule to obtain at least one structured content, and the first structured data is determined based on each structured content.
[0102] On the basis of the above device, optionally, the device further includes a second structured data determination module, and the second structured data determination module includes a similarity matrix determination unit, a target similarity determination unit and a second structured data determination unit.
[0103] A similarity matrix determination unit, for determining the similarity between at least one preset title word and each tag word in the text to be processed to obtain a similarity matrix if the text to be processed is in a webpage format;
[0104] A target similarity determination unit, used to determine the classification results to be used and the corresponding target similarities corresponding to each label word based on the similarity matrix; wherein the classification results to be used correspond to the preset title words;
[0105] The second structured data determining unit is used to determine the second structured data from the label words, the classification results to be used corresponding to the label words, and the label contents based on the target similarities.
[0106] Based on the above device, optionally, the second structured data determining unit includes a quantity value determining subunit and a second structured data determining subunit.
[0107] A quantity value determination subunit, used to determine a quantity value at which the target similarity is greater than a preset similarity;
[0108] A second structured data determination subunit is used to associate each label word with the corresponding classification result to be used and the label content to obtain second structured data if the quantity value is greater than a third quantity threshold; or
[0109] If the quantity value is not greater than the third quantity threshold, the text to be processed is split based on a preset splitting rule to obtain at least one structured sentence, and the second structured data is determined based on each structured sentence.
[0110] The data processing device provided in the embodiment of the present invention can execute the data processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0111] Embodiment 5
[0112] Figure 6Schematic diagram of the structure of an electronic device that implements the data processing method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0113] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0114] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0115] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a data processing method.
[0116] In some embodiments, the data processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data processing method in any other appropriate manner (e.g., by means of firmware).
[0117] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0118] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0119] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0120] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0121] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0122] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0123] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0124] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A data processing method, characterized in that: include: Get unstructured text to be processed; If the text to be processed is in electronic document format, determining a target classification result and a corresponding classification attribute value corresponding to each character; Based on each target classification result and the corresponding classification attribute value, determining at least one feature sentence corresponding to the text to be processed and the corresponding feature attribute value; wherein the feature sentence includes a text name and text content; Determining first structured data from the at least one feature statement based on each feature attribute value; Wherein, if the text to be processed is in electronic document format, determining the target classification result and the corresponding classification attribute value corresponding to each character includes: When it is detected that the text to be processed is in an electronic document format, based on the mapping relationship between the characters to be matched and the vectors to be selected, the vectors to be used corresponding to each character are retrieved from a preset dictionary library; Performing feature processing on each of the vectors to be used to obtain a code to be used corresponding to each character; Each of the codes to be used is input into a preset character classification model to obtain a target classification result and a corresponding classification attribute value corresponding to each character.
2. The method according to claim 1, characterized in that The step of determining at least one feature sentence and a corresponding feature attribute value corresponding to the text to be processed based on each target classification result and the corresponding classification attribute value comprises: Determine at least one classification result to be corrected from each target classification result by using a conditional random field, and correct the at least one classification result to be corrected to obtain a classification result to be used corresponding to each character; Based on each classification result to be used and the corresponding classification attribute value, at least one feature sentence corresponding to the text to be processed and the corresponding feature attribute value are determined.
3. The method according to claim 1, characterized in that The determining of the first structured data from the at least one feature statement based on each feature attribute value includes: Determine the number of feature attribute values greater than a preset attribute threshold; If the number is greater than a first number threshold, arranging the at least one characteristic sentence to obtain the first structured data; or, If the number is not greater than a first quantity threshold, at least one split sentence corresponding to the text to be processed is processed based on a preset title recognition model to obtain at least one target category word and a corresponding category attribute value corresponding to the text to be processed, and based on each category attribute value, the first structured data is determined from the at least one target category word and the corresponding category content.
4. The method according to claim 3, characterized in that The method of processing at least one split sentence corresponding to the text to be processed based on a preset title recognition model to obtain at least one target category word and a corresponding category attribute value corresponding to the text to be processed includes: Perform sentence splitting on the text to be processed to obtain at least one split sentence; wherein the split sentence includes a sentence involved in prediction and a context repeated sentence; The at least one split sentence is input into the title recognition model to obtain the at least one target category word and a corresponding category attribute value.
5. The method according to claim 3, characterized in that: The determining of the first structured data from the at least one target classifier and the corresponding class content based on each class attribute value includes: If the number of the category attribute values is greater than the preset attribute value and greater than the second quantity threshold, the text content between two adjacent target category words is used as the category content of the previous target category word, and the first structured data is determined based on each target category word and the corresponding category content; or, If the category attribute value is greater than the number of preset attribute values but not greater than the second quantity threshold, the text to be processed is split based on a preset splitting rule to obtain at least one structured content, and the first structured data is determined based on each structured content.
6. The method according to claim 1, characterized in that Also includes: If the text to be processed is in a web page format, then respectively determining the similarity between at least one preset title word and each tag word in the text to be processed to obtain a similarity matrix; Based on the similarity matrix, determining the classification results to be used and the corresponding target similarities corresponding to each label word; wherein the classification results to be used correspond to the preset title words; Based on the target similarities, second structured data is determined from the label words, the classification results to be used corresponding to the label words, and the label contents.
7. The method according to claim 6, characterized in that The determining of the second structured data from the label words, the classification results to be used corresponding to the label words, and the label contents based on the target similarities includes: Determine that the target similarity is greater than the numerical value of the preset similarity; If the quantity value is greater than a third quantity threshold, then each label word is associated with the corresponding classification result to be used and the label content to obtain second structured data; or, If the quantity value is not greater than the third quantity threshold, the text to be processed is split based on a preset splitting rule to obtain at least one structured sentence, and the second structured data is determined based on each structured sentence.
8. A data processing device, characterized in that: include: A module for acquiring text to be processed, used for acquiring unstructured text to be processed; A target classification result determination module, used for determining a target classification result and a corresponding classification attribute value corresponding to each character if the to-be-processed text is in an electronic document format; The characteristic sentence includes the text name and text content; A feature sentence determination module, used to determine at least one feature sentence and a corresponding feature attribute value corresponding to the text to be processed based on each target classification result and the corresponding classification attribute value; A first structured data module, configured to determine first structured data from the at least one feature statement based on each feature attribute value; The target classification result determination module includes a to-be-used vector determination unit, a to-be-used code determination unit and a target classification result determination unit; The to-be-used vector determination unit is used to retrieve the to-be-used vector corresponding to each character from a preset dictionary based on the mapping relationship between the to-be-matched characters and the to-be-selected vectors when it is detected that the to-be-processed text is in an electronic document format; The to-be-used code determination unit is used to perform feature processing on each of the to-be-used vectors to obtain a to-be-used code corresponding to each character; The target classification result determination unit is used to input each of the codes to be used into a preset character classification model to obtain a target classification result and a corresponding classification attribute value corresponding to each character.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data processing method according to any one of claims 1 to 7 when executed.
