Text vector representation method and device, electronic equipment and storage medium

By using sliding windows and mixed pooling operations in text vector representation, the problem of insufficient data retrieval accuracy and adaptability in the prior art is solved, and a higher quality text vector representation and data retrieval effect is achieved.

CN119849441AActive Publication Date: 2025-04-18DIGITAL HEALTH CHINA TECHNOLOGIES CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510045420.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-04-18
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

In the prior art, data retrieval methods based on keyword matching or cosine similarity calculations have insufficient accuracy and adaptability, and cannot accurately capture user intentions, resulting in low accuracy of search results.

Method used

By obtaining the text to be represented and determining its feature map, the feature map is divided into multiple window feature maps using sliding window technology, and each window feature map is mixed and pooled to obtain target features, thereby improving the quality of text vector representation.

Benefits of technology

Through the hybrid pooling operation, the characteristics of each window feature capture and information retention can be accurately expressed, improving the quality of vector representation of the text to be represented, and thus improving the accuracy and adaptability of data retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849441A_ABST
    Figure CN119849441A_ABST
Patent Text Reader

Abstract

The invention relates to a text vector representation method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a to-be-represented text, and determining a feature map corresponding to the to-be-represented text; determining a plurality of corresponding window feature maps when a preset sliding window slides on the feature map; and for each window feature map, carrying out hybrid pooling operation on the window feature map to obtain a target feature corresponding to the window feature map until target features corresponding to all the window feature maps are obtained. According to the method provided by the invention, the capability of capturing local features can be integrated and the advantages of keeping information integrity can be realized through the mixed pooling operation, so that the features of each window feature map can be accurately expressed through the target features, and the quality of vector representation of the to-be-expressed text can be further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a text vector representation method, device, electronic device and storage medium. Background Art

[0002] Retrieval Augmented Generation is a technology applied in the field of knowledge content retrieval. It combines vector databases and large language models, and aims to enhance the generation capabilities of large models through retrieval technology. The process of building a vector database is: document preparation -> document segmentation -> slice vectorization -> storage. The process in the application stage is: user questions -> data retrieval -> injection of prompt words -> large model generates answers. In this technology, the large model will add prompt words to answer based on the content after data retrieval, so the speed and effect of data retrieval are closely related to the answer results of the large model.

[0003] Data retrieval in the prior art is mainly divided into a two-step strategy of recall + re-ranking. For recall, it is currently mainly based on keyword matching or simple vector similarity calculation.

[0004] Traditional recall methods based on keyword matching use simple keyword matching to achieve data retrieval. Although simple and easy to use, they are not very accurate and have poor adaptability. They cannot accurately capture user intent, resulting in low accuracy of retrieval results. As for recall methods based on vector similarity, the existing methods in the art all calculate vector similarity based on cosine similarity. Although they improve the retrieval effect to a certain extent, they are limited by the quality of vector representation and the accuracy of similarity calculation, and the results are also not accurate enough. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a text vector representation method, device, electronic device and storage medium, aiming to solve at least one of the above technical problems.

[0006] In the first aspect, the technical solution of the present invention to solve the above technical problem is as follows: a text vector representation method, the method comprising:

[0007] Acquire the text to be represented, and determine the feature map corresponding to the text to be represented;

[0008] Determine a plurality of window feature maps corresponding to a preset sliding window when sliding on the feature map;

[0009] For each of the window feature maps, a mixed pooling operation is performed on the window feature map to obtain the target feature corresponding to the window feature map, until the target features corresponding to all the window feature maps are obtained.

[0010] The beneficial effect of the present invention is that the hybrid pooling operation in this scheme can combine the ability of capturing local features and the advantages of retaining information integrity, so that the features of each window feature map can be accurately expressed through the target features, thereby improving the quality of the vector representation of the text to be represented.

[0011] Based on the above technical solution, the present invention can also be improved as follows.

[0012] Further, determining a feature map corresponding to the text to be represented includes:

[0013] Determine a plurality of text segments corresponding to the text to be represented;

[0014] For each of the text segments, determining a target vector corresponding to the text segment;

[0015] The target vectors corresponding to all text segments are converted into multi-dimensional feature maps as the feature maps corresponding to the text to be represented.

[0016] Further, for each of the text segments, determining a target vector corresponding to the text segment includes:

[0017] For each of the text segments, the text segment is converted into a vector of fixed length as a target vector corresponding to the text segment.

[0018] Further, for each of the window feature maps, performing a mixed pooling operation on the window feature map to obtain a target feature corresponding to the window feature map includes:

[0019] For each of the window feature graphs, a probability value corresponding to each element in the window feature graph is calculated, wherein the probability value corresponding to each element represents the possibility that the corresponding element is a target feature corresponding to the window feature graph, and each element represents a text feature in the window feature graph;

[0020] For each of the window feature maps, a target feature corresponding to the window feature map is determined based on probability values ​​corresponding to all elements corresponding to the window feature map.

[0021] Further, for each of the window feature graphs, determining the target feature corresponding to the window feature graph based on the probability values ​​corresponding to all elements corresponding to the window feature graph includes:

[0022] For each of the window feature graphs, determining a weight corresponding to each of the elements based on probability values ​​corresponding to all elements corresponding to the window feature graph;

[0023] For each of the window feature maps, the target feature corresponding to the window feature map is determined based on the probability values ​​corresponding to all elements corresponding to the window feature map and the weight corresponding to each element.

[0024] In a second aspect, in order to solve the above technical problem, the present invention further provides a text vector representation device, the device comprising:

[0025] An acquisition module, used to acquire the text to be represented and determine a feature map corresponding to the text to be represented;

[0026] A window feature map determining module, used to determine a plurality of window feature maps corresponding to a preset sliding window when sliding on the feature map;

[0027] The target feature determination module is used to perform a mixed pooling operation on each of the window feature maps to obtain the target feature corresponding to the window feature map, until the target features corresponding to all the window feature maps are obtained.

[0028] In a third aspect, in order to solve the above-mentioned technical problem, the present invention also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the text vector representation method of the present application is implemented.

[0029] In a fourth aspect, in order to solve the above-mentioned technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the text vector representation method of the present application is implemented.

[0030] Additional aspects and advantages of the present application will be partially given in the following description, which will become apparent from the following description, or will be understood through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for describing the embodiments of the present invention are briefly introduced below.

[0032] Figure 1 A flowchart of a text vector representation method provided by one embodiment of the present invention;

[0033] Figure 2 A schematic diagram of the structure of a text vector representation device provided by one embodiment of the present invention;

[0034] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The principles and features of the present invention are described below. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.

[0036] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0037] The solution provided by the embodiment of the present invention can be applied to any application scenario where vector representation of the text to be represented is required. The solution provided by the embodiment of the present invention can be executed by any electronic device, for example, it can be a user's terminal device, including at least one of the following: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart TV, and a smart car device.

[0038] The embodiment of the present invention provides a possible implementation method, such as Figure 1 As shown, a flowchart of a text vector representation method is provided. The solution can be executed by any electronic device, for example, a terminal device, or a terminal device and a server. For the convenience of description, the method provided by the embodiment of the present invention will be described below by taking the terminal device as the execution subject as an example. Figure 1 The method may include the following steps:

[0039] S10, obtaining a text to be represented, and determining a feature map corresponding to the text to be represented;

[0040] S20, determining a plurality of window feature maps corresponding to a preset sliding window sliding on the feature map;

[0041] S30, for each of the window feature maps, perform a mixed pooling operation on the window feature map to obtain a target feature corresponding to the window feature map, until the target features corresponding to all the window feature maps are obtained.

[0042] Through the method of the present invention, the ability to capture local features and the advantages of retaining information integrity can be combined through a hybrid pooling operation, so that the features of each window feature map can be accurately expressed through target features, thereby improving the quality of the vector representation of the text to be represented.

[0043] The solution of the present invention is further described below in conjunction with the following specific embodiments. In this embodiment, a text vector representation method provided may include the following steps:

[0044] S10, obtaining a text to be represented, and determining a feature map corresponding to the text to be represented;

[0045] Among them, the feature map is used to represent the text features of the text to be represented.

[0046] Optionally, in the above S10, determining the feature map corresponding to the text to be represented includes:

[0047] S101, determining a plurality of text segments corresponding to the text to be represented;

[0048] The text to be represented may be divided into multiple text segments.

[0049] S102, for each of the text segments, determining a target vector corresponding to the text segment;

[0050] Among them, for a text segment, the target vector corresponding to the text segment represents the text segment in a vector manner.

[0051] Optionally, a possible implementation manner of the above S102 is:

[0052] For each of the text segments, the text segment is converted into a vector of fixed length as a target vector corresponding to the text segment.

[0053] Specifically, for each of the text segments, the text segment can be converted into a vector of fixed length through a pre-trained language model.

[0054] S103, converting the target vectors corresponding to all text segments into a multi-dimensional feature map as the feature map corresponding to the text to be represented.

