File classification method and device, storage medium and electronic device

Through the fusion of the feature matrix of the file and content of the file, the problem of inaccurate classification of files is solved, and higher classification accuracy and information processing accuracy are achieved.

CN119357452APending Publication Date: 2025-01-24HUANENG MANZHOULI WIND POWER CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411387112.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

During the process of file sorting and classification, due to the different names of the entries extracted in the file but the same content, the file classification is inaccurate, causing difficulty in subsequent processing.

Method used

By obtaining the information of the file, characterizing the items and content as a feature matrix, using a preset neural network model for feature fusion, determining the similarity matrix between the items and content, and performing weighted fusion to determine the classification result of the file.

Benefits of technology

It improves the accuracy of file classification, can more accurately identify and handle synonyms of information extracted from multiple files, and improves the accuracy of information classification and transformation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357452A_ABST
    Figure CN119357452A_ABST
Patent Text Reader

Abstract

The invention discloses a file classification method and device, a storage medium, an electronic device and a computer program product. The method comprises the following steps: acquiring information of a first file and information of a second file; the first item and the second item are respectively represented as a first item feature matrix and a second item feature matrix, and the first content and the second content are respectively represented as a first content feature matrix and a second content feature matrix. And determining a first similarity discrimination matrix between the first entry and the second entry. And determining a second similarity discrimination matrix between the first content and the second content. And determining a classification result of the first file and the second file. And respectively carrying out similarity comparison on the entry information and the content information of the first file and the second file. According to the method, whether the first file and the second file are the same in category or not is comprehensively judged, and then the first file and the second file are classified, so that whether information extracted from multiple files is the same in category or not can be more accurately identified, and the file classification accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of file classification, and more specifically, to a file classification method and device, a storage medium, an electronic device, and a computer program product. Background Art

[0002] With the rapid development of science and technology, the amount of data in various files has increased significantly. In the post-project evaluation process, many files need to be sorted and summarized. In the process of sorting and summarizing files, files need to be classified and integrated to transform unstructured content into structured data, which is convenient for staff to conduct content analysis and management.

[0003] In related technologies, artificial intelligence technology is used to process files, extract information from each file, intelligently identify key entries and corresponding content, and classify and integrate similar information.

[0004] However, due to the complexity of the files, it is possible that the names of entries extracted from different files are different, but the contents of the files are the same, resulting in inaccurate file classification and bringing difficulties to subsequent file processing. Summary of the invention

[0005] Embodiments of the present application provide a file classification method and device, a storage medium, an electronic device, and a computer program product.

[0006] According to one aspect of an embodiment of the present application, a file classification method is provided, the method comprising: obtaining information of a first file and information of a second file, wherein the information of the first file comprises a first item and a first content, and the information of the second file comprises a second item and a second content; representing the first item and the second item as a first item feature matrix and a second item feature matrix, respectively, and representing the first content and the second content as a first content feature matrix and a second content feature matrix, respectively; performing feature fusion on the first item feature matrix and the second item feature matrix using a preset neural network model to determine a first similarity discriminant matrix between the first item and the second item; performing feature fusion on the first content feature matrix and the second content feature matrix using a preset neural network model to determine a second similarity discriminant matrix between the first content and the second content; and performing weighted fusion according to the first similarity discriminant matrix and the second similarity discriminant matrix to determine classification results of the first file and the second file.

[0007] In an exemplary embodiment, the characterizing the first entry and the second entry as a first entry feature matrix and a second entry feature matrix, respectively, and the characterizing the first content and the second content as a first content feature matrix and a second content feature matrix, respectively, includes: using an embedding layer to perform vectorized representation processing on the first entry and the second entry to obtain a first entry feature matrix and a second entry feature matrix; and using a pre-trained large language model to perform deep semantic representation processing on the first content and the second content to obtain a first content feature matrix and a second content feature matrix.

[0008] In an exemplary embodiment, the first entry feature matrix and the second entry feature matrix are subjected to feature fusion using a preset neural network model to determine a first similarity discriminant matrix between the first entry and the second entry, including: processing the first entry feature matrix and the second entry feature matrix through a fully connected layer respectively to convert them into a first entry feature vector and a second entry feature vector; performing a dot multiplication operation on the first entry feature vector and the second entry feature vector to determine a first similarity feature vector between the first entry feature vector and the second entry feature vector; concatenating the first entry feature vector and the second entry feature vector to obtain an entry information feature vector; and determining the first similarity discriminant matrix based on the first similarity feature vector and the entry information feature vector.

[0009] In an exemplary embodiment, the method of performing a dot product operation on the first entry feature vector and the second entry feature vector to determine a first similarity feature vector between the first entry feature vector and the second entry feature vector also includes: performing a dot product operation on the first entry feature vector and the second entry feature vector to obtain a first similarity vector; concatenating the maximum elements in the first entry feature vector and the second entry feature vector to obtain a maximum entry element vector; determining the cosine similarity between the first entry feature vector and the second entry feature vector based on the first similarity vector and the maximum entry element vector to normalize the similarity; and converting the cosine similarity into the first similarity feature vector using an activation function.

