Text retrieval method and device, electronic equipment and computer readable storage medium

By generating augmented vectors and dense single vectors, the text recall model is optimized, solving the problem of low text recall efficiency and achieving efficient text recall.

CN116501838BActive Publication Date: 2025-11-04PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310470703.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-25
Publication Date
2025-11-04
Estimated Expiration
2043-04-25

AI Technical Summary

Technical Problem

Existing text retrieval methods present a trade-off between efficiency and robustness. Single-vector representations require a large amount of training resources and have poor robustness, while multi-vector representations increase storage costs, resulting in low text retrieval efficiency.

Method used

By generating single and multiple text vectors, using linear transformation matrices to generate dimension-enhanced vectors, and performing dot product operations to obtain target single vectors, the text recall model is optimized by combining dense single vectors and text similarity, and the model parameters are optimized using stochastic gradient descent algorithm.

Benefits of technology

It improves the efficiency of text recall, reduces the training resource requirements, enhances the robustness of single vector representation, alleviates the storage cost burden, and improves the convergence speed of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116501838B_ABST
    Figure CN116501838B_ABST
Patent Text Reader

Abstract

The present application relates to artificial intelligence technology, and discloses a text recall method, comprising: generating a text single vector and a text multi vector of a standard text in a training text set according to a preset text recall model; generating an augmented dimension vector of the text multi vector according to a linear transformation matrix, and obtaining a target single vector of the augmented dimension vector; performing vector splicing on the text single vector and the target single vector to obtain a dense single vector of the standard text; calculating a text similarity between the standard text and a target text according to the dense single vector, optimizing parameters of the preset text recall model according to the text similarity, and performing text recall on a text to be queried according to the optimized text recall model. In addition, the present application also relates to blockchain technology, and data lists can be stored in nodes of a blockchain. The present application also proposes a text recall device, an electronic device and a storage medium. The present application can improve the efficiency of text recall.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a text recall method and device, electronic equipment and a computer readable storage medium. BACKGROUND

[0002] The Internet has developed at an amazing rate and has now entered the era of big data. During this period, various fields have accumulated vast amounts of data and information in various forms, including images, texts, sounds, etc. In real life, a large amount of information exists in the form of text. Compared with the explosive growth rate of information, the speed of human information acquisition has not increased much. In the face of such a large amount of text information, how to establish an effective management and organization method to realize the structuring of text and facilitate people to comprehensively, quickly and accurately obtain the required information is a great challenge currently faced.

[0003] At present, there are mainly two ideas for text recall methods. One is to represent the text object to be operated by a single vector, and the other is to represent the text object to be operated by multiple vectors. The former completely compresses the information contained in the object into a vector non-explicitly through the model, and needs to use a large amount of training resources and a clever training strategy to ensure performance in the training stage. When migrated to other fields with greater differences, the performance will decrease significantly, and the robustness is poor. The latter uses multiple vectors to represent it. Compared with a single vector, although it reduces the demand for training resources to some extent, enhances the robustness and improves the performance of the model, it also greatly increases the storage cost burden and brings great challenges to online deployment. Therefore, how to improve the recall efficiency of text has become a problem to be solved. SUMMARY

[0004] The present application provides a text recall method, device and computer readable storage medium, which mainly aims to solve the problem of low efficiency in text recall.

[0005] To achieve the above purpose, the present application provides a text recall method, which comprises:

[0006] Obtaining a training text set, selecting one of the training texts in the training text set as a standard text, and generating a text single vector and a text multi-vector of the standard text according to a preset text recall model;

[0007] Generating an augmented vector of the text multi-vector according to a linear transformation matrix, and performing a dot product operation on the augmented vector to obtain a target single vector of the augmented vector;

[0008] Performing vector splicing on the text single vector and the target single vector to obtain a dense single vector of the standard text;

[0009] According to the dense single vector, a text similarity between the standard text and other training texts in the training text set except the standard text is calculated, and a preset text recall model is parameter optimized according to the text similarity, so as to obtain an optimized text recall model;

[0010] The optimized text recall model is used for text recall of a to-be-queried text.

[0011] Optionally, the generation process of the text multi-vector includes:

[0012] The standard text is subjected to word segmentation processing, so as to obtain a text word segmentation of the standard text.

