Text matching method, device, terminal and storage medium
By filtering and feature extraction of short texts and generating target texts with text matching models, the problem of insufficient matching accuracy in the prior art is solved, and higher matching accuracy is achieved.
Patent Information
- Application Number
- CN202210094425.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-26
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-01-26
AI Technical Summary
The existing short text similarity algorithms are insufficient in distinguishing texts with very similar but different meanings, making it difficult to effectively improve the accuracy of text matching.
By obtaining the short text to be matched for filtering, the vector features are extracted using the feature extraction model, and inputting it to the text matching model for matching, to generate the target text and display the target text, thereby improving matching accuracy.
Through the combination of feature extraction and text matching models, the accuracy of short text matching is significantly improved, and it can more effectively distinguish similar texts with different meanings.
Smart Images

Figure CN114490999B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text processing technology, and in particular to a text matching method, device, terminal and storage medium. Background Art
[0002] Short text similarity is to find the similarity between two short texts. It is a special form of text matching task or text implication task, which returns the specific numerical value of the similarity between texts. In the industry, short text similarity calculation plays an important role. For example, in conversational robots, the length of text is basically short text. At present, short text similarity algorithms can be divided into three categories: (1) unsupervised similarity calculation; (2) supervised similarity calculation; (3) supervised + unsupervised similarity calculation.
[0003] When we used the above method to test the similarity of fine-grained short texts, we found that if two sentences are very similar but have different meanings, the current algorithm is not very effective in distinguishing them, and the accuracy of text matching needs to be improved urgently. Summary of the invention
[0004] The embodiments of the present application provide a text matching method, device, terminal and storage medium, which can improve the accuracy of short text matching.
[0005] A first aspect of an embodiment of the present application provides a text matching method, the method comprising:
[0006] Get the short text to be matched;
[0007] Filtering the short text to be matched to obtain a filtered short text to be matched;
[0008] Performing feature extraction on the filtered short text to be matched according to a feature extraction model to obtain vector features;
[0009] Inputting the vector feature into a text matching model for matching, so as to obtain a target text corresponding to the short text to be matched;
[0010] The target text is displayed.
[0011] A second aspect of an embodiment of the present application provides a text matching device, the device comprising:
[0012] An acquisition unit, used for acquiring a short text to be matched;
[0013] A filtering unit, used for filtering the short text to be matched to obtain a filtered short text to be matched;
[0014] An extraction unit, used for performing feature extraction on the filtered short text to be matched according to a feature extraction model to obtain vector features;
[0015] A matching unit, used for inputting the vector feature into a text matching model for matching, so as to obtain a target text corresponding to the short text to be matched;
[0016] A display unit is used to display the target text.
[0017] A third aspect of an embodiment of the present application provides a terminal, comprising a processor, an input device, an output device and a memory, wherein the processor, input device, output device and memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the step instructions in the first aspect of the embodiment of the present application.
[0018] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in the first aspect of the embodiments of the present application.
[0019] A fifth aspect of the embodiments of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
[0020] Implementing the embodiments of the present application has at least the following beneficial effects:
[0021] Obtain a short text to be matched, filter the short text to be matched to obtain a filtered short text to be matched, perform feature extraction on the filtered short text to be matched according to a feature extraction model to obtain a vector feature, input the vector feature into a text matching model for matching to obtain a target text corresponding to the short text to be matched, and display the target text. Therefore, the vector feature extracted according to the feature extraction model can be matched in the text matching model based on the vector feature to obtain the target text, thereby improving the accuracy of text matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 A flowchart of a text matching method is provided for an embodiment of the present application;
[0024] Figure 2 A flowchart of another text matching method is provided for an embodiment of the present application;
[0025] Figure 3 A schematic diagram of the structure of a terminal provided in an embodiment of the present application;
[0026] Figure 4 A structural schematic diagram of a text matching device is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0028] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0029] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0030] In order to better understand a method provided by an embodiment of the present application, a brief introduction to the application is first given below.
[0031] See also Figure 1 , Figure 1 A flowchart of a text matching method is provided for an embodiment of the present application. Figure 1 Therefore, the method comprises:
[0032] 101. Obtain the short text to be matched.
[0033] The short text with matching is the short text that needs to be matched, and the corresponding text is obtained by matching. The short text may include short sentences, phrases, etc.
[0034] The short text to be matched may be obtained through user input, or may be obtained from the Internet, a server, an electronic device, and the like.
[0035] 102. Filter the short text to be matched to obtain a filtered short text to be matched.
[0036] The method for filtering the matching short text may include: removing interjections, removing punctuation marks, etc. from the matching short text.
[0037] 103. Perform feature extraction on the filtered short text to be matched according to a feature extraction model to obtain vector features.
[0038] The feature extraction model may be a TextCNN model, through which a feature vector of the text may be extracted.
[0039] 104. Input the vector feature into a text matching model for matching, so as to obtain a target text corresponding to the short text to be matched.
[0040] The text matching model may be an Ernie model, which is used to match text. The feature extraction model and the text matching model are obtained by unified training during training, and the two models may be spliced to obtain a new model, and the text matching is performed directly through the new model.
[0041] 105. Display the target text.
[0042] The target text may be displayed on a display screen or the like, and of course the target text may also be sent to an electronic device and displayed on the electronic device.
[0043] In this example, by obtaining a short text to be matched, the short text to be matched is filtered to obtain a filtered short text to be matched, and feature extraction is performed on the filtered short text to be matched according to a feature extraction model to obtain a vector feature, and the vector feature is input into a text matching model for matching to obtain a target text corresponding to the short text to be matched, and the target text is displayed. Therefore, the vector feature extracted according to the feature extraction model can be matched in the text matching model based on the vector feature to obtain the target text, thereby improving the accuracy of text matching.
[0044] In a possible implementation, the feature extraction model includes an embedding layer, a convolutional pooling layer, and a fully connected layer. A possible method for extracting features from the filtered short text to be matched according to the feature extraction model to obtain vector features includes:
[0045] A1, inputting the filtered short text to be matched into the embedding layer of the feature extraction model for operation to obtain a first operation result;
[0046] A2. Inputting the first operation result into the convolutional pooling layer of the feature extraction model for operation to obtain a second operation result;
[0047] A3. Input the second operation result into the fully connected layer of the feature extraction model for operation to obtain a third operation result, and determine the third operation result as the vector feature.
[0048] Among them, the first operation result and the second operation result are both intermediate quantities for feature extraction by the feature extraction model. The intermediate quantities can be directly input into the next layer for calculation, or can be stored and then input into the next layer for calculation, etc.
[0049] In a possible implementation, since untrained text may appear, the accuracy of the matched text may be uncertain. Therefore, before displaying the target text, the matched target text may be adjusted. The adjustment method specifically includes:
[0050] B1, obtaining the target similarity between the short text to be matched and the target text;
[0051] B2. If the target similarity is lower than a first preset similarity threshold, segmenting the short text to be matched and the target text to obtain a first word set of the short text to be matched and a second word set of the target text;
[0052] B3, obtaining similarities between corresponding words in the first word set and the second word set to obtain a similarity set;
[0053] B4, obtaining words in the first word set whose similarities are higher than a second preset similarity threshold in the similarity set, and corresponding to the words, to obtain reference words, wherein the second preset similarity threshold is higher than the first preset similarity threshold;
[0054] B5. Acquire a short text including the reference word to obtain at least one reference short text;
[0055] B6. Determine a short text corresponding to the short text to be matched based on the at least one reference short text and the second word set;
[0056] B7. Determine the short text corresponding to the short text to be matched as the target text.
[0057] The target similarity can be obtained through a text matching model, or through other similarity matching methods. The first preset similarity threshold is set through experience or historical data.
[0058] When the matching short text and the target text are segmented, the first word set and the second word set may be obtained by using the maximum word segmentation method, etc. The first word set and the second word set include multiple words.
[0059] The corresponding words in the first word set and the second word set can be understood as words in the short text to be matched and words in the target text at the same position are corresponding words. The second similarity threshold is set by experience value or historical data.
[0060] A short text including a reference word may be acquired from a database to obtain at least one reference short text, and the reference short text may be used to approximately understand a text similar to the target text.
[0061] The short text corresponding to the short text to be matched can be determined according to the semantics of the reference short text, thereby improving the accuracy of determining the short text corresponding to the short text to be matched.
[0062] By obtaining words in the first word set whose similarity is higher than the second preset similarity threshold, the words in the short text to be matched that match the target text can be obtained. Thus, the short text corresponding to the short text to be matched can be obtained based on the short text including the above words, which can improve the accuracy.
[0063] In a possible implementation, a possible method for determining a short text corresponding to the short text to be matched based on the at least one reference short text includes:
[0064] C1. Acquire semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text;
[0065] C2. Obtaining target semantic information of the short text to be matched;
[0066] C3. Determine, from the at least one reference short text, a short text corresponding to the short text to be matched according to the target semantic information and the reference semantic information corresponding to the at least one reference short text.
[0067] The semantic information of the reference short text can be obtained through a general semantic recognition algorithm, thereby obtaining the reference semantic information, and the target semantic information of the short text to be matched can also be obtained.
[0068] The similarity between the target semantic information and the reference semantic information is obtained, and the reference short text corresponding to the reference semantic information having the highest similarity with the target semantic information is determined as the short text corresponding to the short text to be matched.
[0069] In this example, reference semantic information is obtained by acquiring semantic information of a reference short text, and a short text corresponding to the short text to be matched is determined based on the reference semantic information and the target semantic information. Thus, the short text corresponding to the short text to be matched can be determined from a semantic perspective, thereby improving the accuracy of determining the short text corresponding to the short text to be matched.
[0070] In a possible implementation, another possible method for determining a short text corresponding to the short text to be matched based on the at least one reference short text includes:
[0071] D1. Acquire semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text;
[0072] D2. performing fusion processing on the reference semantic information corresponding to the at least one reference short text to obtain target semantic information;
[0073] D3, adjusting the target text according to the target semantic information to obtain an adjusted target text;
[0074] D4. Determine the adjusted target text as the short text corresponding to the short text to be matched.
[0075] The method for obtaining the reference semantic information may refer to the method in step C1 in the aforementioned embodiment, which will not be described in detail here.
[0076] The method for fusing the reference semantic information may be: obtaining different information in the reference semantic information, semantically fusing the different information, and thus obtaining the fused target semantic information. For example: if the first reference semantic information and the second reference semantic information have different first sub-semantic information and second sub-semantic information, and the first sub-semantic information corresponds to the second sub-semantic information, then the sub-semantic information is semantically fused. The specific fusion may be: obtaining the intermediate information between the first sub-semantic information and the second sub-semantic information, and determining the intermediate information as the fused information. The intermediate information may be understood as the semantically biased information between the first sub-semantic information and the second sub-semantic information. For example, if the first sub-semantic information is "extremely large" and the second sub-semantic information is "very large", then the intermediate semantics may be "very large". This is only an explanation of the distance and is not specifically limited.
[0077] The corresponding part of the target text may be adjusted according to the target semantic information, thereby obtaining an adjusted target text, and the semantic information of the adjusted target text is the target semantic information.
[0078] In this example, the reference semantic information is fused to obtain the target semantic information, and the target text is adjusted according to the target semantic information. The adjusted target text is determined as the short text corresponding to the short text to be matched, thereby improving the accuracy of determining the short text corresponding to the short text to be matched.
[0079] In a possible implementation, the embodiment of the present application may also verify the target text, as follows:
[0080] E1. removing interjections from the short text to be matched to obtain a first processed text;
[0081] E2. performing semantic structure analysis on the first processed text to obtain the semantic structure of the first processed text;
[0082] E3. Verifying the target text according to the semantic structure to obtain a verification result;
[0083] E4. Display the verification results.
[0084] The method for removing interjections from the short text to be matched may be: identifying interjections in the short text to be matched, and then deleting the interjections to obtain a first processed text.
[0085] The method for identifying interjections may adopt a general text recognition method, or other methods may be used.
[0086] The method for performing semantic structure analysis on the first processed text may be: obtaining semantic structure key information of the first processed text, and obtaining the semantic structure according to the semantic structure key information. For example, if the first processed text is: I want to buy XX mobile phone, then its semantic structure key information is: I, buy, mobile phone, and according to the semantic structure key information, the semantic structure can be determined to be: I buy a mobile phone.
[0087] For example, “I want to buy an AA mobile phone”, the key information of its semantic structure is: I + buy + mobile phone, then its semantic structure is I + buy + noun, which is a sentence with a very obvious shopping intention.
[0088] The method for verifying the target text according to the semantic structure may be: obtaining the semantic structure of the target text, and verifying according to the similarity between the semantic structure and the semantic structure of the target text. If the similarity is higher than a fixed threshold, the verification result is successful, and if it is lower than the fixed threshold, the verification result is failed. The fixed threshold is set by experience value or historical data.
[0089] In this example, the short text to be matched is processed to remove interjections to obtain a first processed text, a semantic structure analysis is performed on the first processed text to obtain the semantic structure of the first processed text, the target text is verified according to the semantic structure to obtain a verification result, and the verification result is displayed, so that the target text can be verified to improve accuracy.
[0090] See also Figure 2 , Figure 2 A flowchart of another text matching method is provided for the embodiment of the present application. Figure 2 Therefore, the method comprises:
[0091] 201. Obtain the short text to be matched;
[0092] 202. Filter the short text to be matched to obtain a filtered short text to be matched;
[0093] 203. Perform feature extraction on the filtered short text to be matched according to a feature extraction model to obtain vector features;
[0094] 204. Inputting the vector feature into a text matching model for matching to obtain a target text corresponding to the short text to be matched;
[0095] 205. Obtaining a target similarity between the short text to be matched and the target text;
[0096] 206. If the target similarity is lower than a first preset similarity threshold, performing word segmentation processing on the short text to be matched and the target text to obtain a first word set of the short text to be matched and a second word set of the target text;
[0097] 207. Obtain similarities between corresponding words in the first word set and the second word set to obtain a similarity set;
[0098] 208. Acquire words in the first word set whose similarities are higher than a second preset similarity threshold in the similarity set, and obtain reference words, wherein the second preset similarity threshold is higher than the first preset similarity threshold;
[0099] 209. Acquire a short text including the reference word to obtain at least one reference short text;
[0100] 210. Determine a short text corresponding to the short text to be matched based on the at least one reference short text and the second word set;
[0101] 211. Determine the short text corresponding to the short text to be matched as the target text;
[0102] 212. Display the target text.
[0103] In this example, by obtaining words in the first word set whose similarity is higher than the second preset similarity threshold, the words in the short text to be matched that match the target text can be obtained. Thus, the short text corresponding to the short text to be matched can be obtained based on the short text including the above words, which can improve the accuracy.
[0104] For the above embodiments, please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a terminal provided in an embodiment of the present application, as shown in the figure, includes a processor, an input device, an output device and a memory, the processor, the input device, the output device and the memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, the processor is configured to call the program instructions, and the program includes instructions for executing the following steps;
[0105] Get the short text to be matched;
[0106] Filtering the short text to be matched to obtain a filtered short text to be matched;
[0107] Performing feature extraction on the filtered short text to be matched according to a feature extraction model to obtain vector features;
[0108] Inputting the vector feature into a text matching model for matching, so as to obtain a target text corresponding to the short text to be matched;
[0109] The target text is displayed.
[0110] In a possible implementation, extracting features from the filtered short text to be matched according to a feature extraction model to obtain vector features includes:
[0111] Inputting the filtered short text to be matched into the embedding layer of the feature extraction model for operation to obtain a first operation result;
[0112] Inputting the first operation result into the convolutional pooling layer of the feature extraction model for operation to obtain a second operation result;
[0113] The second operation result is input into the fully connected layer of the feature extraction model for operation to obtain a third operation result, and the third operation result is determined as the vector feature.
[0114] In a possible implementation, before displaying the target text, the method further includes:
[0115] Obtaining a target similarity between the short text to be matched and the target text;
[0116] If the target similarity is lower than a first preset similarity threshold, segmenting the short text to be matched and the target text to obtain a first word set of the short text to be matched and a second word set of the target text;
[0117] Obtaining similarities between corresponding words in the first word set and the second word set to obtain a similarity set;
[0118] Acquire words in the first word set whose similarities are higher than a second preset similarity threshold in the similarity set, and obtain reference words, wherein the second preset similarity threshold is higher than the first preset similarity threshold;
[0119] Acquire a short text including the reference word to obtain at least one reference short text;
[0120] Determining a short text corresponding to the short text to be matched according to the at least one reference short text and the second word set;
[0121] A short text corresponding to the short text to be matched is determined as a target text.
[0122] In a possible implementation, determining, based on the at least one reference short text, a short text corresponding to the short text to be matched includes:
[0123] Acquiring semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text;
[0124] Obtaining target semantic information of the short text to be matched;
[0125] According to the target semantic information and the reference semantic information corresponding to the at least one reference short text, a short text corresponding to the short text to be matched is determined from the at least one reference short text.
[0126] In a possible implementation, determining, based on the at least one reference short text, a short text corresponding to the short text to be matched includes:
[0127] Acquiring semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text;
[0128] Performing fusion processing on the reference semantic information corresponding to the at least one reference short text to obtain target semantic information;
[0129] Adjusting the target text according to the target semantic information to obtain an adjusted target text;
[0130] The adjusted target text is determined as a short text corresponding to the short text to be matched.
[0131] In a possible implementation, the method further includes:
[0132] The short text to be matched is processed to remove interjections to obtain a first processed text;
[0133] Performing semantic structure analysis on the first processed text to obtain a semantic structure of the first processed text;
[0134] Verifying the target text according to the semantic structure to obtain a verification result;
[0135] The verification result is displayed.
[0136] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that in order to realize the above functions, the terminal includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments provided in this document, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0137] The embodiment of the present application can divide the terminal into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0138] In line with the above, see Figure 4 , Figure 4 A structural diagram of a text matching device is provided for an embodiment of the present application. Figure 4 As shown, the device comprises:
[0139] An acquisition unit 401 is used to acquire a short text to be matched;
[0140] A filtering unit 402 is used to filter the short text to be matched to obtain a filtered short text to be matched;
[0141] An extraction unit 403 is used to extract features from the filtered short text to be matched according to a feature extraction model to obtain vector features;
[0142] A matching unit 404 is used to input the vector feature into a text matching model for matching, so as to obtain a target text corresponding to the short text to be matched;
[0143] The display unit 405 is used to display the target text.
[0144] In a possible implementation, the extracting unit 403 is used to:
[0145] Inputting the filtered short text to be matched into the embedding layer of the feature extraction model for operation to obtain a first operation result;
[0146] Inputting the first operation result into the convolutional pooling layer of the feature extraction model for operation to obtain a second operation result;
[0147] The second operation result is input into the fully connected layer of the feature extraction model for operation to obtain a third operation result, and the third operation result is determined as the vector feature.
[0148] In a possible implementation, before displaying the target text, the device is further configured to:
[0149] Obtaining a target similarity between the short text to be matched and the target text;
[0150] If the target similarity is lower than a first preset similarity threshold, segmenting the short text to be matched and the target text to obtain a first word set of the short text to be matched and a second word set of the target text;
[0151] Obtaining similarities between corresponding words in the first word set and the second word set to obtain a similarity set;
[0152] Acquire words in the first word set whose similarities are higher than a second preset similarity threshold in the similarity set, and obtain reference words, wherein the second preset similarity threshold is higher than the first preset similarity threshold;
[0153] Acquire a short text including the reference word to obtain at least one reference short text;
[0154] Determining a short text corresponding to the short text to be matched according to the at least one reference short text and the second word set;
[0155] A short text corresponding to the short text to be matched is determined as a target text.
[0156] In a possible implementation, in determining the short text corresponding to the short text to be matched based on the at least one reference short text, the device is used to:
[0157] Acquiring semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text;
[0158] Obtaining target semantic information of the short text to be matched;
[0159] According to the target semantic information and the reference semantic information corresponding to the at least one reference short text, a short text corresponding to the short text to be matched is determined from the at least one reference short text.
[0160] In a possible implementation, in determining the short text corresponding to the short text to be matched based on the at least one reference short text, the device is used to:
[0161] Acquiring semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text;
[0162] Performing fusion processing on the reference semantic information corresponding to the at least one reference short text to obtain target semantic information;
[0163] Adjusting the target text according to the target semantic information to obtain an adjusted target text;
[0164] The adjusted target text is determined as a short text corresponding to the short text to be matched.
[0165] In a possible implementation, the device is further used for:
[0166] The short text to be matched is processed to remove interjections to obtain a first processed text;
[0167] Performing semantic structure analysis on the first processed text to obtain a semantic structure of the first processed text;
[0168] Verifying the target text according to the semantic structure to obtain a verification result;
[0169] The verification result is displayed.
[0170] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any text matching method recorded in the above method embodiments.
[0171] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program enables a computer to execute part or all of the steps of any text matching method recorded in the above method embodiments.
[0172] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0173] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0174] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be electrical or other forms.
[0175] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0176] In addition, the functional units in the various embodiments of the application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of software program modules.
[0177] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.
[0178] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which can include: a flash drive, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.
[0179] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A text matching method, characterized in that: The method comprises: Get the short text to be matched; Filtering the short text to be matched to obtain a filtered short text to be matched; Performing feature extraction on the filtered short text to be matched according to a feature extraction model to obtain vector features; Inputting the vector feature into a text matching model for matching, so as to obtain a target text corresponding to the short text to be matched; displaying the target text; Before displaying the target text, the method further includes: Obtaining a target similarity between the short text to be matched and the target text; If the target similarity is lower than a first preset similarity threshold, segmenting the short text to be matched and the target text to obtain a first word set of the short text to be matched and a second word set of the target text; Obtaining similarities between corresponding words in the first word set and the second word set to obtain a similarity set; Acquire words in the first word set whose similarities are higher than a second preset similarity threshold in the similarity set, and obtain reference words, wherein the second preset similarity threshold is higher than the first preset similarity threshold; Acquire a short text including the reference word to obtain at least one reference short text; Determining a short text corresponding to the short text to be matched based on the at least one reference short text and the second word set; A short text corresponding to the short text to be matched is determined as a target text.
2. The method according to claim 1, characterized in that The step of extracting features from the filtered short text to be matched according to the feature extraction model to obtain vector features includes: Inputting the filtered short text to be matched into the embedding layer of the feature extraction model for operation to obtain a first operation result; Inputting the first operation result into the convolutional pooling layer of the feature extraction model for operation to obtain a second operation result; The second operation result is input into the fully connected layer of the feature extraction model for operation to obtain a third operation result, and the third operation result is determined as the vector feature.
3. The method according to claim 1, characterized in that The step of determining a short text corresponding to the short text to be matched based on the at least one reference short text comprises: Acquiring semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text; Obtaining target semantic information of the short text to be matched; According to the target semantic information and the reference semantic information corresponding to the at least one reference short text, a short text corresponding to the short text to be matched is determined from the at least one reference short text.
4. The method according to claim 1, characterized in that: The step of determining a short text corresponding to the short text to be matched based on the at least one reference short text comprises: Acquiring semantic information of the at least one reference short text to obtain reference semantic information corresponding to the at least one reference short text; Performing fusion processing on the reference semantic information corresponding to the at least one reference short text to obtain target semantic information; Adjusting the target text according to the target semantic information to obtain an adjusted target text; The adjusted target text is determined as a short text corresponding to the short text to be matched.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The short text to be matched is processed to remove interjections to obtain a first processed text; Performing semantic structure analysis on the first processed text to obtain a semantic structure of the first processed text; Verifying the target text according to the semantic structure to obtain a verification result; The verification result is displayed.
6. A text matching device, characterized in that: The device comprises: An acquisition unit, used for acquiring a short text to be matched; A filtering unit, used for filtering the short text to be matched to obtain a filtered short text to be matched; An extraction unit, used for performing feature extraction on the filtered short text to be matched according to a feature extraction model to obtain vector features; A matching unit, used for inputting the vector feature into a text matching model for matching, so as to obtain a target text corresponding to the short text to be matched; A display unit, used for displaying the target text; Before displaying the target text, the device further includes: Obtaining a target similarity between the short text to be matched and the target text; If the target similarity is lower than a first preset similarity threshold, segmenting the short text to be matched and the target text to obtain a first word set of the short text to be matched and a second word set of the target text; Obtaining similarities between corresponding words in the first word set and the second word set to obtain a similarity set; Acquire words in the first word set whose similarities are higher than a second preset similarity threshold in the similarity set, and obtain reference words, wherein the second preset similarity threshold is higher than the first preset similarity threshold; Acquire a short text including the reference word to obtain at least one reference short text; Determining a short text corresponding to the short text to be matched based on the at least one reference short text and the second word set; A short text corresponding to the short text to be matched is determined as a target text.
7. The device according to claim 6, characterized in that The extraction unit is used for: Inputting the filtered short text to be matched into the embedding layer of the feature extraction model for operation to obtain a first operation result; Inputting the first operation result into the convolutional pooling layer of the feature extraction model for operation to obtain a second operation result; The second operation result is input into the fully connected layer of the feature extraction model for operation to obtain a third operation result, and the third operation result is determined as the vector feature.
8. A terminal, characterized in that: The method comprises a processor, an input device, an output device and a memory, wherein the processor, the input device, the output device and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 5.