[0010] In an exemplary embodiment, the first content feature matrix and the second content feature matrix are subjected to feature fusion using a preset neural network model to determine a second similarity discriminant matrix between the first content and the second content, including: respectively using a multi-head self-attention mechanism to mine and learn the first content feature matrix and the second content feature matrix to obtain a first content feature vector and a second content feature vector; concatenating the first content feature vector and the second content feature vector to obtain a comprehensive content feature vector; respectively processing the first content feature matrix and the second content feature matrix through a fully connected layer to convert them into a first content feature vector and a second content feature vector; performing a dot product operation on the first content feature vector and the second content feature vector to determine a second similarity feature vector between the first content feature vector and the second content feature vector; and determining the second similarity discriminant matrix based on the second similarity feature vector and the comprehensive content feature vector.

[0011] In an exemplary embodiment, performing a dot product operation on the first content feature vector and the second content feature vector to determine a second similarity feature vector between the first content feature vector and the second content feature vector includes: performing a dot product operation on the first content feature vector and the second content feature vector to obtain a first similarity vector; concatenating the maximum elements in the first content feature vector and the second content feature vector to obtain a maximum content element vector; determining the cosine similarity between the first content feature vector and the second content feature vector based on the first similarity vector and the maximum content element vector to normalize the similarity; and transforming the cosine similarity using an activation function, and then fusing it with the first content feature matrix and the second content feature matrix to obtain the second similarity feature vector.

[0012] According to another aspect of an embodiment of the present application, a file classification device is also provided, the device comprising:

[0013] An information acquisition module, used to acquire information of a first file and information of a second file, wherein the information of the first file includes a first item and a first content, and the information of the second file includes a second item and a second content;

[0014] An information characterization module, configured to characterize the first item and the second item as a first item feature matrix and a second item feature matrix, respectively, and characterize the first content and the second content as a first content feature matrix and a second content feature matrix, respectively;

[0015] A first fusion module, used to perform feature fusion on the first entry feature matrix and the second entry feature matrix using a preset neural network model to determine a first similarity discriminant matrix between the first entry and the second entry;

[0016] A second fusion module, configured to perform feature fusion on the first content feature matrix and the second content feature matrix using a preset neural network model to determine a second similarity discrimination matrix between the first content and the second content;

[0017] A classification module is used to perform weighted fusion according to the first similarity discrimination matrix and the second similarity discrimination matrix to determine the classification results of the first file and the second file.

[0018] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned file classification method when running.

[0019] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the file classification method through the computer program.

[0020] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.

[0021] The above-mentioned file classification method obtains information of a first file and information of a second file, wherein the information of the first file includes a first item and a first content, and the information of the second file includes a second item and a second content. The first item and the second item are respectively characterized as a first item feature matrix and a second item feature matrix, and the first content and the second content are respectively characterized as a first content feature matrix and a second content feature matrix. The first item feature matrix and the second item feature matrix are subjected to feature fusion using a preset neural network model to determine a first similarity discriminant matrix between the first item and the second item. The first content feature matrix and the second content feature matrix are subjected to feature fusion using a preset neural network model to determine a second similarity discriminant matrix between the first content and the second content. Weighted fusion is performed based on the first similarity discriminant matrix and the second similarity discriminant matrix to determine the classification results of the first file and the second file. By using the method of the present application, the item information and the content information of the first file and the second file are respectively compared for similarity, and then the comparison results are fused, and finally it is comprehensively judged whether the first file and the second file are of the same category, and then the first file and the second file are classified, which can more accurately identify and process the synonymy problem of information extracted from multiple files, improve the accuracy of information classification and conversion, and thus improve the accuracy of file classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0024] Figure 1 It is a hardware structure block diagram of the file classification method of the embodiment of the present application;

[0025] Figure 2 is a flow chart of a file classification method according to an embodiment of the present application;

[0026] Figure 3 This is a second flowchart of a method for classifying files according to an embodiment of the present application;

[0027] Figure 4 This is a third flowchart of a method for classifying files according to an embodiment of the present application;

[0028] Figure 5 This is a fourth flowchart of a method for classifying files according to an embodiment of the present application;

[0029] Figure 6 is a fifth flowchart of a method for classifying files according to an embodiment of the present application;

[0030] Figure 7 This is a sixth flowchart of a method for classifying files according to an embodiment of the present application;

[0031] Figure 8 is an architectural diagram of a file classification method according to an embodiment of the present application;

[0032] Fig. 9 It is a structural block diagram of a file classification device according to an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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 creative work should fall within the scope of protection of the present application.

[0034] 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 under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising 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 equipment.

[0035] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of the file classification method of the embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1The computer terminal includes a processor 102 (only one is shown in the figure) (the processor 102 may include but is not limited to a microprocessor (Microprocessor Unit, referred to as MPU) or a programmable logic device (Programmable logic device, referred to as PLD)) and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 A different configuration with more features is shown.