[0013] The text word segmentation is subjected to label processing, so as to obtain a label word segmentation of the text word segmentation.

[0014] The label word segmentation is subjected to vector splicing with a unique character, so as to obtain a standard word segmentation of the label word segmentation.

[0015] A text multi-vector of the standard word segmentation is generated according to a preset text recall model.

[0016] Optionally, the generation of the dimension-increased vector of the text multi-vector according to the linear transformation matrix includes:

[0017] A linear transformation matrix of the text multi-vector is obtained, and the text multi-vector is converted into a primary category probability by using the linear transformation matrix.

[0018] A matrix bias term of the linear transformation matrix is obtained, and the primary category probability is corrected according to the matrix bias term, so as to obtain a category probability of the text multi-vector.

[0019] The dimension-increased vector of the text multi-vector is generated according to the category probability.

[0020] Optionally, the dot product operation of the dimension-increased vector to obtain a target single vector of the dimension-increased vector includes:

[0021] A weight matrix of the dimension-increased vector is generated according to the dimension-increased vector.

[0022] The weight matrix and the dimension-increased vector are subjected to dot product operation, so as to obtain a weighted dimension-increased vector of the dimension-increased vector.

[0023] The target single vector of the weighted dimension-increased vector is generated by using a grouping dimension reduction idea.

[0024] Optionally, the generation of the target single vector of the weighted dimension-increased vector by using the grouping dimension reduction idea includes:

[0025] The weighted augmented dimension vectors are grouped to obtain a weighted vector group of the weighted augmented dimension vectors;

[0026] The weighted vector group is sequentially subjected to convolution processing to obtain a convolution vector group of the weighted vector group.

[0027] The convolution vector group is sequentially subjected to a maximum value pooling operation to obtain a pooling vector of the convolution vector group, and a target single vector of the weighted augmented dimension vector is generated according to the pooling vector.

[0028] Optionally, the vector splicing of the text single vector and the target single vector to obtain the dense single vector of the standard text comprises:

[0029] The target vector dimension of each target single vector in the target single vector is counted to generate a text vector dimension of the text single vector, and the maximum value of the target vector dimension and the text vector dimension is determined as a standard dimension.

[0030] The vector dimension of each target single vector in the target single vector and the text single vector is lengthened to the standard dimension by using a preset parameter.

[0031] Each target single vector in the target single vector and the text single vector after lengthening are spliced as row vectors according to a preset vector order to obtain the dense single vector of the standard text.

[0032] Optionally, the parameter optimization of the preset text recall model according to the text similarity comprises:

[0033] The target function and the convergence threshold of the preset text recall model are determined according to the initial parameters of the preset text recall model.

[0034] The target function value of the target function is generated according to the text similarity, and the size of the target function value and the convergence threshold is compared.

[0035] When the target function value is less than or equal to the convergence threshold, the parameter optimization of the preset text recall model is ended to obtain the optimized text recall model.

[0036] When the target function value is greater than the convergence threshold, the parameter optimization of the preset text recall model is performed according to the stochastic gradient descent algorithm and the target function value until the optimized text recall model is obtained.

[0037] To solve the above problems, the application further provides a text recall device, which comprises:

[0038] The vector generation module is configured to obtain a training text set, select one of the training texts in the training text set as a standard text, and generate a text single vector and a text multi-vector of the standard text according to a preset text recall model.

[0039] The vector dot multiplication module is configured to generate an augmented vector of the text multi-vector according to a linear transformation matrix, and perform dot multiplication on the augmented vector to obtain a target single vector of the augmented vector.

[0040] The vector splicing module is configured to perform vector splicing on the text single vector and the target single vector to obtain a dense single vector of the standard text.

[0041] The parameter optimization module is configured to calculate a text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector, and perform parameter optimization on the preset text recall model according to the text similarity to obtain an optimized text recall model.

[0042] The text recall module is configured to perform text recall on a to-be-queried text by using the optimized text recall model.

[0043] To solve the above problems, the present application further provides an electronic device, which comprises:

[0044] at least one processor; and

[0045] a memory connected in communication with the at least one processor; wherein

[0046] the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the text recall method described above.