[0055] An implementation scheme of the above S103 is:

[0056] The target vectors corresponding to all text fragments are converted into multi-dimensional feature maps through t-SNE dimensionality reduction technology.

[0057] Among them, the multi-dimensional feature map can be represented by a two-dimensional matrix. This transformation not only helps to reduce the computational complexity, but also enhances the correlation expression between different dimensions, making subsequent feature extraction more effective.

[0058] As an example, a 1024-dimensional vector can be transformed into a 32x32 two-dimensional matrix through t-SNE dimensionality reduction technology.

[0059] S20, determining a plurality of window feature maps corresponding to a preset sliding window sliding on the feature map;

[0060] The size of the sliding window can be preset, for example, 3*3. During the sliding process, the sliding window corresponds to a small area on the covered feature map, and the size of the area is the same as the size of the sliding window.

[0061] The moving step length of the sliding window on the feature map can be preset and can be determined based on the window feature map corresponding to the current sliding during the moving process. After the moving step length is determined, the sliding window can be moved according to the determined sliding step length to obtain multiple window feature maps.

[0062] Optionally, if the moving step length is determined during the moving process, the moving step length corresponding to each movement may be the same or different. In the present application solution, it can be determined based on the following method:

[0063] After the sliding window moves on the feature map for the first time with a preset first moving step length, when the first window feature map is obtained, the probability value corresponding to each element in the first window feature map is calculated, and for each of the elements, the probability value corresponding to the element represents the possibility that the corresponding element is the target feature corresponding to the first window feature map, and each of the elements represents a text feature in the window feature map; if there is an element with a probability value greater than the set probability value in the first window feature map, the first moving step length is determined as the moving step length corresponding to the next movement, and if there is no element with a probability value greater than the set probability value in the first window feature map, the first moving step length is increased, and the increased moving step length is used. The step length is used as the moving step length corresponding to the next movement, and the above process of adjusting the first moving step length is repeated until there is an element greater than the set probability value in the window feature map obtained when the second movement is performed based on the increased moving step length, and the moving step length corresponding to this time is used as the moving step length of the second movement. Similarly, according to the above method of determining the moving step length of each movement, the moving step length corresponding to each movement is determined, that is, when moving for the second time, the moving step length determined in the above method is moved to obtain the second window feature map corresponding to the second movement. Similarly, the moving step length corresponding to the third movement is determined in the above method until the last movement, and multiple window feature maps are obtained.

[0064] Optionally, the probability value corresponding to each element in the first window feature map calculated above may be determined by a softmax function, which will be described in detail below.

[0065] S30, for each of the window feature maps, perform a mixed pooling operation on the window feature map to obtain a target feature corresponding to the window feature map, until the target features corresponding to all the window feature maps are obtained.

[0066] The above hybrid pooling operation refers to a combination of the maximum pooling operation and the soft pooling operation, which will be described in detail below.

[0067] Optionally, after obtaining the target features corresponding to all window feature maps, the target features corresponding to all window feature maps may be fused, and the fused features may be used as a vector representation of the text to be represented.

[0068] Optionally, in the above S30, for each of the window feature maps, performing a mixed pooling operation on the window feature map to obtain a target feature corresponding to the window feature map includes:

[0069] S301, for each of the window feature graphs, calculating a probability value corresponding to each element in the window feature graph, wherein the probability value corresponding to each element represents the possibility that the corresponding element is a target feature corresponding to the window feature graph, and each of the elements represents a text feature in the window feature graph;

[0070] The probability value of each element can be determined based on the following method:

[0071]

[0072] Among them, S(x i ) represents the i-th element x i The corresponding probability value is It represents the i-th element x i The corresponding exponential function value is, It represents the sum of the exponential function values ​​of all elements in a window feature map, j represents the total number of all elements in a window feature map, and i is less than j.

[0073] Optionally, in the present application scheme, in the process of determining the probability value corresponding to each element, the corresponding position of each element in the text to be represented can also be determined, so that after the target feature corresponding to each window feature map is determined, the position of the target feature in the text to be represented can be determined to find the text segment that can characterize the text feature of the text to be represented.

[0074] S302: For each of the window feature graphs, determine a target feature corresponding to the window feature graph based on probability values ​​corresponding to all elements corresponding to the window feature graph.

[0075] Optionally, a first implementation of S302 is as follows: for each of the window feature graphs, an element corresponding to a maximum probability value is determined as a target feature.

[0076] The second implementation of the above S302 is:

[0077] S3021, for each of the window feature graphs, determining a weight corresponding to each of the elements based on probability values ​​corresponding to all elements corresponding to the window feature graph;

[0078] S3022: For each of the window feature graphs, determine the target feature corresponding to the window feature graph based on the probability values ​​corresponding to all elements corresponding to the window feature graph and the weight corresponding to each element.

[0079] In this solution, for a window feature map, the target feature determined based on the first implementation method and the target feature determined based on the second implementation method can be fused, and the fused feature can be used as the target feature of the window feature map. The fusion method can be weighted fusion, so that both local representative features and features with a certain degree of influence can be taken into account.

[0080] Optionally, in the above S3022, based on the probability values ​​corresponding to all elements corresponding to the window feature graph and the weight corresponding to each of the elements, an implementation method of determining the target feature corresponding to the window feature graph is:

[0081] First, the element with the largest probability value among all elements corresponding to the window feature map is taken as the target element, and the set first weight value is determined as the weight of the target element. According to the probability value of each element, different weights are assigned to all elements except the target element in all elements corresponding to the window feature map, where the first weight value can be represented by α. Based on each element and the corresponding weight among all elements corresponding to the window feature map, the target feature corresponding to the window feature map is determined. This process can be called soft pooling. The process of determining the maximum probability value in this process is the maximum pooling operation.

[0082] Among them, α is a parameter between 0 and 1, which is used to control the weight ratio between the maximum value (maximum probability value) and the remaining values ​​(other probability values).

[0083] Specifically, in the solution of the present application, for each window feature map, the target feature of the window feature map can be determined based on the size of the first weight value α, specifically:

[0084] When α is close to 1, the text feature corresponding to the maximum value is extracted from the corresponding sliding window position as the representative of the area (window feature map). That is, for the window feature map, the element with the largest probability value among all elements corresponding to the window feature map is used as the target feature that mainly characterizes the window feature map. This helps to highlight the most important local features.

[0085] When α is close to 0, it is more inclined to consider the information of the entire window. By converting all elements into probability distribution, the elements corresponding to larger probability values ​​obtain higher weights, while the elements corresponding to smaller probability values ​​also retain a certain degree of influence, that is, the elements corresponding to smaller probability values ​​are assigned smaller weights. This method can more comprehensively represent the importance of local features and avoid information loss.

[0086] Therefore, based on the adjustment of the first weight value, the target features corresponding to each window feature map can be more accurately represented.

[0087] Specifically, one implementation of the above S3022 is:

[0088] S-LMP=α·x max +(1-α)·∑1s(x i )·x i

[0089] Among them, S-LMP represents the target feature corresponding to a window feature map, x max It represents the element with the largest probability value among all elements corresponding to a window feature map, ∑1s(x i )·x i It represents the sum of the products of all elements except the target element in a window feature map and the corresponding probability values, S(x i ) represents the i-th element x i The corresponding probability value, x i represents the i-th element, 1 represents the number of elements other than the target element in all elements corresponding to a window feature map, and 1 is less than j.

[0090] Optionally, in the present application, the text to be represented may be segmented by the following method to obtain multiple text segments:

[0091] The first method is to segment the text to be represented into paragraphs according to the paragraphs. For any paragraph obtained after segmentation, the paragraph is segmented into sentences according to the period or semicolon. The sentence length of the segmented sentences is determined in real time. Based on the sentence length and the pre-set segmentation rules, each sentence is further segmented to obtain multiple text fragments.

[0092] Among them, for each sentence, based on the sentence length of the sentence and the pre-set segmentation rules, the specific implementation process of segmenting the sentence to obtain multiple text segments is as follows:

[0093] For each sentence, if the sentence length of the sentence is greater than the set length, the corresponding sentence is divided into a first number of first text segments, the length of each first text segment is the first length, the total length of each first text segment is less than the sentence length, and the text segments in the sentence except all the first text segments are used as second text segments. The sentence length of the second text segment is usually not greater than the first length. In this case, the second text segment can be directly used as a new first text segment, or the second text segment can be spliced ​​with the next adjacent sentence of the sentence to obtain a third text segment of the first length. The third text segment is used as a new first text segment, and all the first text segments (including the new first text segment) are used as multiple text segments corresponding to the sentence.

[0094] For the next adjacent statement of the sentence, if a part of the adjacent statement has been occupied by the third text segment of the sentence, the part of the adjacent statement other than the part can be taken as a new statement and segmented in the above manner.