[0036] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the classification method of files in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0037] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0038] In this embodiment, a file classification method is provided. Figure 2 4 is a flowchart of an optional file classification method according to an embodiment of the present application, the process includes the following steps S200-S240:

[0039] Step S200, obtaining information of the first file and information of the second file.

[0040] The information of the first file includes a first entry and a first content, and the information of the second file includes a second entry and a second content.

[0041] Step S210: The first item and the second item are represented as a first item feature matrix and a second item feature matrix respectively, and the first content and the second content are represented as a first content feature matrix and a second content feature matrix respectively.

[0042] Step S220: Using a preset neural network model to perform feature fusion on the first entry feature matrix and the second entry feature matrix to determine a first similarity discriminant matrix between the first entry and the second entry.

[0043] Step S230: The first content feature matrix and the second content feature matrix are subjected to feature fusion using a preset neural network model to determine a second similarity discrimination matrix between the first content and the second content.

[0044] Step S240: performing weighted fusion based on the first similarity discriminant matrix and the second similarity discriminant matrix to determine the classification results of the first file and the second file.

[0045] Specifically, after obtaining the first similarity discriminant matrix representing item similarity and the second similarity discriminant matrix representing content similarity, they are weighted and fused to determine the classification results of the first file and the second file, that is, to determine whether the first file and the second file belong to the same category, thereby facilitating subsequent file classification.

[0046] Exemplarily, the process of weighted fusion of the first similarity discriminant matrix and the second similarity discriminant matrix can be expressed by the following formula:

[0047] y = Softmax(W×ReLU(W×F I +W×F P +b)+b)

[0048] Among them, W is the weight matrix, b is the bias vector, ReLU represents the activation function, and F I is the first similarity discriminant matrix, F P is the second similarity discriminant matrix. The Softmax activation function is used to convert the final vector into a probability distribution. y represents the classification result, indicating the probability that the first file and the second file (entity A and entity B) belong to the same category. The larger the value of y, the greater the probability that the first file and the second file belong to the same category.

[0049] In this embodiment, information of a first file and information of a second file are obtained, the information of the first file includes a first item and a first content, and the information of the second file includes a second item and a second content. The first item and the second item are represented as a first item feature matrix and a second item feature matrix, respectively, and the first content and the second content are represented as a first content feature matrix and a second content feature matrix, respectively. The first item feature matrix and the second item feature matrix are subjected to feature fusion using a preset neural network model to determine a first similarity discriminant matrix between the first item and the second item. The first content feature matrix and the second content feature matrix are subjected to feature fusion using a preset neural network model to determine a second similarity discriminant matrix between the first content and the second content. Weighted fusion is performed based on the first similarity discriminant matrix and the second similarity discriminant matrix to determine the classification results of the first file and the second file. By using the method of the present application, the item information and the content information of the first file and the second file are respectively compared for similarity, and then the comparison results are fused, and finally the first file and the second file are comprehensively judged whether they are of the same category, and then the first file and the second file are classified, which can more accurately identify and process the synonymous and synonymous problems of information extracted from multiple files, improve the accuracy of information classification and conversion, and thus improve the accuracy of file classification.

[0050] In one embodiment, Figure 3 As shown, in step S210, the first item and the second item are represented as a first item feature matrix and a second item feature matrix respectively, and the first content and the second content are represented as a first content feature matrix and a second content feature matrix respectively. The method includes steps S300-S310.

[0051] Step S300: Use an embedding layer to perform vectorized representation processing on the first entry and the second entry to obtain a first entry feature matrix and a second entry feature matrix.

[0052] Specifically, since the text information of the entry is relatively small, usually only one or a few words, the embedding layer is directly used for representation. The embedding layer is a technology that converts words or phrases into vectors of fixed dimensions. This vector can capture the semantic information of the word. The network structure is relatively simple, which can reduce the computational complexity.

[0053] Step S310: Use a pre-trained large language model to perform deep semantic representation processing on the first content and the second content to obtain a first content feature matrix and a second content feature matrix.

[0054] Specifically, because the text information of the content is more and more complex, compared with the entry, the content usually contains more information, which may include complete sentences or paragraphs, and contains rich semantic and contextual information. Therefore, it is necessary to use a pre-trained large language model for processing to fully mine the semantic information in the content. For example, a pre-trained deep bidirectional language representation model (Bi di rect iona l Encoder Representation from Transformers, BERT) is used for representation. Through bidirectional training, it can capture the deep semantic information in the text and understand the contextual meaning of words in the text, which is very helpful for understanding complex content.

[0055] In this embodiment, for entries and contents, appropriate representation methods are selected according to different characteristics (length and complexity) of text information, and the text is represented in a form that is convenient for computer processing to achieve more accurate and efficient information processing.

[0056] In one embodiment, Figure 4 As shown, step S220, the first item feature matrix and the second item feature matrix are subjected to feature fusion using a preset neural network model to determine a first similarity discrimination matrix between the first item and the second item. It includes: steps S400-S430. Among them:

[0057] Step S400: The first item feature matrix and the second item feature matrix are processed through a fully connected layer respectively to be converted into a first item feature vector and a second item feature vector.

[0058] Specifically, the first entry feature matrix and the second entry feature matrix are first input into the fully connected layer (also called the linear layer) for processing to extract more useful information. The fully connected layer uses the weight matrix W and the bias vector b to perform a linear transformation on the input features. For example, the first entry feature vector W×I A +b, and the second entry eigenvector W×I B +b, where I A is the first entry feature matrix, I B is the second entry feature matrix.

[0059] Step S410: performing a dot product operation on the first item feature vector and the second item feature vector to determine a first similarity feature vector between the first item feature vector and the second item feature vector.

[0060] Specifically, the first entry feature vector and the second entry feature vector are multiplied by a dot operation, for example (W×I A +b)·(W×I B+b), which can multiply the corresponding elements to obtain a vector of the same dimension as the input vector. The dot product operation can quantify the similarity of two vectors in direction. The larger the result of the dot product, the more similar they are in direction.

[0061] Step S420: concatenate the first entry feature vector and the second entry feature vector to obtain an entry information feature vector.

[0062] The first entry feature vector and the second entry feature vector are concatenated to form a new entry information feature vector, which contains all the information of the first entry feature vector and the second entry feature vector. Then, the dimension of the entry information feature vector can be restored to the dimension before concatenation through the fully connected layer to facilitate subsequent calculations.

[0063] Exemplarily, the formula for obtaining the entry information feature vector may be as follows:

[0064] Con = ReLU(W×(I A ||I B )+b)

[0065] Among them, W is the weight matrix, b is the bias vector, W and b are training parameters that can be adjusted during model training, || represents concatenation, ReLU represents the activation function, and I A is the first entry feature matrix, I B is the second entry feature matrix, and Con is the entry information feature vector.

[0066] Step S430: determining a first similarity discriminant matrix according to the first similarity feature vector and the entry information feature vector.

[0067] Specifically, by multiplying the first similarity feature vector with the entry information feature vector, the similarity discrimination information can be combined with the information of the entry itself, and finally a first similarity discrimination matrix of the entry is obtained through a fully connected matrix.

[0068] Exemplarily, the process of determining the first similarity discriminant matrix is ​​shown in the following formula:

[0069] F I =ReLU(W×(Sim×Con)+b)

[0070] Where W is the weight matrix, b is the bias vector, ReLU represents the activation function, Sim is the first similarity feature vector, Con is the entry information feature vector, and F I is the first similarity discriminant matrix.

[0071] In this embodiment, by processing the feature matrix of the entry, on the one hand, the first similarity feature vector of the first entry feature matrix and the second entry feature matrix is ​​determined, and the similarity of the first entry feature matrix and the second entry feature matrix can be determined. On the other hand, the first entry feature matrix and the second entry feature matrix are spliced ​​to obtain an entry information feature vector, which can represent all the information of the first entry feature matrix and the second entry feature matrix. Finally, the first similarity feature vector and the entry information feature vector are combined to obtain a first similarity discriminant matrix, which can accurately determine whether the first entry and the second entry belong to the same category.

[0072] In one embodiment, Figure 5 As shown, step S410 is to perform a dot product operation on the first item feature vector and the second item feature vector to determine a first similarity feature vector between the first item feature vector and the second item feature vector. The method includes steps S500-S530.

[0073] Step S500: performing a dot product operation on the first item feature vector and the second item feature vector to obtain a first similarity vector.

[0074] Step S510: concatenate the maximum elements in the first entry feature vector and the second entry feature vector to obtain a maximum entry element vector.

[0075] Step S520: Determine the cosine similarity between the first entry feature vector and the second entry feature vector according to the first similarity vector and the maximum entry element vector, so as to normalize the similarity.

[0076] Specifically, by calculating the cosine similarity, the similarity can be normalized, that is, mapped to between 0 and 1.

[0077] Among them, cosine similarity can measure the semantic similarity between two text contents. In natural language processing, especially in scenarios involving text content comparison and matching, simply comparing the literal content of the text is not enough, because even if two texts are literally different, they may express the same or similar meanings. Cosine similarity measures this semantic similarity by comparing the direction of text vectors in vector space, rather than simply comparing their size or difference. Cosine similarity only focuses on the direction of the vector, not its size, which enables it to capture the semantic similarity of text content. And cosine similarity can normalize the text, providing a standardized way to compare texts of different lengths and sizes.

[0078] Step S530: convert the cosine similarity into a first similarity feature vector using an activation function.

[0079] Among them, the Softmax activation function can be used to transform the result so that its sum is 1. The Softmax function is usually used to convert a vector into a probability distribution. Here it ensures that the value of each element in the similarity matrix is ​​between 0 and 1.

[0080] Exemplarily, the process of obtaining the first similarity feature vector is represented by the following formula:

[0081]