[0047] To solve the above problems, the present application further provides a computer readable storage medium, which stores at least one computer program, and the at least one computer program is executed by a processor in an electronic device to implement the text recall method described above.

[0048] The embodiment of the present application generates a text single vector and a text multi vector of a standard text in a training text set according to a preset text recall model, uses a predetermined training text set to train the preset text recall model, can prevent the preset text recall model from generalization or overfitting, performs dot multiplication on the generated augmented vector to obtain a target single vector of the augmented vector, realizes dimension reduction processing of the augmented vector, avoids dimension disaster of the augmented vector in subsequent processing, performs vector splicing on the text single vector and the target single vector to obtain a dense single vector of the standard text, reduces the demand for training resources through aggregation of the text single vector and the target single vector, enhances the vector semantics of the text single vector, improves the robustness of single vector representation, greatly relieves the cost burden of storage while ensuring performance, calculates the text similarity of the standard text and a target text, optimizes the parameters of the preset text recall model according to the text similarity, obtains an optimized text recall model, and uses a stochastic gradient descent algorithm in the optimization process to speed up the convergence speed of the preset text recall model and improve the text recall efficiency. Therefore, the text recall method, device, electronic equipment and computer readable storage medium provided by the present application can solve the problem of low text recall efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0049] Figure 1 A flowchart of a text recall method provided by an embodiment of the present application is shown in the figure.

[0050] Figure 2 A flowchart of generating an augmented vector provided by an embodiment of the present application is shown in the figure.

[0051] Figure 3 A flowchart of generating a target single vector provided by an embodiment of the present application is shown in the figure.

[0052] Figure 4 A functional module diagram of a text recall device provided by an embodiment of the present application is shown in the figure.

[0053] Figure 5 A structural diagram of an electronic equipment for implementing the text recall method provided by an embodiment of the present application is shown in the figure.

[0054] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0055] It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0056] The text retrieval method provided in the embodiments of the present application can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be a stand-alone server, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.

[0057] Referring to Figure 1 FIG. 1 is a flowchart of a text retrieval method provided in an embodiment of the present application.

[0058] In the embodiment, the text retrieval method includes:

[0059] S1, obtaining a training text set, selecting one of the training texts in the training text set as a standard text, and generating a text single vector and a text multi-vector of the standard text according to a preset text retrieval model.

[0060] In the embodiment of the present application, text retrieval is to retrieve some documents related to the standard text from a training text set, and the training text set is determined in advance. Training the preset text retrieval model with the training text set can prevent the preset text retrieval model from generalization or overfitting.

[0061] In the embodiment of the present application, the generation process of the text multi-vector includes: performing word segmentation on the standard text to obtain text word segmentation of the standard text; performing label processing on the text word segmentation to obtain labeled word segmentation of the text word segmentation; vector splicing the labeled word segmentation and a unique character to obtain standard word segmentation of the labeled word segmentation; and generating a text multi-vector of the standard word segmentation according to a preset text retrieval model.

[0062] In detail, the standard text can be processed by a pre-trained artificial intelligence model with word segmentation function to obtain text word segmentation of the standard text, wherein the artificial intelligence model includes but is not limited to an NLP (Natural Language Processing) model and an HMM (Hidden Markov Model).

[0063] Further, the word segmentation tool for performing word segmentation processing on the standard text includes Harbin Institute of Technology LTP, Chinese Academy of Sciences NLPIR, Tsinghua University THULAC, and jieba, etc., and the Chinese word segmentation is a process of cutting a Chinese character sequence into individual words and recombining a continuous character sequence into a word sequence according to certain specifications, and common word segmentation methods are divided into three categories: a word segmentation method based on string matching, a word segmentation method based on understanding, and a word segmentation method based on statistics.

[0064] In detail, the label processing on the text word segmentation is to confirm the position of the text word segmentation in the standard text, so as to prevent the preset text recall model from forgetting information.

[0065] In detail, the unique character can be a CLS symbol, the CLS symbol is spliced at the beginning of a sentence in the standard text, a marked word segmentation of the text word segmentation is obtained, a sentence with the CLS symbol is input into a Bert module in a preset text recall model, and a text multi-vector of the standard word segmentation is obtained.