[0095] The second method is to segment the text to be represented according to paragraphs, determine a fixed segmentation length, and segment any paragraph according to the fixed segmentation length to obtain at least two segments. It should be further explained that in the process of segmentation according to the fixed segmentation length, if there are commas or semicolons in the segments obtained during the segmentation process, it is necessary to re-segment, that is, segment according to the commas or semicolons, and after segmentation, start segmenting again according to the fixed segmentation length starting from the first text content after the comma or semicolon. For each result obtained by segmentation, slice processing is performed according to the slicing method in the first method to obtain the text segment corresponding to each sentence.

[0096] Through the solution of the present invention, by extracting features through hybrid pooling, not only the computational complexity can be reduced, but also the ability to capture local features and the advantages of retaining information integrity can be comprehensively combined by combining local maximum pooling and soft pooling, so as to better extract the core features of the vector, thereby improving the quality of the vector representation, and the subsequent processes can be better carried out based on this.

[0097] Based on Figure 1 Based on the same principle as the method shown in , the embodiment of the present invention also provides a text vector representation device 20, such as Figure 2 As shown in , the text vector representation device 20 may include an acquisition module 210, a window feature map determination module 220 and a target feature determination module 230, wherein:

[0098] The acquisition module 210 is used to acquire the text to be represented and determine the feature map corresponding to the text to be represented;

[0099] A window feature map determining module 220, used to determine a plurality of window feature maps corresponding to a preset sliding window when sliding on the feature map;

[0100] The target feature determination module 230 is used to perform a mixed pooling operation on each of the window feature maps to obtain the target feature corresponding to the window feature map, until the target features corresponding to all the window feature maps are obtained.

[0101] Optionally, when determining the feature graph corresponding to the text to be represented, the acquisition module 210 is specifically configured to:

[0102] Determine a plurality of text segments corresponding to the text to be represented;

[0103] For each of the text segments, determining a target vector corresponding to the text segment;

[0104] The target vectors corresponding to all text segments are converted into multi-dimensional feature maps as the feature maps corresponding to the text to be represented.

[0105] Optionally, for each of the text segments, when determining the target vector corresponding to the text segment, the acquisition module 210 is specifically configured to:

[0106] For each of the text segments, the text segment is converted into a vector of fixed length as a target vector corresponding to the text segment.

[0107] Optionally, for each of the window feature maps, when the target feature determination module 230 performs a mixed pooling operation on the window feature map to obtain a target feature corresponding to the window feature map, it is specifically used to:

[0108] For each of the window feature graphs, a probability value corresponding to each element in the window feature graph is calculated, wherein the probability value corresponding to each element represents the possibility that the corresponding element is a target feature corresponding to the window feature graph, and each element represents a text feature in the window feature graph;

[0109] For each of the window feature maps, a target feature corresponding to the window feature map is determined based on probability values ​​corresponding to all elements corresponding to the window feature map.

[0110] Optionally, for each of the window feature graphs, when the target feature determination module 230 determines the target feature corresponding to the window feature graph based on the probability values ​​corresponding to all elements corresponding to the window feature graph, it is specifically configured to:

[0111] For each of the window feature graphs, determining a weight corresponding to each of the elements based on probability values ​​corresponding to all elements corresponding to the window feature graph;

[0112] For each of the window feature maps, the target feature corresponding to the window feature map is determined based on the probability values ​​corresponding to all elements corresponding to the window feature map and the weight corresponding to each element.

[0113] The text vector representation device of the embodiment of the present invention can execute the text vector representation method provided by the embodiment of the present invention, and the implementation principle is similar. The actions performed by each module and unit in the text vector representation device in each embodiment of the present invention correspond to the steps in the text vector representation method in each embodiment of the present invention. For the detailed functional description of each module of the text vector representation device, please refer to the description in the corresponding text vector representation method shown in the previous text, which will not be repeated here.

[0114] Among them, the above-mentioned text vector representation device can be a computer program (including program code) running in a computer device, for example, the text vector representation device is an application software; the device can be used to execute the corresponding steps in the method provided in an embodiment of the present invention.

[0115] In some embodiments, the text vector representation device provided by the embodiment of the present invention can be implemented in a combination of software and hardware. As an example, the text vector representation device provided by the embodiment of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the text vector representation method provided by the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0116] In other embodiments, the text vector representation device provided by the embodiment of the present invention can be implemented in software. Figure 2 A text vector representation device stored in a memory is shown, which may be software in the form of a program and a plug-in, and includes a series of modules, including an acquisition module 210, a window feature map determination module 220, and a target feature determination module 230, for implementing the text vector representation method provided in an embodiment of the present invention.