[0082] Among them, W×I A +b is the first entry eigenvector, W×I B +b is the second entry feature vector, W is the weight matrix, b is the bias vector, || represents concatenation, max(I A ||I B ) represents the matrix I A and I B The concatenation of the largest element values ​​in is the maximum entry element vector, Softmax is the activation function, Sim is the first similarity feature vector, which reflects the similarity between the first entry feature vector and the second entry feature vector.

[0083] In this embodiment, the feature matrix of the entries is processed to determine the cosine similarity between the feature vector of the first entry and the feature vector of the second entry, and then the first similarity feature vector is determined based on the cosine similarity. By calculating the cosine similarity, it is possible to more accurately determine whether the two entities (the first entry and the second entry) belong to the same category.

[0084] In one embodiment, Figure 6 As shown, step S230 is to fuse the first content feature matrix and the second content feature matrix using a preset neural network model to determine a second similarity discrimination matrix between the first content and the second content. The method includes steps S600-S640.

[0085] Step S600: Use a multi-head self-attention mechanism to mine and learn the first content feature matrix and the second content feature matrix to obtain a first content feature vector and a second content feature vector.

[0086] Specifically, the first content feature matrix and the second content feature matrix are matrices that represent the first content and the second content respectively, and then the Transformer's Multi-Head Attention (MHA) mechanism is used to conduct in-depth content mining and learning, which can simultaneously consider the importance of different positions in the content sequence, thereby capturing different dependencies in the sequence. The first content feature vector that can better represent the first content and the second content feature vector that can better represent the second content are obtained.

[0087] Step S610: concatenate the first content feature vector and the second content feature vector to obtain a comprehensive content feature vector.

[0088] Specifically, the first content feature vector and the second content feature vector are concatenated, so as to integrate information of the first content and the second content, and obtain a comprehensive content feature vector, which represents semantic information of the first content and the second content.

[0089] Exemplarily, the process of steps S600-S610 is represented by the following formula:

[0090] DP A =ReLU(W×MHA(P A )+b)

[0091] DP B =ReLU(W×MHA(P B )+b)

[0092] DP=DP A ||DP B

[0093] Among them, MHA represents the multi-head self-attention mechanism of Transformer, W and b are training parameters, || represents concatenation, ReLU represents the activation function, and P A is the first content feature matrix, P B is the second content feature matrix, DP A is the first content feature vector, DP B is the second content feature vector, and DP is the comprehensive content feature vector.

[0094] Step S620 , converting the first content feature matrix and the second content feature matrix into a first content feature vector and a second content feature vector respectively through a fully connected layer.

[0095] Specifically, the first content feature matrix and the second content feature matrix are input into the fully connected layer for processing to extract more useful information. The fully connected layer uses the weight matrix W and the bias vector b to perform a linear transformation on the input features. For example, the first content feature vector W×P A +b, and the second content feature vector W×P B +b, where P A is the first content feature matrix, P B is the second content feature matrix.

[0096] Step S630: Perform a dot product operation on the first content feature vector and the second content feature vector to determine a second similarity feature vector between the first content feature vector and the second content feature vector.

[0097] Specifically, the first content feature vector and the second content feature vector are subjected to a dot product operation, for example (W×P A +b)·(W×P B +b), which can multiply the corresponding elements to obtain a vector of the same dimension as the input vector. The dot product operation can quantify the similarity of two vectors in direction. The larger the result of the dot product, the more similar they are in direction.

[0098] Step S640: Determine a second similarity discriminant matrix according to the second similarity feature vector and the comprehensive content feature vector.

[0099] Specifically, the second similarity feature vector and the comprehensive content feature vector are weightedly fused to fuse the information and association relationship of the first content and the second content, and finally a second similarity discriminant matrix of the content is obtained through a fully connected matrix.

[0100] Exemplarily, the second similarity discriminant matrix can be expressed by the following formula:

[0101] F P =ReLU(W×ReLU(W×DP+W×SP+b)+b)

[0102] Among them, W and b are training parameters, ReLU represents the activation function, DP is the comprehensive content feature vector, SP is the second similarity feature vector, and F P is the second similarity discriminant matrix. DP is the deep semantic feature obtained by using the multi-head self-attention mechanism of Transformer for the first content feature vector and the second content feature vector, which represents the deep semantic features of entity A and entity B. SP represents the second similarity feature vector of the similarity between entity A and entity B. DP and SP are fused to obtain the second similarity discriminant matrix F P , so F P It is possible to accurately determine whether the first content and the second content belong to the same category.

[0103] In this embodiment, by processing the feature matrix of the content, on the one hand, the second similarity feature vector of the first content feature matrix and the second content feature matrix is ​​determined, and the similarity of the first content feature matrix and the second content feature matrix can be determined. On the other hand, the first content feature matrix and the second content feature matrix are spliced ​​to obtain a comprehensive content feature vector, which can represent all the information of the first content feature matrix and the second content feature matrix. Finally, the second similarity feature vector and the comprehensive content feature vector are combined to obtain a second similarity discrimination matrix, which can accurately determine whether the first content and the second content belong to the same category.