[0066] In detail, the text single-vector of the standard text can be obtained by using a transformer module in the preset text recall model, the unique character needs to be spliced to obtain a marked text of the standard text, and the marked text is input into the transformer module.

[0067] S2, generate a dimension-increased vector of the text multi-vector according to a linear transformation matrix, and perform a dot product operation on the dimension-increased vector to obtain a target single-vector of the dimension-increased vector.

[0068] In the embodiment of the application, the dimension-increased vector of the text multi-vector is generated to learn more information through a high-dimensional vector.

[0069] In the embodiment of the application, the dimension-increased vector of the text multi-vector is generated to learn more information through a high-dimensional vector. Figure 2 As shown in the figure, the dimension-increased vector of the text multi-vector is generated according to a linear transformation matrix, including:

[0070] S21, obtaining a linear transformation matrix of the text multi-vector, and converting the text multi-vector into a primary class probability by using the linear transformation matrix;

[0071] S22, obtaining a matrix bias term of the linear transformation matrix, correcting the primary class probability according to the matrix bias term, and obtaining a class probability of the text multi-vector;

[0072] S23, generating a dimension-increased vector of the text multi-vector according to the class probability.

[0073] In detail, the linear transformation matrix can transform the text multi-vector into the primary category probability of the target word, the dimension of the text multi-vector is T*1, the dimension of the linear transformation matrix is (TP+1)*T, and the dimension of the matrix bias term is T*1, wherein the intercept term in the linear equation of the matrix bias term is consistent in meaning, and the linearity of the matrix bias term exists to better fit the data.

[0074] In detail, the category probability of the text multi-vector can be calculated by using the following category probability algorithm:

[0075]

[0076] wherein, represents the category probability of the i th text multi-vector after linear transformation by the linear transformation matrix, OS Z represents the linear transformation matrix connecting the text multi-vector and the category probability, is the i th text multi-vector, bS Z is the OS Z corresponding bias term, and N represents the total number of the text multi-vectors.

[0077] In the embodiment of the application, the dot product operation on the augmented dimension vector to obtain the target single vector of the augmented dimension vector comprises: generating a weight matrix of the augmented dimension vector according to the augmented dimension vector; performing dot product operation on the weight matrix and the augmented dimension vector to obtain a weighted augmented dimension vector of the augmented dimension vector; and generating the target single vector of the weighted augmented dimension vector by using the grouping dimension reduction idea.

[0078] In detail, the weight matrix of the augmented dimension vector is determined according to the dimension of the augmented dimension vector and the element size in the augmented dimension vector.

[0079] In detail, the dot product operation refers to calculating the Hadamard product of the weight matrix and the augmented dimension vector, that is, the matrix dimension of the preset weight matrix is consistent with the matrix dimension of the augmented dimension vector, and the weighted augmented dimension vector of the augmented dimension vector is obtained by multiplying the elements.

[0080] For example, when the weight matrix is the augmented dimension vector is then the weighted augmented dimension vector of the augmented dimension vector is

[0081] In the embodiment of the application, the grouping dimension reduction idea is used to generate the target single vector of the weighted augmented dimension vector, as shown in the following table: Figure 3

[0082] ​S31, group processing is performed on the weighted augmented dimension vector to obtain a weighted vector group of the plurality of weighted augmented dimension vectors;

[0083] S32, convolution processing is sequentially performed on the weighted vector group to obtain a convolution vector group of the weighted vector group.

[0084] S33, maximum pooling operation is sequentially performed on the convolution vector group to obtain a pooling vector of the convolution vector group, and a target single vector of the weighted augmented dimension vector is generated according to the pooling vector.

[0085] For example, when the dimension of the weighted augmented dimension vector is [21128, 1], the dimension of the weighted augmented dimension vector is [768, 1] by dimension reduction processing on the weighted augmented dimension vector.

[0086] In detail, the dimension of the weighted augmented dimension vector is evenly divided into d weighted vector groups as much as possible, and the dimension of each weighted vector group is V / d, and the maximum value of the elements in the weighted vector group is taken as the representative of the weighted vector group.

