Digital archive classification method and device, electronic equipment and storage medium
By generating and matching the embedded vectors of the archive classification tree and text, the existing digital archive classification methods are solved, and efficient and accurate archive classification is achieved.
Patent Information
- Application Number
- CN202411688282.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-18
AI Technical Summary
The existing digital archive classification methods are inefficient and have poor accuracy. They rely on manual classification and preset classification mapping relationships, and cannot flexibly process large and variable archival data.
By determining the classification tree information of the archive classification tree, the embedding vector of each leaf node is generated, and the embedding vector of the archive text to be classified is calculated, and the classification result is calculated based on the dot product similarity matching.
It realizes accurate and efficient classification of digital archives, improves the accuracy and efficiency of archive classification, and reduces the complexity of query.
Smart Images

Figure CN119646675A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a digital archive classification method, device, electronic device and storage medium. Background Art
[0002] In the construction of archive management system, paper archives are gradually transformed into digital archives, resulting in a rapid increase in the number of digital archives, making the classification management of digital archives particularly important. The classification of digital archives is the core of digital archive management. Accurate, precise and efficient classification plays a vital role in the subsequent use of archive management (retrieval, borrowing, analysis), etc.
[0003] However, the current classification of digital archives mostly relies on manual classification by archive management personnel, which makes the classification efficiency low. In addition, due to the limitations of archive management staff's knowledge reserves and understanding of archives, the accuracy of digital archive classification is poor. Summary of the invention
[0004] The present invention provides a digital archive classification method, device, electronic equipment and storage medium, which can realize accurate and efficient classification of digital archives.
[0005] In a first aspect, a digital archive classification method is provided, comprising:
[0006] Determine classification tree information of the archive classification tree, the classification tree information at least including a target path of each leaf node in the archive classification tree, and first text information of each path node on the target path;
[0007] Generate a first embedding vector for each leaf node based on the classification tree information;
[0008] Calculate the second embedding vector of the archive text to be classified;
[0009] A classification result of the archive text to be classified is determined based on the first embedding vector and the second embedding vector.
[0010] In a second aspect, a digital archive classification device is provided, comprising:
[0011] A first determination module is used to determine classification tree information of the archive classification tree, where the classification tree information at least includes a target path of each leaf node in the archive classification tree and first text information of each path node on the target path;
[0012] A generation module, used to generate a first embedding vector for each leaf node based on the classification tree information;
[0013] A calculation module, used for calculating a second embedding vector of the archive text to be classified;
[0014] The second determination module is used to determine the classification result of the archive text to be classified based on the first embedding vector and the second embedding vector.
[0015] According to a third aspect, an electronic device is provided, comprising: a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the first aspect or its various implementations.
[0016] According to a fourth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method according to the first aspect or its various implementations.
[0017] Through the technical solution provided by the present application, the classification tree information of the archive classification tree can be determined, and the classification tree information at least includes the target path of each leaf node in the archive classification tree, and the first text information of each path node on the target path; then the first embedding vector of each leaf node can be generated based on the classification tree information, and the second embedding vector of the archive text to be classified can be calculated; finally, the classification result of the archive text to be classified is determined based on the first embedding vector and the second embedding vector. Through the learning of the embedding vector, the present application can more accurately mine the text semantics corresponding to the archive, thereby improving the accuracy of archive classification. In the process of classifying digital archives based on the archive classification tree, there is no need to traverse the entire archive classification tree, only the leaf nodes on the archive classification tree need to be matched, which greatly reduces the query complexity based on the archive classification tree, thereby improving the classification efficiency of digital archives.
[0018] It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present application. Other features and advantages of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A flowchart of a digital archive classification method provided in an embodiment of the present application;
[0021] Figure 2 A flowchart of a digital archive classification method provided by another embodiment of the present application;
[0022] Figure 3 An application scenario diagram provided for an embodiment of the present application;
[0023] Figure 4 A flowchart of a digital archive classification method provided in yet another embodiment of the present application;
[0024] Figure 5 A flowchart of a digital archive classification method provided in yet another embodiment of the present application;
[0025] Figure 6 A schematic diagram of the principle flow of digital archive classification provided in an embodiment of the present application;
[0026] Figure 7 A schematic diagram of the structure of a digital archive classification device provided in an embodiment of the present application;
[0027] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] In the construction of archive management system, paper archives are gradually transformed into digital archives, resulting in a rapid increase in the number of digital archives, making the classification management of digital archives particularly important. The classification of digital archives is the core of digital archive management. Accurate, precise and efficient classification plays a vital role in the subsequent use of archive management (retrieval, borrowing, analysis) and so on.
[0031] In the embodiment of the present disclosure, the file classification method may include but is not limited to the following:
[0032] 1. Convention-based and manual classification methods
[0033] Strict constraints are imposed on the management of archive classification. The transfer and receipt are one-way mapping constraints of the large classification. After receipt, the archive staff will identify it and subdivide it into sub-classifications and deeper levels. The specific implementation method can be referred to Figure 1 shown.
[0034] This method has the following problems:
[0035] 1) Relying on strict classification mapping constraints. If there are no classification constraints, the archival data will fail to be received;
[0036] 2) Poor flexibility: the flexibility of sub-categories makes it impossible to flexibly map to deeper sub-categories;
[0037] 3) The limitations of the knowledge reserves and understanding of archives by archive management staff lead to deviations in archive classification;
[0038] 4) The number of digital archives is increasing day by day, and the archive classification is gradually enriched, which requires continuous maintenance of mapping constraints.
[0039] 2. Automatic classification method based on sample library model training
[0040] Determine the existing digital archives at all levels of classification and mark the corresponding codes, establish a two-way mapping relationship between the levels, obtain the content outline, classification, and coding of each existing digital archive, and then establish a digital archive sample library. According to the sample library, the digital archive classification model is trained, and finally the classification model is used to classify and encode the digital archives. The specific implementation method can be referred to Figure 2 shown.
[0041] This method has the following problems:
[0042] 1) The mapping relationship between major categories and subcategories needs to be preset in advance. If there is no pre-defined category, the classification will fail;
[0043] 2) Every time a new category is added, the sample library needs to be upgraded and the classification model needs to be trained, which increases a lot of operation and maintenance work;
[0044] 3) The classification model requires a large number of sample libraries to support more accurate classification. New large categories cannot be classified without sample data.
[0045] 3. An intelligent archive classification method based on archive classification tree and archive text embedding learning enhancement
[0046] Different from the above two methods, the innovation of this scheme lies in that it proposes an archive classification method based on archive classification tree and archive text embedding learning enhancement. First, the text feature vector of the archive to be classified is extracted to generate the extracted embedding vector. Then, the embedding vector learning is performed on the constructed archive classification tree, and the embedding vectors of each node on the path corresponding to each leaf node are fused to generate the embedding vector of each leaf node. Finally, by performing dot product similarity matching calculation on the extracted archive text embedding vector and the embedding vector of the leaf node on the archive classification tree, the leaf node with the largest match is calculated as the classification of the target archive. Its novelty is reflected in:
[0047] (1) For a newly received archive, by learning the embedding vectors of its multiple text fields, we can more accurately mine the text semantics corresponding to the archive and improve the accuracy of archive classification;
[0048] (2) There is no need to traverse the entire archive classification tree, only the leaf nodes on the archive classification tree need to be matched, which greatly reduces the query complexity based on the archive classification tree;
[0049] (3) Through the study of a large amount of existing work, it has been found that no existing archive classification method has applied the above two technologies, so this scheme has technical novelty.
[0050] It should be noted that in the following embodiment steps of the present application, the third file classification method mentioned above is taken as an example to illustrate the technical solution in the present application, but it does not constitute a specific limitation.
[0051] It should be understood that the technical solution of the present invention can be applied to the following scenarios, but is not limited to:
[0052] In some possible implementations, Figure 3 An application scenario diagram provided by an embodiment of the present invention, such as Figure 3 As shown, the application scenario may include an electronic device 310 and a network device 320. The electronic device 310 may establish a connection with the network device 320 via a wired network or a wireless network.
[0053] Exemplarily, the electronic device 310 may be a desktop computer, a laptop computer, a tablet computer, etc., but is not limited thereto. The network device 320 may be a terminal device or a server, but is not limited thereto. In one embodiment of the present invention, the electronic device 310 may send a request message to the network device 320, and the request message may be used to request to obtain the archive classification tree. Further, the electronic device 310 may receive a response message sent by the network device 320, and the response message includes the archive classification tree.
[0054] also, Figure 3An electronic device 310 and a network device 320 are provided as an example, but other numbers of electronic devices and network devices may be included in practice, and the present invention is not limited thereto.
[0055] In some other possible implementations, the technical solution of the present invention may also be executed by the above-mentioned electronic device 310, or the technical solution of the present invention may also be executed by the above-mentioned network device 320, and the present invention does not limit this.
[0056] After introducing the application scenarios of the embodiments of the present invention, the technical solutions of the present invention will be described in detail below:
[0057] Figure 4 A flowchart of a digital archive classification method provided by an embodiment of the present invention, the method can be as follows Figure 3 The electronic device 310 shown in the figure performs, but is not limited to this. Figure 4 As shown, the method may include the following steps:
[0058] Step 410: determine the classification tree information of the archive classification tree, where the classification tree information at least includes the target path of each leaf node in the archive classification tree and the first text information of each path node on the target path.
[0059] In a specific application scenario, after obtaining all digital archives based on the archive database, you can use charts or software tools (such as Excel, MindManager, archive management software, etc.) to build an archive classification tree corresponding to the digital archives. In the archive classification tree, each node represents a classification item, and each classification item is configured with text information under the corresponding hierarchical structure. The lines between nodes represent the hierarchical relationship of the classification, for example: "Medicine, Traditional Chinese Medicine, Typhoid Fever...", where medicine, traditional Chinese medicine, and typhoid fever correspond to the main category, secondary subcategory, tertiary subcategory and other information on the document classification tree. The specific hierarchical structure and hierarchical relationship can be set according to the actual application scenario.
[0060] In the archive classification tree, the target path of a leaf node refers to the sequence of all nodes from the root node to a specific leaf node. The target path consists of a series of path nodes, which are arranged in the order from the root node to the leaf node and are respectively configured with first text information of different granularities.
[0061] Step 420: Generate a first embedding vector for each leaf node based on the classification tree information.
[0062] For the disclosed embodiment, the first sub-embedding vector of each path node can be determined based on the first text information of each path node in the classification tree information using the Doc2Vec method, and then a weighted sum calculation is performed on a plurality of the first sub-embedding vectors corresponding to the plurality of the path nodes to obtain the first embedding vector of each leaf node. Doc2Vec is an open source document vector generation model used to generate an embedding vector representation of a document or text fragment, which will not be described in detail here.
[0063] Step 430: Calculate the second embedding vector of the archive text to be classified.
[0064] For the disclosed embodiment, as a possible implementation, the Doc2Vec method can be directly used to determine the second embedding vector of the archival text to be classified. However, this method of generating the embedding vector will result in a large amount of computational workload. In view of this, as another possible implementation, the archival text to be classified can be subjected to text processing, and the core sentences under multiple text domains can be split and extracted, and then based on the core sentences under multiple text domains, the Doc2Vec method can be used to determine the second embedding vector of the archival text to be classified. In this way, the computational workload can be reduced and the generation efficiency of the embedding vector can be improved.
[0065] Step 440: Determine a classification result of the archive text to be classified based on the first embedding vector and the second embedding vector.
[0066] For the embodiments of the present disclosure, a dot product similarity matching calculation can be performed between the first embedding vector of the leaf node on the archive classification tree and the second embedding vector of the archive text to be classified, and the leaf node with the largest corresponding matching degree can be used as the classification result of the archive text to be classified.
[0067] In summary, according to the digital archive classification method provided by the present invention, the classification tree information of the archive classification tree can be determined, and the classification tree information at least includes the target path of each leaf node in the archive classification tree, and the first text information of each path node on the target path; then the first embedding vector of each leaf node can be generated based on the classification tree information, and the second embedding vector of the archive text to be classified can be calculated; finally, the classification result of the archive text to be classified is determined based on the first embedding vector and the second embedding vector. Through the learning of the embedding vector, the present application can more accurately mine the text semantics corresponding to the archive, thereby improving the accuracy of archive classification. In the process of classifying digital archives based on the archive classification tree, there is no need to traverse the entire archive classification tree, only the leaf nodes on the archive classification tree need to be matched, which greatly reduces the query complexity based on the archive classification tree, thereby improving the classification efficiency of digital archives.
[0068] based on Figure 4The embodiment shown is a refinement and extension of the above embodiment. In order to fully illustrate the specific implementation process of the method of this embodiment, this embodiment provides the following Figure 5 The specific method shown. Figure 5 based on Figure 4 As shown in Figure 5, the method comprises the following steps:
[0069] Step 510: determine the target path of each leaf node in the archive classification tree according to the direction of the leaf nodes. The starting point of the target path is the root node of the archive classification tree, and the end point of the target path is each leaf node.
[0070] For the embodiments of the present disclosure, Figure 6 In the stage of constructing the classification tree shown in ③, the archive classification tree contains leaf nodes c 10 、c 11 、c 12 、c 13 、c 14 . According to the direction of leaf nodes, determine the target path of each leaf node: leaf node c 10 The target path is: c1→c2→c6→c 10 , leaf node c 11 The target path is: c1→c2→c6→c 11 , leaf node c 12 The target path is: c1→c2→c7→c 12 , leaf node c 13 The target path is:
[0071] c1→c4→c8→c 13 , leaf node c 14 The target path is: c1→c4→c9→c 14 .
[0072] Step 520: Determine multiple path nodes included in the target path of each leaf node, and first text information configured for each path node.
[0073] Step 530: Generate a first embedding vector for each leaf node based on the classification tree information.
[0074] For the embodiment of the present disclosure, generating the first embedding vector of each leaf node based on the classification tree information in step 530 may include the following steps:
[0075] Step 530 - 1 : Calculate a first sub-embedding vector of each path node based on the first text information.
[0076] like Figure 6As shown, at the leaf node c 10 The target path is: c1→c2→c6→c 10 When the path nodes c1, c2, c6, c 10 The first text information is used to determine the path nodes c1, c2, c6, c based on the first text information using the Doc2Vec method. 10 The corresponding first sub-embedding vector is e c1 、e c2 、e c6 、e c10 . At leaf node c 11 The target path is: c1→c2→c6→c 11 When the leaf node c is determined 11 The first sub-embedding vectors of each path node on the target path are:
[0077] e c1 、e c2 、e c6 、e c11 ; At leaf node c 12 The target path is: c1→c2→c7→c 12 When the leaf node c is determined 12 The first sub-embedding vectors of each path node on the target path are:
[0078] e c1 、e c2 、e c7 、e c12 ; At leaf node c 13 The target path is: c1→c4→c8→c 13 When the leaf node c is determined 13 The first sub-embedding vectors of each path node on the target path are:
[0079] e c1 、e c4 、e c8 、e c13 ; At leaf node c 14 The target path is: c1→c4→c9→c 14 When the leaf node c is determined 14 The first sub-embedding vectors of each path node on the target path are:
[0080] e c1 、e c4 、e c9 、e c14 .
[0081] Step 530-2: Perform weighted sum calculation on multiple first sub-embedding vectors corresponding to multiple path nodes to obtain the first embedding vector of each leaf node.
[0082] For the embodiments of the present disclosure, Figure 6 In the classification stage (Classification calculation) shown in ④, the first sub-embedding vector corresponding to each path (assuming it is p) on the archive classification tree can be weighted summed to obtain the first embedding vector of each leaf node.
[0083] For example, the leaf node c can be calculated 10 The first embedding vector of is:
[0084]
[0085] In the formula, e p1 For leaf node c 10 The first embedding vector, d p1 For leaf node c 10 The number of path nodes contained in the corresponding target path, e c1 、e c2 、e c6 、e c10 They are path nodes c1, c2, c6, c 10 The corresponding first sub-embedding vector.
[0086] The leaf node c can be calculated 11 The first embedding vector of is:
[0087]
[0088] In the formula, e p2 For leaf node c 11 The first embedding vector, d p2 For leaf node c 11 The number of path nodes contained in the corresponding target path, e c1 、e c2 、e c6 、e c11 They are path nodes c1, c2, c6, c 11 The corresponding first sub-embedding vector.
[0089] The leaf node c can be calculated 12 The first embedding vector of is:
[0090]
[0091] In the formula, e p3 For leaf node c 12 The first embedding vector, dp3 For leaf node c 12 The number of path nodes contained in the corresponding target path, e c1 、e c2 、e c7 、e c12 They are path nodes c1, c2, c7, c 12 The corresponding first sub-embedding vector.
[0092] The leaf node c can be calculated 13 The first embedding vector of is:
[0093]
[0094] In the formula, e p4 For leaf node c 13 The first embedding vector, d p4 For leaf node c 13 The number of path nodes contained in the corresponding target path, e c1 、e c4 、e c8 、e c13 They are path nodes c1, c4, c8, c 13 The corresponding first sub-embedding vector.
[0095] The leaf node c can be calculated 14 The first embedding vector of is:
[0096]
[0097] In the formula, e p5 For leaf node c 14 The first embedding vector, d p5 For leaf node c 14 The number of path nodes contained in the corresponding target path, e c1 、e c4 、e c9 、e c14 They are path nodes c1, c4, c9, c 14 The corresponding first sub-embedding vector.
[0098] Step 540: Calculate the second embedding vector of the archive text to be classified.
[0099] For the embodiment of the present disclosure, the calculation of the second embedding vector of the archive text to be classified in step 540 may include the following steps:
[0100] Step 540 - 1 : Determine at least one target text field contained in the archive text to be classified, and second text information in each target text field.
[0101] For the embodiment of the present disclosure, when determining at least one target text field contained in the archive text to be classified, and the second text information in each target text field:
[0102] As a possible implementation method, the embodiment steps may include: inputting the archive text to be classified into a pre-trained text domain division model to obtain at least one target text domain contained in the archive text to be classified, and the second text information of each target text domain. The text domain division model can be any machine learning model trained for the text domain division task, and is not specifically limited here.
[0103] As another possible implementation method, the implementation steps may include: obtaining preset keywords corresponding to each preset text domain; performing text preprocessing on the archive text to be classified to obtain a set of text fragments corresponding to the archive text to be classified; based on the preset keywords, calculating the semantic matching degree between each text fragment in the text fragment set and different preset text domains; determining the preset text domain with a semantic matching degree greater than a preset threshold as the target text domain contained in the archive text to be classified; and determining the text fragment with a semantic matching degree greater than the preset threshold corresponding to the target text domain as the second text information in the target text domain.
[0104] Among them, the preset text domain is a text domain containing default text content, which can be set according to the actual application scenario, such as title, class name, year. For each preset text domain, a corresponding preset keyword can be configured. The preset keyword is used to represent the semantic features of the text domain, so as to facilitate the determination of the second text information of the core text in each target text domain based on the preset keyword matching. The preset threshold is a value between 0 and 1. The specific value can be set according to the actual application scenario and is not specifically limited here.
[0105] Accordingly, when performing text preprocessing on the archive text to be classified to obtain a set of text fragments corresponding to the archive text to be classified, the implementation steps may include: dividing the archive text to be classified into multiple first words based on word segmentation technology, and obtaining a first word sequence containing multiple first words; removing second words from the first word sequence to obtain a second word sequence, wherein the second words are first words that match a preset stop word part; calculating the semantic pause confidence corresponding to each remaining first word in the second word sequence; determining the text division position based on the semantic pause confidence; dividing the archive text to be classified at the text division position to obtain a set of text fragments containing multiple text fragments.
[0106] For this embodiment, in a specific application scenario, an existing word segmentation tool (such as a CRF word segmenter) can be used to segment the input text to obtain each independent first word and a first word sequence after segmentation, wherein each first word is marked with a corresponding target part of speech. The format of the corresponding first word sequence is: [word 1, word 2, word 3, ... word N].
[0107] Correspondingly, as a preferred method, in order to improve the efficiency of feature information extraction, after obtaining the first word with the target part of speech marked by the above method, the first word can be further identified, and some stop parts of speech in the first word sequence can be eliminated to further obtain a second word sequence containing only the valid first word. Among them, the preset stop parts of speech can be modal particles, adverbs, prepositions, conjunctions, etc. These preset stop parts of speech usually have no clear meaning by themselves, and only have a certain effect when they are put into a complete sentence, such as the common "ah", "ouch", "other", "result", "let", "but", etc. Since these words rarely express the information of the relevance of the document alone, and these functional words are basically of no help to distinguish topics, in order to improve the efficiency of topic extraction and save storage space, these meaningless words can be filtered out in advance. Specifically, the identification and filtering of stop words can be realized based on the existing stop word vocabulary.
[0108] Among them, the semantic pause confidence is usually used to measure the reliability of the first word being the end of a sentence. In a specific application scenario, when calculating the semantic pause confidence corresponding to each remaining first word in the second word sequence, a series of features related to semantic pauses can be first defined. These features may include speech features before and after the pause (such as energy, fundamental frequency, spectrum changes, etc.), linguistic features (such as part of speech, syntactic structure, semantic relationship, etc.) and contextual features (such as topic, context, etc.). Then, using machine learning or deep learning methods, the relationship between these features and semantic pauses is learned from a large amount of annotated data to obtain a trained model. In this embodiment, the second word sequence can be directly input into the trained model, and the model is used to output the semantic pause confidence corresponding to each first word in the second word sequence.
[0109] Furthermore, when determining the text division position based on the semantic pause confidence, a target word in the second word sequence whose corresponding semantic pause confidence is greater than a preset confidence threshold can be determined, and the text position of the target word in the archive text to be classified is determined as the text division position. The archive text to be classified is divided at the text division position to obtain a text segment set including multiple text segments.
[0110] Step 540 - 2: Calculate a second sub-embedding vector for each target text domain based on the second text information.
[0111] In specific application scenarios, such as Figure 6 As shown in ①, first enter a file text to be classified (Input: afiles), and then further Figure 6 ② in the figure, embedding learning is performed on the classified file text (file) to obtain the second embedding vector e f . In the embedding learning stage, the three text fields in the file to be classified can be determined by attribute extraction: title, class name, and year. For the disclosed embodiment, the Doc2Vec method can be used for embedding generation to determine the second sub-embedding vector corresponding to the second text information for each text field. Based on the second text information corresponding to title, class name, and year, the second sub-embedding vectors are calculated respectively: t 、e c 、e y .
[0112] Step 540-3: Perform a weighted sum calculation on at least one second sub-embedding vector corresponding to at least one target text domain to obtain a second embedding vector of the archive text to be classified.
[0113] For the embodiments of the present disclosure, Figure 6 In As shown in the figure, based on the second text information corresponding to title, class name, and year, the second sub-embedding vectors are calculated respectively: t 、e c 、e y After that, the second embedding vector can be weighted aggregated to obtain the second embedding vector e of the archive text to be classified. f :
[0114]
[0115] In the formula, e f is the second embedding vector of the archive text to be classified, d f is the number of target text domains contained in the archive text to be classified, e t 、e c 、e y They are the second sub-embedding vectors when the target text domain is title, class name, and year respectively.
[0116] Step 550: Determine a classification result of the archive text to be classified based on the first embedding vector and the second embedding vector.
[0117] The classification tree information also includes the classification labels configured corresponding to each leaf node in the archive classification tree.
[0118] For the embodiments of the present disclosure, Figure 6 As shown in ④ in the figure, when a file to be classified is input, according to the second embedding vector e of the file to be classified calculated in step 540-3, f , further, through Figure 6 ⑤Output.the predicted classification, calculate the second embedding vector e respectively f and the corresponding leaf nodes on the archive classification tree (i.e. Figure 6 The corresponding e in the example p1 、e p2 、e p3 、e p4 、e p5 ), in this embodiment, the matching degree can be calculated by using vector dot product, and the implementation method is as follows:
[0119]
[0120] In the formula, g(ef,tree) is represented by the formula argmax{·}. When the dot product matching calculation is performed between the file file and all the leaf nodes (leafs) on the file classification tree, after traversing all the leaves on the tree, the leaf node with the maximum matching degree is returned, such as c 12 , define this leaf node as the target leaf node, and then the classification label corresponding to the leaf node can be determined as the classification result of the archive text to be classified.
[0121] For the embodiment of the present disclosure, determining the classification result of the archive text to be classified based on the first embedding vector and the second embedding vector in step 550 may include the following steps:
[0122] Step 550 - 1 : Calculate the vector similarity between the archive text to be classified and each leaf node based on the first embedding vector and the second embedding vector.
[0123] For the embodiment of the present disclosure, the vector similarity between the first embedding vector and the second embedding vector may be calculated using cosine similarity, Euclidean distance, etc., which is not specifically limited here.
[0124] Step 550 - 2 : Determine a target leaf node corresponding to the maximum vector similarity among multiple leaf nodes.
[0125] Step 550-3: determine the classification label configured corresponding to the target leaf node as the classification result of the archive text to be classified.
[0126] In a specific application scenario, at least one classification label may be configured for each leaf node. After determining the target leaf node, the classification label configured corresponding to the target leaf node may be directly determined as the classification result of the archive text to be classified.
[0127] In summary, the technical solution in the present application can determine the classification tree information of the archive classification tree, and the classification tree information at least includes the target path of each leaf node in the archive classification tree, and the first text information of each path node on the target path; then the first embedding vector of each leaf node can be generated based on the classification tree information, and the second embedding vector of the archive text to be classified can be calculated; finally, the classification result of the archive text to be classified is determined based on the first embedding vector and the second embedding vector. Through the learning of the embedding vector, the present application can more accurately mine the text semantics corresponding to the archive, thereby improving the accuracy of archive classification. In the process of classifying digital archives based on the archive classification tree, there is no need to traverse the entire archive classification tree, only the leaf nodes on the archive classification tree need to be matched, which greatly reduces the query complexity based on the archive classification tree, thereby improving the classification efficiency of digital archives.
[0128] Based on the above Figure 4 , Figure 5 A detailed description of the digital archive classification method provided, such as Figure 7 As shown, Figure 7 FIG. 1 is a structural block diagram of a digital archive classification device according to an exemplary embodiment. Figure 7 As shown, the device comprises:
[0129] The first determination module 71 may be used to determine classification tree information of the archive classification tree, the classification tree information at least including a target path of each leaf node in the archive classification tree, and first text information of each path node on the target path;
[0130] A generating module 72, which can be used to generate a first embedding vector for each leaf node based on the classification tree information;
[0131] A calculation module 73, which can be used to calculate a second embedding vector of the archive text to be classified;
[0132] The second determination module 74 may be used to determine the classification result of the archive text to be classified based on the first embedding vector and the second embedding vector.
[0133] In some embodiments of the present application, the first determination module 71 can be specifically used to determine the target path of each leaf node in the archive classification tree according to the direction of the leaf node, where the starting point of the target path is the root node of the archive classification tree, and the end point of the target path is each leaf node; determine the multiple path nodes contained in the target path of each leaf node, and the first text information configured for each path node.
[0134] In some embodiments of the present application, the generation module 72 can be specifically used to calculate the first sub-embedding vector of each path node based on the first text information; perform weighted sum calculation on multiple first sub-embedding vectors corresponding to multiple path nodes to obtain the first embedding vector of each leaf node.
[0135] In some embodiments of the present application, the calculation module 73 can be used to determine at least one target text domain contained in the archival text to be classified, and the second text information in each target text domain; based on the second text information, calculate the second sub-embedding vector of each target text domain; perform weighted sum calculation on at least one second sub-embedding vector corresponding to at least one target text domain to obtain the second embedding vector of the archival text to be classified.
[0136] In some embodiments of the present application, when determining at least one target text domain contained in the archival text to be classified, and the second text information in each target text domain, the calculation module 73 can be specifically used to obtain preset keywords corresponding to each preset text domain; perform text preprocessing on the archival text to be classified to obtain a set of text fragments corresponding to the archival text to be classified; based on the preset keywords, calculate the semantic matching degree between each text fragment in the text fragment set and different preset text domains; determine the corresponding preset text domain with a semantic matching degree greater than a preset threshold as the target text domain contained in the archival text to be classified; and determine the text fragment with a semantic matching degree greater than a preset threshold corresponding to the target text domain as the second text information in the target text domain.
[0137] In some embodiments of the present application, when performing text preprocessing on the archival text to be classified to obtain a set of text fragments corresponding to the archival text to be classified, the calculation module 73 can be specifically used to divide the archival text to be classified into multiple first words based on word segmentation technology, and obtain a first word sequence containing multiple first words; remove the second word from the first word sequence to obtain a second word sequence, where the second word is a first word that matches a preset stop word part; calculate the semantic pause confidence corresponding to each remaining first word in the second word sequence; determine the text division position based on the semantic pause confidence; divide the archival text to be classified at the text division position to obtain a set of text fragments containing multiple text fragments.
[0138] In some embodiments of the present application, the classification tree information also includes a classification label configured corresponding to each leaf node in the archive classification tree;
[0139] Correspondingly, the second determination module 74 can be specifically used to calculate the vector similarity between the archive text to be classified and each leaf node based on the first embedding vector and the second embedding vector; determine the target leaf node corresponding to the maximum vector similarity among multiple leaf nodes; and determine the classification label configured corresponding to the target leaf node as the classification result of the archive text to be classified.
[0140] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0141] The embodiment of the present application can determine the classification tree information of the archive classification tree, and the classification tree information at least includes the target path of each leaf node in the archive classification tree, and the first text information of each path node on the target path; then the first embedding vector of each leaf node can be generated based on the classification tree information, and the second embedding vector of the archive text to be classified can be calculated; finally, the classification result of the archive text to be classified is determined based on the first embedding vector and the second embedding vector. Through the learning of the embedding vector, the present application can more accurately mine the text semantics corresponding to the archive, thereby improving the accuracy of archive classification. In the process of classifying digital archives based on the archive classification tree, there is no need to traverse the entire archive classification tree, only the leaf nodes on the archive classification tree need to be matched, which greatly reduces the query complexity based on the archive classification tree, thereby improving the classification efficiency of digital archives.
[0142] The digital archive classification device of the embodiment of the present invention is described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the digital archive classification method embodiment in the embodiment of the present invention can be completed by the hardware integrated logic circuit and / or software instructions in the processor, and the steps of the digital archive classification method applied in conjunction with the embodiment of the present invention can be directly embodied as a hardware decoding processor to perform, or can be performed by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps in the above-mentioned digital archive classification method embodiment in conjunction with its hardware.
[0143] Figure 8 is a schematic block diagram of an electronic device 800 according to an embodiment of the present invention.
[0144] like Figure 8 As shown, the electronic device 800 may include:
[0145] The memory 810 and the processor 820, the memory 810 is used to store the computer program and transmit the program code to the processor 820. In other words, the processor 820 can call and run the computer program from the memory 810 to implement the method in the embodiment of the present invention.
[0146] For example, the processor 820 may be configured to execute the above method embodiments according to instructions in the computer program.
[0147] In some embodiments of the present invention, the processor 820 may include but is not limited to:
[0148] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0149] In some embodiments of the present invention, the memory 810 includes but is not limited to:
[0150] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
[0151] In some embodiments of the present invention, the computer program may be divided into one or more modules, which are stored in the memory 810 and executed by the processor 820 to complete the method provided by the present invention. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the controller.
[0152] like Figure 8 As shown, the electronic device 800 may further include:
[0153] The transceiver 830 may be connected to the processor 820 or the memory 810 .
[0154] The processor 820 may control the transceiver 830 to communicate with other devices, specifically, to send data to other devices or receive data sent by other devices. The transceiver 830 may include a transmitter and a receiver. The transceiver 830 may further include an antenna, and the number of antennas may be one or more.
[0155] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0156] The present invention also provides a computer storage medium having a computer program stored thereon, which, when executed by a computer, enables the computer to perform the method of the above method embodiment. In other words, an embodiment of the present invention also provides a computer program product containing instructions, which, when executed by a computer, enables the computer to perform the method of the above method embodiment.
[0157] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (Digital Video Disc, DVD)), or a semiconductor medium (e.g., a solid-state drive (Solid State Disk, SSD)), etc.
[0158] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments applied herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0159] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0160] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0161] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this application, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A digital archive classification method, characterized in that: include: Determine classification tree information of the archive classification tree, the classification tree information at least including a target path of each leaf node in the archive classification tree, and first text information of each path node on the target path; Generate a first embedding vector for each leaf node based on the classification tree information; Calculate the second embedding vector of the archive text to be classified; A classification result of the to-be-classified archive text is determined based on the first embedding vector and the second embedding vector.
2. The method according to claim 1, characterized in that The classification tree information of determining the archive classification tree includes: In the archive classification tree, according to the direction of the leaf nodes, a target path of each leaf node is determined, wherein the starting point of the target path is the root node of the archive classification tree, and the end point of the target path is each leaf node; Determine a plurality of path nodes included in a target path of each of the leaf nodes, and first text information configured for each of the path nodes.
3. The method according to claim 1, characterized in that The step of generating a first embedding vector for each leaf node based on the classification tree information comprises: Based on the first text information, calculating a first sub-embedding vector of each of the path nodes; A weighted sum calculation is performed on multiple first sub-embedding vectors corresponding to multiple path nodes to obtain a first embedding vector for each leaf node.
4. The method according to claim 1, characterized in that The step of calculating the second embedding vector of the archive text to be classified includes: Determine at least one target text field contained in the archive text to be classified, and second text information in each of the target text fields; Based on the second text information, calculating a second sub-embedding vector for each of the target text fields; A weighted sum calculation is performed on at least one of the second sub-embedding vectors corresponding to at least one target text domain to obtain a second embedding vector of the archive text to be classified.
5. The method according to claim 4, characterized in that The step of determining at least one target text field contained in the archive text to be classified, and the second text information in each target text field, includes: Get the preset keywords corresponding to each preset text field; Performing text preprocessing on the archive text to be classified to obtain a set of text segments corresponding to the archive text to be classified; Based on the preset keywords, calculating the semantic matching degree between each text segment in the text segment set and different preset text domains; Determine the preset text domain corresponding to the semantic matching degree greater than the preset threshold as the target text domain included in the archive text to be classified; The text segment corresponding to the target text domain and having a semantic matching degree greater than the preset threshold is determined as the second text information in the target text domain.
6. The method according to claim 5, characterized in that The text preprocessing of the archive text to be classified to obtain a set of text segments corresponding to the archive text to be classified includes: Based on the word segmentation technology, the archive text to be classified is divided into a plurality of first words, and a first word sequence containing the plurality of the first words is obtained; Eliminate a second word from the first word sequence to obtain a second word sequence, wherein the second word is the first word that matches a preset stop part of speech; Calculating the semantic pause confidence corresponding to each remaining first word in the second word sequence; Determining a text division position based on the semantic pause confidence; The archive text to be classified is divided at the text division position to obtain a text segment set including a plurality of text segments.
7. The method according to claim 1, characterized in that The classification tree information also includes the classification label configured corresponding to each leaf node in the archive classification tree; The determining the classification result of the to-be-classified archive text based on the first embedding vector and the second embedding vector comprises: Based on the first embedding vector and the second embedding vector, calculating the vector similarity between the archive text to be classified and each of the leaf nodes; Determine a target leaf node corresponding to the maximum vector similarity among the plurality of leaf nodes; The classification label configured corresponding to the target leaf node is determined as the classification result of the archive text to be classified.
8. A digital file classification device, characterized in that: include: A first determination module is used to determine classification tree information of an archive classification tree, wherein the classification tree information at least includes a target path of each leaf node in the archive classification tree and first text information of each path node on the target path; A generating module, configured to generate a first embedding vector for each leaf node based on the classification tree information; A calculation module, used for calculating a second embedding vector of the archive text to be classified; The second determination module is used to determine the classification result of the archive text to be classified based on the first embedding vector and the second embedding vector.
9. An electronic device, characterized in that: include: A processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 7.