[0104] In one embodiment, Figure 7 As shown, step S630, performing a dot multiplication operation on the first content feature vector and the second content feature vector to determine a second similarity feature vector between the first content feature vector and the second content feature vector. It includes: steps S700-S730. Among them:

[0105] Step S700: Perform a dot product operation on the first content feature vector and the second content feature vector to obtain a first similarity vector.

[0106] Step S710: Concatenate the maximum elements in the first content feature vector and the second content feature vector to obtain a maximum content element vector.

[0107] Step S720 : determining the cosine similarity between the first content feature vector and the second content feature vector according to the first similarity vector and the maximum content element vector, so as to normalize the similarity.

[0108] Specifically, by calculating the cosine similarity, the similarity can be normalized, that is, mapped to between 0 and 1.

[0109] Step S730: transform the cosine similarity using an activation function, and then merge it with the first content feature matrix and the second content feature matrix to obtain a second similarity feature vector.

[0110] Among them, the Softmax activation function can be used to transform the result so that its sum is 1. The Softmax function is usually used to convert a vector into a probability distribution. Here it ensures that the value of each element in the similarity matrix is ​​between 0 and 1.

[0111] Exemplarily, the process of obtaining the second similarity feature vector is represented by the following formula:

[0112]

[0113] Among them, W is the weight matrix, b is the bias vector, || represents splicing, max(PA ||P B ) represents the matrix P A and P B The largest element value in is the maximum content element vector, Softmax represents the activation function, P A is the first content feature matrix, P B is the second content feature matrix, and SP is the second similarity feature vector.

[0114] For example, the process in the above embodiment can refer to Figure 8 As shown in the architecture diagram, the first file is represented as entity A, and the second file is represented as entity B. First, the information of the first item and the first content of the first file is extracted and recorded as item A and content A. The information of the second item and the second content of the second file is extracted and recorded as item B and content B. Then, the embedding layer is used to characterize item A and item B, and the feature matrix I of the first item is obtained. A , the second entry feature matrix I B , use the BERT model to represent content A and content B, and get the first content feature matrix P A , the second content feature matrix P B , and then use the preset neural network model for processing, and finally output the classification results of entity A and entity B. Figure 8 The various parts recorded in have been described in detail in the above embodiments and will not be repeated here.

[0115] In this embodiment, by processing the feature matrix of the content, the cosine similarity between the first content feature vector and the second content feature vector is determined, and then the second similarity feature vector is determined based on the cosine similarity. By calculating the cosine similarity, it is possible to more accurately determine whether the two entities (the first content and the second content) belong to the same category.

[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0117] In this embodiment, a file classification device is also provided, and the file classification device is used to implement the above-mentioned embodiment and preferred implementation mode, and the description has been made no further. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0118] Fig. 9 is a structural block diagram of an optional file classification device according to an embodiment of the present application; Fig. 9 As shown, including:

[0119] The information acquisition module 901 is used to acquire information of a first file and information of a second file, wherein the information of the first file includes a first entry and a first content, and the information of the second file includes a second entry and a second content.

[0120] The information characterization module 902 is used to characterize the first item and the second item as a first item feature matrix and a second item feature matrix, respectively, and characterize the first content and the second content as a first content feature matrix and a second content feature matrix, respectively.

[0121] The first fusion module 903 is used to perform feature fusion on the first entry feature matrix and the second entry feature matrix using a preset neural network model to determine a first similarity discriminant matrix between the first entry and the second entry.

[0122] The second fusion module 904 is used to perform feature fusion on the first content feature matrix and the second content feature matrix using a preset neural network model to determine a second similarity discrimination matrix between the first content and the second content.

[0123] The classification module 905 is used to perform weighted fusion according to the first similarity discriminant matrix and the second similarity discriminant matrix to determine the classification result of the first file and the second file.

[0124] Through the above device, the information of the first file and the information of the second file are obtained, the information of the first file includes the first item and the first content, and the information of the second file includes the second item and the second content. The first item and the second item are respectively characterized as the first item feature matrix and the second item feature matrix, and the first content and the second content are respectively characterized as the first content feature matrix and the second content feature matrix. The first item feature matrix and the second item feature matrix are subjected to feature fusion using a preset neural network model to determine the first similarity discriminant matrix between the first item and the second item. The first content feature matrix and the second content feature matrix are subjected to feature fusion using a preset neural network model to determine the second similarity discriminant matrix between the first content and the second content. The classification results of the first file and the second file are determined by weighted fusion according to the first similarity discriminant matrix and the second similarity discriminant matrix. By using the method of the present application, the item information and the content information of the first file and the second file are respectively compared for similarity, and then the comparison results are fused, and finally the first file and the second file are comprehensively judged whether they are of the same category, and then the first file and the second file are classified, which can more accurately identify and process the synonymous problem of information extracted from multiple files, improve the accuracy of information classification and conversion, and thus improve the accuracy of file classification.

[0125] In an exemplary embodiment, the information representation module 902 is also used to perform vectorized representation processing on the first item and the second item using an embedding layer to obtain a first item feature matrix and a second item feature matrix; and perform deep semantic representation processing on the first content and the second content using a pre-trained large language model to obtain a first content feature matrix and a second content feature matrix.