[0087] In detail, the dimension of the weighted augmented dimension vector is reduced to avoid dimension disaster of the augmented dimension vector, and the convolution idea and the pooling idea are used for dimension reduction of the weighted augmented dimension vector, wherein the pooling operation mainly includes average pooling and maximum pooling, and in the embodiment of the application, the maximum pooling is used, and methods such as multidimensional scaling (MDS), isometric feature mapping (ISOMAP) and principal component analysis (PCA) can also be used.

[0088] Further, the multidimensional scaling requires that the distance of the weighted augmented dimension vector is maintained in the low-dimensional space, but in order to effectively reduce the dimension, it is often only necessary to make the distance after dimension reduction as close as possible to the distance of the weighted augmented dimension vector, and both the distance after dimension reduction and the distance of the weighted augmented dimension vector are obtained by the Euclidean distance formula.

[0089] S3, vector splicing is performed on the text single vector and the target single vector to obtain a dense single vector of the standard text.

[0090] In the embodiment of the present application, the vector splicing of the text single vector and the target single vector to obtain the dense single vector of the standard text comprises: counting the target vector dimension of each of the target single vectors, generating the text vector dimension of the text single vector, and determining the maximum value of the target vector dimension and the text vector dimension as a standard dimension; using a preset parameter to extend the vector dimension of each of the target single vectors and the text single vector to the standard dimension; and splicing each of the extended target single vectors and the text single vector as a row vector according to a preset vector order to obtain the dense single vector of the standard text.

[0091] For example, the target single vector comprises vector A: (1, 4, 6) and vector B: (2, 3), and the text single vector C: (3, 7, 8, 9). After counting, it is known that the target vector dimension of vector A is 3, the target vector dimension of vector B is 2, and the text vector dimension of vector C is 4. Then, 4 is determined as the standard dimension, and a preset parameter (such as x) is used to extend the dimension of vector A to 4 to obtain the extended vector A: (1, 4, 6, x), and the dimension of vector B is extended to 4 to obtain the extended vector B: (2, 3, x, x).

[0092] Further, each of the extended target single vectors and the text single vector can be spliced as a row vector into the following dense single vector:

[0093]

[0094] S4, calculating the text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector, and optimizing the preset text recall model according to the text similarity to obtain an optimized text recall model.

[0095] In the embodiment of the present application, the calculation of the text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector comprises:

[0096] Selecting each of the other training texts in the training text set except the standard text as a target text;

[0097] The text similarity between the standard text and the target text is calculated by using the following similarity algorithm:

[0098]

[0099] wherein x is a dense one-vector of the standard text, y is a vector center of the target text, T(x, y) represents a text similarity of the standard text and the target text, x k represents the kth data of the dense one-vector, y k represents the kth data of the vector center.

[0100] In the embodiment of the present application, the parameter optimization of the preset text recall model according to the text similarity includes: determining a target function and a convergence threshold of the preset text recall model according to initial parameters of the preset text recall model; generating a target function value of the target function according to the text similarity, and comparing the target function value with the convergence threshold; when the target function value is less than or equal to the convergence threshold, ending the parameter optimization of the preset text recall model to obtain an optimized text recall model; and when the target function value is greater than the convergence threshold, performing parameter optimization on the preset text recall model according to a stochastic gradient descent algorithm and the target function value until the optimized text recall model is obtained.

[0101] In detail, the target function can be expressed by the following function expression:

[0102]

[0103] wherein S is a function value of the target function, sim(q, p + ) is the positive text similarity between the relevant text, q is the standard text, p + represents the relevant text, is the negative text similarity between the irrelevant text, represents the jth irrelevant text, bs is the total number of texts in the training text set, and j is the identification of the irrelevant text.

[0104] In detail, the positive text similarity and the negative text similarity of the standard text are generated, and the positive text similarity and the negative text similarity are substituted into the target function to obtain a target function value of the standard text.

[0105] Further, the stochastic gradient descent algorithm randomly selects one data for calculation when calculating the direction of the fastest descent, instead of scanning all the training text set, thereby accelerating the iteration speed; for optimization problems and convex problems, although the target function obtained by each iteration is not in the global optimal direction, the overall direction is towards the global optimal solution, and compared with batch gradient, the stochastic gradient descent algorithm can achieve convergence faster.

[0106] S5, using the optimized text recall model to query the text.

