A text and topic matching method, system, device and storage medium
By optimizing the implicit Dirichlet distribution topic recognition model and matching model, the problem of poor performance of traditional text matching methods for long texts and vertical domain vocabulary is solved, and efficient text matching recognition and judgment are achieved.
Patent Information
- Application Number
- CN202210772784.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2042-06-30
AI Technical Summary
Traditional text matching methods are not effective for long texts and words in vertical fields, and are easily affected by interfering content, resulting in inaccurate judgment results.
The topic keyword weights of text keyword groups are obtained by using the hidden Dirichlet distribution topic recognition model, and the matching model is trained and optimized. The degree of matching is judged by regular expressions. Keyword recognition model and conditional random field model are used for word segmentation and annotation to construct keyword groups.
It improves the matching success rate and recognition rate of texts of different lengths, has good recognition effect and scalability, short inference time, and can adapt to the future increase of keywords.
Smart Images

Figure CN115203368B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence, in particular to effective communication between human and computer using natural language, completing natural language processing, text matching technology of natural language text and contrast text, specifically, a text and theme matching method, system, device and storage medium. BACKGROUND
[0002] Text matching is a basic task of natural language processing and is the basis for many natural language processing tasks.
[0003] Traditional text matching methods include similarity calculation, long short-term memory network, etc. Traditional methods have the problems of poor effect on long text, poor effect on specific vertical field vocabulary (such as Haina Yun), easy to be disturbed by irrelevant links and synonyms in the article, and affect the judgment effect.
[0004] Therefore, the present application is proposed. SUMMARY
[0005] The technical problem to be solved by the present application is to overcome the shortcomings of the prior art and provide a text and theme matching method, system, device and storage medium which can achieve good results for texts of different lengths and good results for keywords in vertical fields.
[0006] To solve the above technical problems, the basic idea of the technical solution of the present application is:
[0007] In a first aspect, a text and theme matching method is provided, which includes the following steps:
[0008] Obtaining a pair of text information to be matched, the pair of text information to be matched including a group of theme keywords to be matched and a text to be matched;
[0009] Performing word segmentation processing on the pair of text information to be matched to obtain segmented information;
[0010] Inputting the segmented information into a keyword recognition model to obtain a group of text keywords;
[0011] Using an implicit Dirichlet distribution theme recognition model to obtain a theme keyword weight corresponding to each group of text keywords, and continuing optimization through matching model training;
[0012] According to the theme keyword weight, weighted calculation is performed on the group of theme keywords to be matched and the group of text keywords, or a regular expression is used to judge the matching degree and obtain a matching result.
[0013] In any of the above schemes, in a preferred embodiment, the text to be matched is according to a pre-set keyword rule set, the keyword rule set is composed of different keyword crawling rules, each or several keyword crawling rules correspond to a pre-set theme, if the text in the public web page meets a rule in the keyword rule set, the text and the theme corresponding to the rule form a to-be-matched theme keyword group and a to-be-matched text information pair.
[0014] In any of the above schemes, in a preferred embodiment, before the text information pair to be matched is processed, it further includes:
[0015] The text information pair to be matched is pre-screened;
[0016] If the text information pair to be matched contains negative theme keywords, the subsequent processing is skipped, and a direct determination is made that it is not matched, the negative theme keyword group is composed of keywords that exclude the negative theme keyword group, and is manually prepared in advance.
[0017] In any of the above schemes, in a preferred embodiment, before the segmented information is input into the keyword recognition model to obtain the text keyword group, it includes:
[0018] The keyword recognition model is constructed;
[0019] The keyword recognition model is trained.
[0020] In any of the above schemes, in a preferred embodiment, the keyword recognition model is trained, including:
[0021] A text training set is set, the training set is composed of text information, and each text information is annotated with keywords and parts of speech;
[0022] Training text is obtained from the training set, and each training text has corresponding keyword annotation and part-of-speech annotation information;
[0023] The text information is segmented to obtain corresponding segmented information;
[0024] The segmented information is input into a pre-set bert model to obtain sequence text information;
[0025] The sequence text information is input into a keyword annotation crf model and a part-of-speech annotation crf model respectively, and is compared with a keyword annotation sequence and a part-of-speech annotation sequence respectively to obtain corresponding keyword annotation loss information and part-of-speech annotation loss information;
[0026] According to the keyword annotation loss information and the part-of-speech annotation loss information, the gradient descent method is used to fine-tune the model parameters of the pre-set bert model and the keyword annotation crf model and the part-of-speech annotation crf model respectively;
[0027] When the keyword labeling loss information and the part-of-speech labeling loss information are both less than a certain threshold or the training round exceeds a certain number, the training stops.
[0028] In any of the above solutions, preferably, the method further comprises:
[0029] The text to be matched is obtained through keyword crawling.
[0030] The text to be matched is segmented to obtain segmentation information.
[0031] The segmentation information is input into a bidirectional encoder model to obtain an output sequence containing semantic information.
[0032] The output sequence is input into a conditional random field model to output a keyword label sequence.
[0033] The keyword group is obtained according to the keyword label sequence, and the keyword group contains the number of occurrences of each keyword in the text, wherein the keywords include names of persons, organizations and places.
[0034] In any of the above solutions, preferably, the method further comprises:
[0035] A keyword group pair matching training set is set, the training set is composed of multiple keyword group pairs, each keyword group pair includes two keyword groups and a label indicating whether the two keyword groups match;
[0036] The keyword group pairs are weighted, wherein each keyword group pair corresponds to a weight, and the weight is preset by an LDA topic model or a machine learning model.
[0037] The matching results are obtained through weighted calculation, the loss information is obtained by calculating the matching results and the labels, and the keyword weights are updated using the gradient descent method according to the loss information.
[0038] When the loss information is less than a certain threshold, the training stops.
[0039] Compared with the prior art, the present application has the following advantages.
[0040] By using the latent Dirichlet allocation topic identification model to obtain a topic keyword weight corresponding to each text keyword group, the recognition rate and recall rate can be improved, the matching success rate for texts of different lengths is high, the identification effect is good, the reasoning time is short, the reasoning time of a text of about 500 words is about 100 milliseconds, and the model can adapt to the increase of keywords in the future through simple transfer training, so the model has stronger scalability.
[0041] In a second aspect, a text and topic matching system comprises:
[0042] An acquisition module is configured to acquire a pair of text information to be matched, the pair of text information to be matched comprising a topic keyword group to be matched and text to be matched.
[0043] A word segmentation module is configured to perform word segmentation processing on the pair of text information to be matched to obtain segmented information.
[0044] An input module is configured to input the segmented information into a keyword recognition model to obtain a text keyword group.
[0045] A processing module is configured to use an implicit Dirichlet distribution topic recognition model to obtain a topic keyword weight corresponding to each text keyword group, and to continue optimization through matching model training.
[0046] A matching module is configured to perform weighted calculation on the topic keyword group to be matched and the text keyword group according to the topic keyword weight, or to use a regular expression to judge a matching degree and obtain a matching result.
[0047] The second aspect has the same beneficial effects as the first aspect, and thus will not be described again.
[0048] In a third aspect, a text and topic matching device comprises:
[0049] A memory is configured to store a computer program.
[0050] A processor is configured to execute the computer program to implement the steps of the text and topic matching method.
[0051] The third aspect has the same beneficial effects as the first aspect, and thus will not be described again.
[0052] In a fourth aspect, a storage medium has a computer program stored thereon, the program being executed by a processor to implement the text and topic matching method.
[0053] The fourth aspect has the same beneficial effects as the first aspect, and thus will not be described again.
[0054] The specific embodiments of the present application will be further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0055] The accompanying drawings, which are part of the present application, serve to provide a further understanding of the present application, and the illustrative embodiments of the present application and their descriptions serve to explain the present application but do not constitute an improper limitation on the present application. Obviously, the accompanying drawings described below are only some embodiments, and other drawings can be obtained by those skilled in the art without creative labor. In the drawings:
[0056] Figure 1 is a flowchart of the text and topic matching method of the present application.
[0057] Figure 2 is a flowchart of the keyword recognition model of the text and topic matching method of the present application.
[0058] Figure 3 is a flowchart of the keyword group recognition model training method of the text and topic matching method of the present application.
[0059] Figure 4 is a flowchart of the keyword group pair matching model training method of the text and topic matching method of the present application.
[0060] Figure 5 is a schematic diagram of the text and topic matching system of the embodiment of the present application.
[0061] Figure 6 is a schematic diagram of the text and topic matching device of the embodiment of the present application.
[0062] It should be noted that these drawings and written descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical scheme and advantages of the embodiment of the present application clearer, the technical scheme in the embodiment will be described clearly and completely below in conjunction with the drawings of the embodiment of the present application. The following embodiments are used to illustrate the present application, but not to limit the scope of the present application.
[0064] As shown in Figure 1 , the present application provides a text and topic matching method, which comprises the following steps:
[0065] Step 1: obtaining a pair of text information to be matched, which comprises a topic keyword group to be matched and a text to be matched, wherein the text to be matched is obtained by grabbing keyword rules from public web pages according to pre-set keyword rules, and is composed of different keyword grabbing rules, each or every few keyword grabbing rules correspond to a pre-set topic, and if the text in the public web pages meets a rule in the keyword rules, the text and the topic corresponding to the rule form a topic keyword group to be matched and a pair of text information to be matched.
[0066] In the text and theme matching method described in the embodiment of the application, the to-be-matched theme keyword group and the to-be-matched text are obtained as a set of to-be-matched text information pairs, wherein the to-be-matched text is captured from a public webpage according to a pre-set keyword rule group, for example, if the keyword rule group includes "house property + security", then an article including the keywords "house" and "property" will be captured, and an article including only "property" or "security" without "house" will not be captured. The keyword rule group is composed of different keyword capture rules, and each or every few keyword rules correspond to a pre-set theme. If the text in the public webpage meets a rule in the keyword rule group, then the text and the theme corresponding to the rule form a text information pair of the to-be-matched keyword group and the to-be-matched text.
[0067] Step 2: The to-be-matched text information pair is subjected to pre-screening processing, if the to-be-matched text information pair contains a negative theme keyword, then the subsequent processing is skipped, and it is directly determined that the matching is not matched. The negative theme keyword group is composed of keywords that are exclusive to the negative theme keyword group, and is manually prepared in advance.
[0068] Step 3: The to-be-matched text information pair is subjected to word segmentation processing to obtain segmented word information, wherein the word segmentation will segment a sentence into independent word groups according to semantics, for example, "tomorrow will be better" will be changed to "tomorrow + will + better" after word segmentation processing.
[0069] Step 4: The segmented word information is input into a keyword recognition model to obtain a text keyword group, wherein the text keyword group is an organization name, a place name and a person name contained in the to-be-matched text.
[0070] Step 5: An implicit Dirichlet distribution theme recognition model is used to obtain a theme keyword weight corresponding to each text keyword group, and the matching model is further optimized through model training.
[0071] Step 6: According to the theme keyword weight, the to-be-matched theme keyword group and the text keyword group are subjected to weighted calculation or regular expression to determine the matching degree, and a matching result is obtained.
[0072] In the text and theme matching method described in the embodiment of the application, by using the implicit Dirichlet distribution theme recognition model to obtain a theme keyword weight corresponding to each text keyword group, the recognition rate and the recall rate can be higher, the matching success rate for texts of different lengths is high, the recognition effect is good, the reasoning time is short, the reasoning time of a text of about 500 words is about 100 milliseconds, and through simple migration training, the model can adapt to the situation of future keyword increase, and therefore, the model has stronger expansibility.
[0073] Wherein each text keyword group has a weight, the initial value of the weight is obtained using an LDA (Latent Dirichlet Allocation) topic identification model, and is continuously optimized in a subsequent matching model training process. Based on the topic keyword weight, the matching degree is determined by weighted calculation of the to-be-matched topic keyword group and the text keyword group. If the calculation result is greater than a certain threshold value, it is considered that the text information matches the to-be-matched topic keyword group;
[0074] Wherein, m represents the number of keywords common to the to-be-matched topic keyword group and the text keyword group, n represents the total number of keywords in the to-be-matched topic keyword group, w represents the keyword weight, and k and l represent the frequency of occurrence of the same keyword in the to-be-matched topic keyword group.
[0075] As shown in Figure 3 Before the step of inputting the word segmentation information into the keyword identification model to obtain the text keyword group, the method further comprises the steps of:
[0076] Step 31: constructing a keyword identification model;
[0077] Step 32: training the keyword identification model, specifically comprising the steps of:
[0078] Step 321: setting a text training set, the training set being composed of about one hundred thousand pieces of text information with different lengths, all of which are annotated with keywords and parts of speech;
[0079] Step 322: obtaining training texts from the training set, each training text having corresponding keyword annotation and part-of-speech annotation information, the keyword annotation and part-of-speech annotation information being respectively used for keyword annotation tasks and part-of-speech annotation tasks in model training;
[0080] Step 323: performing word segmentation processing on the text information to obtain corresponding word segmentation information;
[0081] Step 324: inputting the word segmentation information into a pre-set bert model to obtain sequence text information;
[0082] Step 325: inputting the sequence text information into a keyword annotation crf model and a part-of-speech annotation crf model respectively, and comparing the sequence text information with keyword annotation sequences and part-of-speech annotation sequences respectively to obtain corresponding keyword annotation loss information and part-of-speech annotation loss information;
[0083] Step 326: using gradient descent method to fine-tune the model parameters of the pre-set bert model and the keyword annotation crf model and the part-of-speech annotation crf model according to the keyword annotation loss information and the part-of-speech annotation loss information, wherein the parameters of the bert model are shared by the keyword annotation task and the part-of-speech annotation task;
[0084] Step 327: When the keyword labeling loss information and the part-of-speech labeling loss information are both less than a certain threshold or the training round exceeds a certain number, the training stops. At this time, the model composed of the word segmentation processing module, the BERT model and the keyword labeling CRF model is the keyword group identification model, which can have a high matching success rate for texts of different lengths, has good identification effect and short inference time. The BERT model is a bidirectional encoder representation from the transformer, and the CRF model is a conditional random field model, which is a discriminative probabilistic model and a kind of random field, and is often used for labeling or analyzing sequence data such as natural language characters or biological sequences.
[0085] As shown in Figure 2 , the step of inputting the word segmentation information into the keyword identification model to obtain the text keyword group includes:
[0086] Step 41: obtaining the text to be matched through keyword crawling;
[0087] Step 42: performing word segmentation processing on the text to be matched to obtain word segmentation information;
[0088] Step 43: inputting the word segmentation information into the bidirectional encoder model to obtain an output sequence containing semantic information;
[0089] Step 44: inputting the output sequence into the conditional random field model to output a keyword label sequence;
[0090] Step 45: obtaining a keyword group from the keyword label sequence, the keyword group containing the number of occurrences of each keyword in the text, wherein the keywords include personal names, organization names and place names.
[0091] As shown in Figure 4 , the step of continuing optimization through the matching model training includes:
[0092] Step 51: setting a keyword group pair matching training set, the training set being composed of multiple keyword group pairs, each keyword group pair including two keyword groups and a label indicating whether the two keyword groups match;
[0093] Step 52: performing weighted calculation on the keyword group pairs, wherein each keyword group pair corresponds to a weight, the weight being preset by an LDA topic model or a machine learning model;
[0094] Step 53: obtaining a matching result through the weighted calculation, calculating loss information from the matching result and the label, and updating the keyword weight using the gradient descent method according to the loss information;
[0095] Step 54: stopping the training when the loss information is less than a certain threshold.
[0096] As shown in Figure 5As shown, a text and topic matching system includes:
[0097] The acquisition module is used to acquire text information pairs to be matched, wherein the text information pairs to be matched include topic keyword groups to be matched and text to be matched;
[0098] The word segmentation module is used to segment the text information pairs to be matched into words and obtain word segmentation information.
[0099] The input module is used to input word segmentation information into the keyword recognition model to obtain text keyword groups;
[0100] The processing module is used to obtain the weight of a topic keyword corresponding to each text keyword group using the Latent Dirichlet Distribution Topic Recognition Model, and to continue to optimize it through matching model training.
[0101] The matching module is used to perform weighted calculations on the topic keyword groups and text keyword groups to be matched, or to use regular expressions, based on the weights of the topic keywords, to determine the degree of matching and obtain the matching result.
[0102] like Figure 6 As shown, a text and topic matching device includes: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of the text and topic matching method described above. The processor controls the overall operation of the measuring device to complete all or part of the steps in the text and topic matching method described above. The memory stores various types of data to support the operation of the measuring device. This data may include, for example, instructions for any application or method used to operate on the measuring device, and application-related data such as contact data, sent and received messages, images, audio, video, etc. The memory can be implemented using any type of volatile or non-volatile storage device or a combination thereof.
[0103] For example, static random access memory (SRAM); electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component can include a screen and an audio component. The screen may, for example, be a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component can include a microphone for receiving external audio signals. The received audio signals can be further stored in the memory or transmitted through the communication component. The audio component also includes at least one speaker for outputting audio signals. The I / O interface provides an interface between the processor and other interface modules, which can be a keyboard, mouse, button, etc. These buttons can be virtual buttons or physical buttons. The communication component is used for wired or wireless communication between the measurement device and other devices. Wireless communication, such as Wi-Fi, Bluetooth, near field communication (NFC), 2G, 3G, 4G or 5G, or a combination of one or more of them, so the corresponding communication component can include: Wi-Fi module, Bluetooth module, NFC module.
[0104] In an exemplary embodiment, the measurement device can be one or more application-specific integrated circuits (ASICs);
[0105] Digital signal processor (DSP), digital signal processing device (DSPD);
[0106] Programmable logic device (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic elements for implementing the above-mentioned text and subject matching method.
[0107] In another exemplary embodiment, a computer readable storage medium including program instructions that, when executed by a processor, implement the steps of the text and topic matching method described above is also provided. For example, the computer readable storage medium can be the memory described above including program instructions that are executable by the processor of the measurement device to perform the text and topic matching method described above.
[0108] Corresponding to the method embodiments above, the embodiments of the disclosure also provide a readable storage medium, which can be mutually corresponding with the text and topic matching method described above.
[0109] In a fourth aspect, a readable storage medium is provided, and the readable storage medium stores a computer program. The computer program, when executed by a processor, implements the steps of the text and topic matching method of the method embodiments described above.
[0110] The readable storage medium can be specifically a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various readable storage media that can store program codes.
[0111] The above only describes the preferred embodiments of the present application and does not limit the present application in any form. Although the present application has been disclosed as above with the preferred embodiments, it is not intended to limit the present application. Any person skilled in the art can make some changes or modifications to the above-mentioned technical content without departing from the scope of the technical solution of the present application, and the equivalent embodiments with equivalent changes are equivalent. The embodiments in the above-mentioned embodiments can be further combined or replaced, but as long as it does not deviate from the content of the technical solution of the present application, any simple modification, equivalent change and modification of the above-mentioned embodiments according to the technical essence of the present application are still within the scope of the present application.
Claims
1. A text and topic matching method, characterized in that, The method includes the following steps: Obtain the text information to be matched, which includes the topic keyword group to be matched and the text to be matched; perform word segmentation on the text information to be matched to obtain word segmentation information; input the word segmentation information into the keyword recognition model to obtain the text keyword group; The hidden Dirichlet distribution topic recognition model is used to obtain the weight of a topic keyword corresponding to each text keyword group, and then the matching model is trained to further optimize it. Based on the topic keyword weights, the topic keyword groups and text keyword groups to be matched are weighted and calculated or regular expressions are used to determine the degree of matching and obtain the matching results. The method further includes: a training step for the keyword recognition model, comprising: setting a text training set, the training set consisting of text information, all of which have undergone keyword tagging and part-of-speech tagging; obtaining training texts from the training set, each training text having corresponding keyword tagging and part-of-speech tagging information; performing word segmentation on the text information to obtain corresponding word segmentation information; and inputting the word segmentation information into a pre-set BERT model to obtain sequence text information. The sequence text information is input into the keyword annotation CRF model and the part-of-speech tagging CRF model respectively, and compared with the keyword-annotated sequence and the part-of-speech tagging sequence respectively to obtain the corresponding keyword annotation loss information and part-of-speech tagging loss information. Based on the keyword annotation loss information and part-of-speech tagging loss information, the gradient descent method is used to fine-tune the model parameters of the preset BERT model, the keyword annotation CRF model and the part-of-speech tagging CRF model respectively. Training stops when the keyword annotation loss information and the part-of-speech tagging loss information are both less than a certain threshold or when the number of training epochs exceeds a certain number. The further optimization through matching model training includes: setting up a keyword pair matching training set, which consists of multiple keyword pairs, each pair including two keyword groups and a label indicating whether they match; performing weighted calculations on the keyword pairs, where each keyword group corresponds to a weight, which is preset by the Latent Dirichlet Distribution topic recognition model; obtaining matching results through weighted calculations; calculating loss information from the matching results and labels; updating keyword weights using gradient descent based on the loss information; and stopping training when the loss information is less than a certain threshold.
2. The text and topic matching method according to claim 1, characterized in that, The text to be matched is obtained by crawling keyword rule groups from public web pages according to a pre-defined set of keyword rule groups. The set of keyword rule groups consists of different keyword crawling rules, and each or several keyword crawling rules correspond to a pre-defined topic. If the text in the public web page matches a certain rule in the keyword rule group, then the text and the topic corresponding to that rule form a keyword group to be matched and a text information pair to be matched.
3. The text and topic matching method according to claim 2, characterized in that, Before performing word segmentation on the text information pairs to be matched, the following steps are also included: Pre-screening is performed on the text information pairs to be matched; If the text information pair to be matched contains negative topic keywords, then the subsequent processing is skipped and a mismatch is directly determined. The negative topic keyword group consists of keywords that are excluded from the negative topic keyword group and is manually pre-defined.
4. The text and topic matching method according to claim 3, characterized in that, Before inputting the word segmentation information into the keyword recognition model to obtain text keyword groups, the process includes: Construct a keyword recognition model.
5. The text and topic matching method according to claim 4, characterized in that, The step of inputting word segmentation information into the keyword recognition model to obtain text keyword groups includes: The text to be matched is obtained by crawling keywords; the text to be matched is segmented into words to obtain word segmentation information; The word segmentation information is input into the bidirectional encoder model to obtain an output sequence containing semantic information; Input the output sequence into the conditional random field model, and output the keyword tag sequence; Keyword groups are obtained from the keyword tag sequence. Each keyword group contains the number of times each keyword appears in the text. The keywords include names of people, organizations, and places.
6. A text and topic matching system, characterized in that, include: The acquisition module is used to acquire text information pairs to be matched, wherein the text information pairs to be matched include topic keyword groups to be matched and text to be matched; The word segmentation module is used to segment the text information pairs to be matched into words and obtain word segmentation information. The input module is used to input word segmentation information into the keyword recognition model to obtain text keyword groups; The processing module is used to obtain the weight of a topic keyword corresponding to each text keyword group using the Latent Dirichlet Distribution Topic Recognition Model, and to continue to optimize it through matching model training; the matching module is used to perform weighted calculation or use regular expressions to determine the degree of matching between the topic keyword group to be matched and the text keyword group based on the topic keyword weight, and to obtain the matching result. The keyword recognition model includes the following training steps: setting up a text training set, which consists of text information, all of which have been labeled with keywords and parts of speech; Training texts are obtained from the training set, and each training text has corresponding keyword and part-of-speech tagging information; the text information is segmented to obtain corresponding segmentation information; the segmentation information is input into a pre-set BERT model to obtain sequence text information; The sequence text information is input into the keyword annotation CRF model and the part-of-speech tagging CRF model respectively, and compared with the keyword-annotated sequence and the part-of-speech tagging sequence respectively to obtain the corresponding keyword annotation loss information and part-of-speech tagging loss information. Based on the keyword annotation loss information and part-of-speech tagging loss information, the gradient descent method is used to fine-tune the model parameters of the preset BERT model, the keyword annotation CRF model and the part-of-speech tagging CRF model respectively. Training stops when the keyword annotation loss information and the part-of-speech tagging loss information are both less than a certain threshold or when the number of training epochs exceeds a certain number. The further optimization through matching model training includes: setting up a keyword pair matching training set, which consists of multiple keyword pairs, each pair including two keyword groups and a label indicating whether they match; performing weighted calculations on the keyword pairs, where each keyword group corresponds to a weight, which is preset by the Latent Dirichlet Distribution topic recognition model; obtaining matching results through weighted calculations; calculating loss information from the matching results and labels; updating keyword weights using gradient descent based on the loss information; and stopping training when the loss information is less than a certain threshold.
7. A text and topic matching device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the text and topic matching method as described in any one of claims 1 to 5 when executing the computer program.
8. A storage medium, characterized in that, It stores a computer program, characterized in that, when the program is executed by a processor, it implements the text and topic matching method as described in any one of claims 1 to 5.