[0126] In an exemplary embodiment, the first fusion module 903 is also used to process the first entry feature matrix and the second entry feature matrix through a fully connected layer respectively to convert them into a first entry feature vector and a second entry feature vector; perform a dot multiplication operation on the first entry feature vector and the second entry feature vector to determine a first similarity feature vector between the first entry feature vector and the second entry feature vector; concatenate the first entry feature vector and the second entry feature vector to obtain an entry information feature vector; and determine a first similarity discriminant matrix based on the first similarity feature vector and the entry information feature vector.

[0127] In an exemplary embodiment, the first fusion module 903 is further used to perform a dot product operation on the first entry feature vector and the second entry feature vector to obtain a first similarity vector; concatenate the maximum elements in the first entry feature vector and the second entry feature vector to obtain a maximum entry element vector; determine the cosine similarity between the first entry feature vector and the second entry feature vector based on the first similarity vector and the maximum entry element vector to normalize the similarity; and use an activation function to convert the cosine similarity into the first similarity feature vector.

[0128] In an exemplary embodiment, the second fusion module 904 is further used to respectively use a multi-head self-attention mechanism to mine and learn the first content feature matrix and the second content feature matrix to obtain a first content feature vector and a second content feature vector; concatenate the first content feature vector and the second content feature vector to obtain a comprehensive content feature vector; process the first content feature matrix and the second content feature matrix through a fully connected layer respectively to convert them into a first content feature vector and a second content feature vector; perform a dot product operation on the first content feature vector and the second content feature vector to determine a second similarity feature vector between the first content feature vector and the second content feature vector; and determine a second similarity discriminant matrix based on the second similarity feature vector and the comprehensive content feature vector.

[0129] In an exemplary embodiment, the second fusion module 904 is further used to perform a dot product operation on the first content feature vector and the second content feature vector to obtain a first similarity vector; concatenate the maximum elements in the first content feature vector and the second content feature vector to obtain a maximum content element vector; determine the cosine similarity between the first content feature vector and the second content feature vector based on the first similarity vector and the maximum content element vector to normalize the similarity; transform the cosine similarity using an activation function, and then fuse it with the first content feature matrix and the second content feature matrix to obtain a second similarity feature vector.

[0130] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.

[0131] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:

[0132] S1, obtaining information of a first file and information of a second file, wherein the information of the first file includes a first entry and a first content, and the information of the second file includes a second entry and a second content.

[0133] S2, representing the first entry and the second entry as a first entry feature matrix and a second entry feature matrix respectively, and representing the first content and the second content as a first content feature matrix and a second content feature matrix respectively.

[0134] S3, using a preset neural network model to perform feature fusion on the first item feature matrix and the second item feature matrix, and determining a first similarity discrimination matrix between the first item and the second item.

[0135] S4, using a preset neural network model to perform feature fusion on the first content feature matrix and the second content feature matrix to determine a second similarity discrimination matrix between the first content and the second content.

[0136] S5, performing weighted fusion according to the first similarity discriminant matrix and the second similarity discriminant matrix to determine the classification results of the first file and the second file.

[0137] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0138] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0139] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0140] S1, obtaining information of a first file and information of a second file, wherein the information of the first file includes a first entry and a first content, and the information of the second file includes a second entry and a second content.

[0141] S2, representing the first entry and the second entry as a first entry feature matrix and a second entry feature matrix respectively, and representing the first content and the second content as a first content feature matrix and a second content feature matrix respectively.

[0142] S3, using a preset neural network model to perform feature fusion on the first item feature matrix and the second item feature matrix, and determining a first similarity discrimination matrix between the first item and the second item.

[0143] S4, using a preset neural network model to perform feature fusion on the first content feature matrix and the second content feature matrix to determine a second similarity discrimination matrix between the first content and the second content.

[0144] S5, performing weighted fusion according to the first similarity discriminant matrix and the second similarity discriminant matrix to determine the classification results of the first file and the second file.

[0145] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0146] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores the computer program product, and when the computer program is executed by a processor, the steps of the method in each embodiment of the present application are implemented.

[0147] Optionally, in this embodiment, the above computer program may be configured to implement the following steps when executed by a processor:

[0148] S1, obtaining information of a first file and information of a second file, wherein the information of the first file includes a first entry and a first content, and the information of the second file includes a second entry and a second content.

[0149] S2, representing the first entry and the second entry as a first entry feature matrix and a second entry feature matrix respectively, and representing the first content and the second content as a first content feature matrix and a second content feature matrix respectively.

[0150] S3, using a preset neural network model to perform feature fusion on the first item feature matrix and the second item feature matrix, and determining a first similarity discrimination matrix between the first item and the second item.

[0151] S4, using a preset neural network model to perform feature fusion on the first content feature matrix and the second content feature matrix to determine a second similarity discrimination matrix between the first content and the second content.