[0107] In the embodiment of the application, the text to be queried is input into the optimized text recall model, and a series of processes are performed on the text to be queried by using the optimized text recall model, so that text recall can be realized.

[0108] In the embodiment of the application, the text univector and the text multivector of the standard text in the training text set are generated according to the preset text recall model, the preset text recall model is trained by using the predetermined training text set, the phenomenon of generalization or overfitting of the preset text recall model can be prevented, the dot multiplication operation is performed on the generated augmented vector to obtain a target univector of the augmented vector, the dimension reduction processing of the augmented vector is realized, the dimension disaster of the augmented vector in subsequent processing is avoided, the dense univector of the standard text is obtained by performing vector splicing on the text univector and the target univector, the demand for training resources is reduced through the aggregation of the text univector and the target univector, the vector semantics of the text univector is enhanced, the robustness of the univector representation is improved, the cost burden of storage is greatly relieved while the performance is guaranteed, the text similarity between the standard text and the target text is calculated, the parameters of the preset text recall model are optimized according to the text similarity, and an optimized text recall model is obtained. In the optimization process, the random gradient descent algorithm is adopted to accelerate the convergence speed of the preset text recall model, and the text recall efficiency is improved. Therefore, the text recall method is proposed, and the problem of low text recall efficiency can be solved.

[0109] As shown in Figure 4 Figure 1 is a functional module diagram of a text recall device provided by an embodiment of the application.

[0110] The text recall device 100 can be installed in an electronic device. According to the functions to be implemented, the text recall device 100 can include a vector generation module 101, a vector dot multiplication module 102, a vector splicing module 103, a parameter optimization module 104, and a text recall module 105. The modules of the application can also be referred to as units, which refer to a series of computer program segments that can be executed by an electronic device processor and can complete a fixed function, and are stored in the memory of the electronic device.

[0111] In this embodiment, the functions of each module / unit are as follows:

[0112] The vector generation module 101 is configured to obtain a training text set, select one of the training texts in the training text set as a standard text, and generate a text univector and a text multivector of the standard text according to a preset text recall model.

[0113] The vector point multiplication module 102 is configured to generate a dimension-increased vector of the text multi-vector according to the linear transformation matrix, perform a point multiplication operation on the dimension-increased vector, and obtain a target single vector of the dimension-increased vector.

[0114] The vector splicing module 103 is configured to perform vector splicing on the text single vector and the target single vector, and obtain a dense single vector of the standard text.

[0115] The parameter optimization module 104 is configured to calculate a text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector, perform parameter optimization on the preset text recall model according to the text similarity, and obtain an optimized text recall model.

[0116] The text recall module 105 is configured to perform text recall on a text to be queried by using the optimized text recall model.

[0117] As shown in Figure 5 FIG. 1 is a structural schematic diagram of an electronic device for implementing a text recall method according to an embodiment of the present application.

[0118] The electronic device can include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and can further include a computer program (such as a text recall program) stored in the memory 11 and executable on the processor 10.

[0119] In some embodiments, the processor 10 can be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same function or different functions, including one or more combinations of central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control core of the electronic device, which connects all components of the electronic device through various interfaces and lines, executes or runs programs or modules stored in the memory 11 (such as a text recall program), and calls data stored in the memory 11 to perform various functions of the electronic device and process data.

[0120] The memory 11 includes at least one type of readable storage medium, such as a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 can also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 11 can include both an internal storage unit and an external storage device of the electronic device. The memory 11 can be used to store application software installed in the electronic device and various data, such as the code of a text recall program, etc., and can also be used to temporarily store data that has been output or will be output.

[0121] The communication bus 12 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable connection and communication between the memory 11 and at least one processor 10, etc.

[0122] The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface can include a wired interface and / or a wireless interface (e.g., a WI-FI interface, a Bluetooth interface, etc.), and is typically used to establish a communication connection between the electronic device and other electronic devices. The user interface can be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface can also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display can be an LED display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, etc. The display can also be appropriately referred to as a display screen or a display unit, and is used to display information processed in the electronic device and to display a visualized user interface.

[0123] It should be understood that the electronic device shown in the figure is only for illustration, and the structure shown in the figure does not limit the electronic device. The electronic device can include fewer or more components than those shown in the figure, or combine some components, or arrange different components.