[0117] The modules involved in the embodiments of the present invention may be implemented by software or hardware, wherein the name of a module does not limit the module itself in some cases.

[0118] Based on the same principle as the method shown in the embodiments of the present invention, an electronic device is also provided in the embodiments of the present invention, which may include but is not limited to: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the method shown in any embodiment of the present invention by calling the computer program.

[0119] In an alternative embodiment, an electronic device is provided, such as Figure 3 As shown, Figure 3 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.

[0120] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0121] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0122] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0123] The memory 4003 is used to store the application code (computer program) for executing the solution of the present invention, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the content shown in the above method embodiment.

[0124] The electronic device may also be a terminal device. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0125] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding contents of the aforementioned method embodiment.

[0126] According to another aspect of the present invention, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the implementation modes of the above-mentioned various embodiments.

[0127] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0128] It should be understood that the flow charts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, the program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0129] The computer-readable storage medium provided by the embodiment of the present invention may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.

[0130] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0131] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the disclosure scope involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) by each other.

Claims

1. A text vector representation method, characterized in that: The following steps are involved: Acquire the text to be represented, and determine the feature map corresponding to the text to be represented; Determine a plurality of window feature maps corresponding to a preset sliding window when sliding on the feature map; For each of the window feature maps, a mixed pooling operation is performed on the window feature map to obtain the target feature corresponding to the window feature map, until the target features corresponding to all the window feature maps are obtained.

2. The method according to claim 1, characterized in that Determining a feature map corresponding to the text to be represented includes: Determine a plurality of text segments corresponding to the text to be represented; For each of the text segments, determining a target vector corresponding to the text segment; The target vectors corresponding to all text segments are converted into multi-dimensional feature maps as the feature maps corresponding to the text to be represented.

3. The method according to claim 2, characterized in that For each of the text segments, determining a target vector corresponding to the text segment includes: For each of the text segments, the text segment is converted into a vector of fixed length as a target vector corresponding to the text segment.

4. The method according to any one of claims 1 to 3, characterized in that For each of the window feature maps, performing a mixed pooling operation on the window feature map to obtain a target feature corresponding to the window feature map includes: For each of the window feature graphs, a probability value corresponding to each element in the window feature graph is calculated, wherein the probability value corresponding to each element represents the possibility that the corresponding element is a target feature corresponding to the window feature graph, and each element represents a text feature in the window feature graph; For each of the window feature maps, a target feature corresponding to the window feature map is determined based on probability values ​​corresponding to all elements corresponding to the window feature map.

5. The method according to claim 4, characterized in that For each of the window feature graphs, determining the target feature corresponding to the window feature graph based on the probability values ​​corresponding to all elements corresponding to the window feature graph includes: For each of the window feature graphs, determining a weight corresponding to each of the elements based on probability values ​​corresponding to all elements corresponding to the window feature graph; For each of the window feature maps, the target feature corresponding to the window feature map is determined based on the probability values ​​corresponding to all elements corresponding to the window feature map and the weight corresponding to each element.

6. A text vector representation device, characterized in that: include: An acquisition module, used to acquire the text to be represented and determine a feature map corresponding to the text to be represented; A window feature map determining module, used to determine a plurality of window feature maps corresponding to a preset sliding window when sliding on the feature map; The target feature determination module is used to perform a mixed pooling operation on each of the window feature maps to obtain the target feature corresponding to the window feature map, until the target features corresponding to all the window feature maps are obtained.

7. The device according to claim 6, characterized in that When determining the feature map corresponding to the text to be represented, the acquisition module is specifically used to: Determine a plurality of text segments corresponding to the text to be represented; For each of the text segments, determining a target vector corresponding to the text segment; The target vectors corresponding to all text segments are converted into multi-dimensional feature maps as the feature maps corresponding to the text to be represented.

8. The device according to claim 7, characterized in that For each of the text segments, when determining the target vector corresponding to the text segment, the acquisition module is specifically used to: For each of the text segments, the text segment is converted into a vector of fixed length as a target vector corresponding to the text segment.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 5 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Polyphone pronunciation prediction method, device and equipment and storage medium

    CN112528648A

  • Graph neural network text sentiment classification method based on double sliding windows

    CN113220884A

  • Movie comment sentiment classification method and device based on graph neural network

    CN114528374A

  • Image processing-based crack detection method and storage medium

    CN116645592A

  • Automated model management methods

    US10209974B1