[0152] S5, performing weighted fusion according to the first similarity discriminant matrix and the second similarity discriminant matrix to determine the classification results of the first file and the second file.

[0153] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0154] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0155] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A file classification method, characterized in that: The method comprises: Acquire information of a first file and information of a second file, wherein the information of the first file includes a first item and a first content, and the information of the second file includes a second item and a second content; Representing the first item and the second item as a first item feature matrix and a second item feature matrix, respectively, and representing the first content and the second content as a first content feature matrix and a second content feature matrix, respectively; Using a preset neural network model to perform feature fusion on the first entry feature matrix and the second entry feature matrix to determine a first similarity discriminant matrix between the first entry and the second entry; Using a preset neural network model to perform feature fusion on the first content feature matrix and the second content feature matrix, and determine a second similarity discriminant matrix between the first content and the second content; The first similarity discriminant matrix and the second similarity discriminant matrix are weightedly fused to determine classification results of the first file and the second file.

2. The method according to claim 1, characterized in that: The characterizing the first item and the second item as a first item feature matrix and a second item feature matrix, respectively, and the characterizing the first content and the second content as a first content feature matrix and a second content feature matrix, respectively, includes: Performing vectorized representation processing on the first entry and the second entry using an embedding layer to obtain a first entry feature matrix and a second entry feature matrix; A pre-trained large language model is used to perform deep semantic representation processing on the first content and the second content to obtain a first content feature matrix and a second content feature matrix.

3. The method according to claim 1, characterized in that: The step of fusing the first item feature matrix and the second item feature matrix using a preset neural network model to determine a first similarity discriminant matrix between the first item and the second item includes: Processing the first item feature matrix and the second item feature matrix through a fully connected layer respectively to convert them into a first item feature vector and a second item feature vector; Performing a dot product operation on the first item feature vector and the second item feature vector to determine a first similarity feature vector between the first item feature vector and the second item feature vector; Concatenate the first entry feature vector and the second entry feature vector to obtain an entry information feature vector; The first similarity discriminant matrix is ​​determined according to the first similarity feature vector and the entry information feature vector.

4. The method according to claim 3, characterized in that The performing a dot product operation on the first item feature vector and the second item feature vector to determine a first similarity feature vector between the first item feature vector and the second item feature vector includes: Performing a dot product operation on the first item feature vector and the second item feature vector to obtain a first similarity vector; Concatenate the maximum elements in the first entry feature vector and the second entry feature vector to obtain a maximum entry element vector; determining a cosine similarity between the first entry feature vector and the second entry feature vector according to the first similarity vector and the maximum entry element vector, so as to normalize the similarity; An activation function is used to convert the cosine similarity into the first similarity feature vector.

5. The method according to claim 1, characterized in that The step of fusing the first content feature matrix and the second content feature matrix using a preset neural network model to determine a second similarity discrimination matrix between the first content and the second content includes: Using a multi-head self-attention mechanism to mine and learn the first content feature matrix and the second content feature matrix respectively, to obtain a first content feature vector and a second content feature vector; concatenating the first content feature vector and the second content feature vector to obtain a comprehensive content feature vector; Processing the first content feature matrix and the second content feature matrix through a fully connected layer respectively to convert them into a first content feature vector and a second content feature vector; Performing a dot product operation on the first content feature vector and the second content feature vector to determine a second similarity feature vector between the first content feature vector and the second content feature vector; The second similarity discriminant matrix is ​​determined according to the second similarity feature vector and the comprehensive content feature vector.

6. The method according to claim 5, characterized in that The performing a dot product operation on the first content feature vector and the second content feature vector to determine a second similarity feature vector between the first content feature vector and the second content feature vector includes: Performing a dot product operation on the first content feature vector and the second content feature vector to obtain a first similarity vector; concatenating the maximum elements in the first content feature vector and the second content feature vector to obtain a maximum content element vector; determining, according to the first similarity vector and the maximum content element vector, a cosine similarity between the first content feature vector and the second content feature vector to normalize the similarity; The cosine similarity is transformed by using an activation function, and then fused with the first content feature matrix and the second content feature matrix to obtain the second similarity feature vector.

7. A file classification device, characterized in that: The device comprises: An information acquisition module, used to acquire information of a first file and information of a second file, wherein the information of the first file includes a first item and a first content, and the information of the second file includes a second item and a second content; An information characterization module, configured to characterize the first item and the second item as a first item feature matrix and a second item feature matrix, respectively, and characterize the first content and the second content as a first content feature matrix and a second content feature matrix, respectively; A first fusion module, used to perform feature fusion on the first entry feature matrix and the second entry feature matrix using a preset neural network model to determine a first similarity discriminant matrix between the first entry and the second entry; A second fusion module, configured to perform feature fusion on the first content feature matrix and the second content feature matrix using a preset neural network model to determine a second similarity discrimination matrix between the first content and the second content; A classification module is used to perform weighted fusion according to the first similarity discrimination matrix and the second similarity discrimination matrix to determine the classification results of the first file and the second file.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 6 when executed.

9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 through the computer program.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.