[0124] For example, although not shown, the electronic device can also include a power supply (such as a battery) for powering various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charge management, discharge management, and power consumption management. The power supply can also include one or more direct current or alternating current power supplies, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components. The electronic device can also include various sensors, Bluetooth modules, Wi-Fi modules, and the like, which are not described here.

[0125] It should be understood that the embodiments are only for illustration, and the scope of the patent application is not limited by the structure.

[0126] The text recall program stored in the memory 11 of the electronic device is a combination of multiple instructions, which, when executed in the processor 10, can achieve:

[0127] Obtain a training text set, select one of the training texts in the training text set as a standard text, and generate a text single vector and a text multi-vector of the standard text according to a preset text recall model;

[0128] Generate a dimension-increasing vector of the text multi-vector according to a linear transformation matrix, and perform a dot product operation on the dimension-increasing vector to obtain a target single vector of the dimension-increasing vector;

[0129] Concatenate the text single vector and the target single vector to obtain a dense single vector of the standard text;

[0130] Calculate the text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector, and optimize the parameters of the preset text recall model according to the text similarity to obtain an optimized text recall model;

[0131] Use the optimized text recall model to perform text recall on a text to be queried.

[0132] Specifically, the specific implementation method of the processor 10 on the above instructions can refer to the description of the related steps in the corresponding embodiments of the accompanying drawings, which will not be described here.

[0133] Further, the modules / units integrated in the electronic device, if realized in the form of software function units and sold or used as independent products, can be stored in a computer readable storage medium. The computer readable storage medium can be volatile or non-volatile. For example, the computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM).

[0134] The application further provides a computer readable storage medium, which stores a computer program, and the computer program can realize the following when executed by a processor of an electronic device:

[0135] obtaining a training text set, selecting one of the training texts in the training text set as a standard text, and generating a text single vector and a text multi vector of the standard text according to a preset text recall model;

[0136] generating an augmented dimension vector of the text multi vector according to a linear transformation matrix, and performing a dot product operation on the augmented dimension vector to obtain a target single vector of the augmented dimension vector;

[0137] performing vector splicing on the text single vector and the target single vector to obtain a dense single vector of the standard text;

[0138] calculating a text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector, and performing parameter optimization on the preset text recall model according to the text similarity to obtain an optimized text recall model;

[0139] performing text recall on a text to be queried by using the optimized text recall model.

[0140] In several embodiments provided in the application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other manners. For example, the above described apparatus embodiments are merely illustrative, and the division of the modules can be different from the above. For example, the division of the modules can be merely a logical function division, and there can be another division manner in actual implementation.

[0141] The modules illustrated as separated components can or can not be physically separated, and the components illustrated as modules can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. According to actual needs, some or all of the modules can be selected to achieve the purpose of the embodiments.

[0142] In addition, each of the functional modules in the various embodiments of the present application can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a hardware plus software function module.

[0143] It is obvious for those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application.

[0144] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, and the scope of the present application is defined by the appended claims rather than the above description, and therefore all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application. Any additional reference signs in the claims should not be considered as limiting the claims involved.

[0145] The blockchain referred to in the present application is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. Blockchain, in essence, is a decentralized database, which is a series of data blocks associated using cryptographic methods, each data block containing information of a batch of network transactions, for verifying the validity of the information (anti-fake) and generating the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer, etc.

[0146] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Among them, artificial intelligence (Artificial Intelligence, AI) is to use digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Theory, method, technology and application system.

[0147] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The plurality of units or devices stated in the system claims can also be realized by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, not any particular order.

[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solutions of the present application can be modified or replaced equivalently without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A text recall method characterized by, The method comprises: acquiring a training text set, selecting one of the training texts in the training text set as a standard text, and generating a text single vector and a text multi vector of the standard text according to a preset text recall model; generating a dimension-increased vector of the text multi vector according to a linear transformation matrix, and performing a dot product operation on the dimension-increased vector to obtain a target single vector of the dimension-increased vector; performing vector splicing on the text single vector and the target single vector to obtain a dense single vector of the standard text; calculating a text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector, and performing parameter optimization on the preset text recall model according to the text similarity to obtain an optimized text recall model; performing text recall on a text to be queried by using the optimized text recall model.

2. The text recall method of claim 1, wherein, The generation process of the text multi vector comprises: performing word segmentation on the standard text to obtain text segmented words of the standard text; performing label processing on the text segmented words to obtain labeled segmented words of the text segmented words; performing vector splicing on the labeled segmented words and unique characters to obtain standard segmented words of the labeled segmented words; generating a text multi vector of the standard segmented words according to a preset text recall model.

3. The text recall method of claim 1, wherein, The generation of the dimension-increased vector of the text multi vector according to the linear transformation matrix comprises: acquiring a linear transformation matrix of the text multi vector, and converting the text multi vector into a primary category probability by using the linear transformation matrix; acquiring a matrix bias term of the linear transformation matrix, correcting the primary category probability according to the matrix bias term to obtain a category probability of the text multi vector; generating a dimension-increased vector of the text multi vector according to the category probability.

4. The text recall method of claim 1, wherein, The dot product operation on the dimension-increased vector to obtain the target single vector of the dimension-increased vector comprises: generating a weight matrix of the dimension-increased vector according to the dimension-increased vector; performing a dot product operation on the weight matrix and the dimension-increased vector to obtain a weighted dimension-increased vector of the dimension-increased vector; generating a target single vector of the weighted dimension-increased vector by using a grouping dimension reduction idea.

5. The text recall method of claim 4, wherein, The generation of the target single vector of the weighted dimension-increased vector by using the grouping dimension reduction idea comprises: grouping the weighted dimension-increased vector to obtain a weighted vector group of the weighted dimension-increased vector; sequentially performing convolution processing on the weighted vector group to obtain a convolution vector group of the weighted vector group; sequentially performing a maximum value pooling operation on the convolution vector group to obtain a pooling vector of the convolution vector group, and generating a target single vector of the weighted dimension-increased vector according to the pooling vector.

6. The text recall method of claim 1, wherein, The vector splicing on the text single vector and the target single vector to obtain the dense single vector of the standard text comprises: statistically determining a target vector dimension of each target single vector in the target single vector, generating a text vector dimension of the text single vector, and determining a maximum value in the target vector dimension and the text vector dimension as a standard dimension; lengthening the vector dimension of each target single vector in the target single vector and the text single vector to the standard dimension by using a preset parameter; The extended target single vector and the text single vector are spliced as row vectors according to a preset vector sequence, and a dense single vector of the standard text is obtained.

7. The text recall method of any one of claims 1 to 6, wherein, The parameter optimization of the preset text recall model according to the text similarity includes: determining a target function and a convergence threshold of the preset text recall model according to initial parameters of the preset text recall model; generating a target function value of the target function according to the text similarity, and comparing the target function value with the convergence threshold; when the target function value is less than or equal to the convergence threshold, ending the parameter optimization of the preset text recall model, and obtaining an optimized text recall model; when the target function value is greater than the convergence threshold, performing the parameter optimization of the preset text recall model according to a stochastic gradient descent algorithm and the target function value until the optimized text recall model is obtained.

8. A text recall apparatus characterized by comprising: The device includes: a vector generation module configured to obtain a training text set, select one of the training texts in the training text set as a standard text, and generate a text single vector and a text multi-vector of the standard text according to a preset text recall model; a vector dot multiplication module configured to generate an augmented vector of the text multi-vector according to a linear transformation matrix, and perform a dot multiplication operation on the augmented vector to obtain a target single vector of the augmented vector; a vector splicing module configured to perform vector splicing on the text single vector and the target single vector to obtain a dense single vector of the standard text; a parameter optimization module configured to calculate a text similarity between the standard text and other training texts in the training text set except the standard text according to the dense single vector, and perform the parameter optimization of the preset text recall model according to the text similarity to obtain an optimized text recall model; a text recall module configured to perform text recall on a text to be queried by using the optimized text recall model.

9. An electronic device, comprising: The electronic device includes: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the text recall method in any one of claims 1 to 7.

10. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the text recall method in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Text vector processing method and device, medium and electronic equipment

    CN114676701A

  • Multi-path recall model training method, multi-path recall method, multi-path recall device and electronic equipment

    CN115374362A