Matching method, device, computer equipment and storage medium based on text processing
By considering the semantic correlation between the target word participle and its associated word participle in text matching, calculating the semantic matching degree and outputting the target matching content, the problem of insufficient matching efficiency and accuracy in the prior art is solved, and a more efficient and accurate matching effect is achieved.
Patent Information
- Application Number
- CN202110448628.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-25
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2041-04-25
AI Technical Summary
When the prior art matches the content of word segmentation in text, the matching efficiency and accuracy need to be improved.
By obtaining the pending text, including the target word participle to be matched and the associated word participle that has a semantic relationship with the target word participle, the candidate matching content set of the target word participle is determined, and based on the association relationship between the target word participle and the associated word participle and the content description information of the candidate matching content, the semantic matching degree of the target word participle and the candidate matching content is calculated, thereby determining and outputting the target matching content of the target word participle.
The content matching efficiency and accuracy of word segmentation in text are improved, and the accuracy of matching is enhanced by considering the semantic correlation between the target word segmentation and its associated word segmentation is enhanced, and the efficiency of content matching is improved when processing multiple word segmentation to be matched.
Smart Images

Figure CN113761887B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a text processing-based matching method, apparatus, computer device and storage medium. Background Art
[0002] In the process of text processing, content matching is performed on the words in the text to determine the meaning represented by the words in the text or the content referred to by the words. This has very wide applications in many natural language processing products.
[0003] During the research and practice of related technologies, the inventors of the present application discovered that, currently, when performing content matching on a target word segment in a text to be processed, content matching is performed by focusing on the target word segment in the text to be processed. This means that the content matching method for word segmentation needs to be improved, for example, both the matching efficiency and accuracy need to be improved. Summary of the invention
[0004] The embodiments of the present application provide a text processing-based matching method, apparatus, computer device, and storage medium, which can improve the content matching efficiency for word segments in a text.
[0005] The present application embodiment provides a matching method based on text processing, including:
[0006] Acquire a text to be processed, wherein the text to be processed includes a target segmentation to be matched and an associated segmentation that has an associated relationship with the target segmentation at a semantic level;
[0007] Determine a candidate matching content set for the target word segment, wherein the candidate matching content set includes at least one candidate matching content for the target word segment, and each candidate matching content has corresponding content description information;
[0008] Calculating the semantic matching degree between the target participle and the associated participle based on the associated relationship between the target participle and the associated participle, and the content description information of the candidate matching content;
[0009] Based on the semantic matching degree, target matching content of the target word segment is determined and output from the candidate matching content set.
[0010] Accordingly, the embodiment of the present application further provides a matching device based on text processing, including:
[0011] An acquisition unit, configured to acquire a text to be processed, wherein the text to be processed includes a target segmentation to be matched and an associated segmentation that has an associated relationship with the target segmentation at a semantic level;
[0012] A determination unit, configured to determine a candidate matching content set of the target word segment, wherein the candidate matching content set includes at least one candidate matching content of the target word segment, and each candidate matching content has corresponding content description information;
[0013] A calculation unit, configured to calculate a semantic matching degree between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle and the content description information of the candidate matching content;
[0014] An output unit is used to determine and output the target matching content of the target word segment from the candidate matching content set based on the semantic matching degree.
[0015] In one embodiment, the computing unit comprises:
[0016] A first calculation subunit is used to calculate the semantic association between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle, wherein the semantic association represents the degree of association between the target participle and the candidate matching content at the semantic level;
[0017] A second calculation subunit is used to calculate the semantic similarity between the target word segment and the candidate matching content based on the content description information of the candidate matching content, wherein the semantic similarity represents the similarity between the target word segment and the candidate matching content at the semantic level;
[0018] The third calculation subunit is used to calculate the semantic matching degree between the target word segment and the candidate matching content based on the semantic association degree and the semantic similarity.
[0019] In one embodiment, the first computing subunit is configured to:
[0020] Determine a candidate matching content set of the associated participle, wherein the candidate matching content set of the associated participle includes at least one candidate matching content of the associated participle; calculate a semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the association relationship between the target participle and the associated participle, wherein the semantic relevance represents a degree of relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle at a semantic level; determine a semantic relevance between the target participle and the candidate matching content of the target participle based on the semantic relevance.
[0021] In one embodiment, the first computing subunit is specifically configured to:
[0022] Determine a content reference set for each of the candidate matching contents, wherein the content reference set includes at least one referenced content of the candidate matching content, and the referenced content has a content reference relationship with the candidate matching content; and calculate the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the content reference set corresponding to the candidate matching content of the target participle and the content reference set corresponding to the candidate matching content of the associated participle.
[0023] In one embodiment, the first computing subunit is specifically configured to:
[0024] A set operation is performed on a content reference set corresponding to the candidate matching content of the target participle and a content reference set corresponding to the candidate matching content of the associated participle to obtain a target reference set after operation, wherein the target reference set includes at least one target reference content, the target reference content has a content reference relationship with the candidate matching content of the target participle, and the target reference content has a content reference relationship with the candidate matching content of the associated participle; based on the target reference set, a semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle is calculated.
[0025] In one embodiment, the content description information includes content brief information and content attribute information of the candidate matching content; the second calculation subunit is used to:
[0026] Acquire contextual text information of the target word segment in the text to be processed; combine the content introduction information with the content attribute information to obtain combined content description information; and calculate the semantic similarity between the target word segment and the candidate matching content based on the contextual text information and the combined content description information.
[0027] In one embodiment, the second computing subunit is specifically configured to:
[0028] Calculate the semantic relevance between the content attribute information and the context text information, wherein the semantic relevance represents the degree of relevance between the content attribute information and the context text information at the semantic level; based on the calculation result, select target content attribute information from the at least one content attribute information; combine the content brief introduction information with the target content attribute information to obtain combined content description information.
[0029] In one embodiment, the second computing subunit is specifically configured to:
[0030] Acquire a trained semantic feature extraction model; perform feature extraction on the context text information and the combined content description information respectively through the semantic feature extraction model to obtain context semantic features corresponding to the context text information and content semantic features corresponding to the combined content description information; calculate the semantic similarity between the target word segmentation and the candidate matching content based on the context semantic features and the content semantic features.
[0031] In one embodiment, the second computing subunit is specifically configured to:
[0032] The context text information is divided to obtain divided context text information; the divided context text information is subjected to feature conversion to obtain context text features corresponding to the divided context text information; and the context text features are subjected to feature extraction based on the attention mechanism through the semantic feature extraction model to obtain context semantic features corresponding to the context text features.
[0033] In one embodiment, the second computing subunit is specifically configured to:
[0034] Determine a semantic feature extraction model to be trained and a sample data set required for model training, wherein the sample data set includes a sample text, and the sample text includes a sample segmentation to be matched and a sample associated segmentation that has an associated relationship with the sample segmentation at a semantic level; determine a candidate matching content set for the sample segmentation, wherein the candidate matching content set for the sample segmentation includes at least one sample candidate matching content for the sample segmentation; calculate the semantic matching degree between the sample segmentation and the sample candidate matching content; and based on the semantic matching degree, perform model training on the semantic feature extraction model to be trained to obtain a trained semantic feature extraction model.
[0035] In one embodiment, the third computing subunit is used to:
[0036] Based on the content reference relationship between the candidate matching contents, the prior importance of the candidate matching contents is determined; the semantic association, the semantic similarity, and the prior importance are fused to obtain a fusion result; based on the fusion result, the semantic matching degree between the target word segment and the candidate matching contents is determined.
[0037] In one embodiment, the output unit includes:
[0038] A sorting subunit, configured to sort the candidate matching contents in the candidate matching content set based on the semantic matching degree;
[0039] The output subunit is used to determine and output the target matching content of the target word segmentation from the candidate matching content set based on the sorting result.
[0040] Correspondingly, an embodiment of the present application further provides a storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the matching method based on text processing as shown in the embodiment of the present application are implemented.
[0041] Correspondingly, an embodiment of the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the text processing-based matching method shown in the embodiment of the present application are implemented.
[0042] The embodiment of the present application can obtain a text to be processed, wherein the text to be processed includes a target participle to be matched, and an associated participle that has an associated relationship with the target participle at a semantic level; determine a candidate matching content set of the target participle, wherein the candidate matching content set includes at least one candidate matching content of the target participle, and each candidate matching content has corresponding content description information; based on the association relationship between the target participle and the associated participle, and the content description information of the candidate matching content, calculate the semantic matching degree between the target participle and the candidate matching content; based on the semantic matching degree, determine and output the target matching content of the target participle from the candidate matching content set.
[0043] The scheme can calculate the semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and its associated segmentation. In this way, when the scheme performs content matching on the target segmentation, it is not only focused on the target segmentation, but also takes into account that there is a strong semantic correlation between the target segmentation and its associated segmentation in the text to be processed, and the scheme performs content matching on the target segmentation based on the semantic correlation. Therefore, this helps to improve the matching efficiency and matching accuracy. In addition, when the associated segmentation of the target segmentation is also the segmentation to be matched in the text to be processed, that is, when there are multiple segmentations to be matched in the text to be processed, the scheme performs content matching by combining the semantic correlation between multiple segmentations to be matched. In this way, compared with independently performing content matching on each segmentation to be matched in the text to be processed in turn, the scheme can simultaneously calculate the semantic correlation between multiple segmentations to be matched in the text to be processed, so that the content matching efficiency for multiple segmentations to be matched in the text to be processed is further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 is a scenario diagram of a text processing-based matching method provided in an embodiment of the present application;
[0046] Figure 2 is a flowchart of a text processing-based matching method provided in an embodiment of the present application;
[0047] Figure 3 is a schematic diagram of a candidate matching content set of a matching method based on text processing provided in an embodiment of the present application;
[0048] Figure 4 is a schematic diagram of semantic relevance of a text processing-based matching method provided in an embodiment of the present application;
[0049] Figure 5 It is a content reference schematic diagram of a text processing-based matching method provided in an embodiment of the present application;
[0050] Figure 6 is a relevance network diagram of a text processing-based matching method provided in an embodiment of the present application;
[0051] Figure 7 It is a schematic diagram of semantic feature extraction of a text processing-based matching method provided in an embodiment of the present application;
[0052] Figure 8 is another flowchart of the text processing-based matching method provided in an embodiment of the present application;
[0053] Fig. 9 is a structural diagram of a text processing-based matching device provided in an embodiment of the present application;
[0054] Fig.10 is another structural schematic diagram of a text processing-based matching device provided in an embodiment of the present application;
[0055] Fig.11 is another structural schematic diagram of a text processing-based matching device provided in an embodiment of the present application;
[0056] Fig.12 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] 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 those skilled in the art without creative work are within the scope of protection of this application.
[0058] The embodiment of the present application provides a text processing-based matching method, device, computer device and storage medium. Specifically, the embodiment of the present application provides a text processing-based matching device applicable to a computer device. The computer device may be a terminal or a server, and the terminal may be a mobile phone, a tablet computer, a laptop computer or other device. The server may be a single server or a server cluster consisting of multiple servers.
[0059] The embodiment of the present application will take a computer device as a server as an example to introduce a matching method based on text processing.
[0060] refer to Figure 1 A search client may be run on the terminal 20, and the terminal 20 may obtain the text to be searched sent by the user through the search client, and use the text to be searched as the text to be processed, wherein the text to be processed includes the target segmentation to be matched, and the associated segmentation that has an associated relationship with the target segmentation at the semantic level.
[0061] The terminal 20 can send the text to be processed to the server 10 so that the server 10 can obtain the text to be processed accordingly. Further, the server 10 can determine a candidate matching content set for the target segmentation, wherein the candidate matching content set includes at least one candidate matching content for the target segmentation, and each candidate matching content has corresponding content description information. The server 10 can calculate the semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and the associated segmentation, and the content description information of the candidate matching content. Furthermore, the server 10 can determine and output the target matching content of the target segmentation from the candidate matching content set based on the calculated semantic matching degree.
[0062] The terminal 20 may correspondingly obtain the target matching content, generate a search result page based on the target matching content, and then display the search result page to the user.
[0063] Similarly, the terminal 20 may also run an artificial intelligence-based question-and-answer client, a recommendation client, etc. The terminal 20 may obtain the text to be processed through the client and send it to the server 10. The server 10 may determine and output the target matching content through the text processing-based matching method described in the present application, so that the terminal 20 may further interact with the user or perform data processing after obtaining the target matching content.
[0064] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0065] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0066] Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0067] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0068] The present application provides a text processing-based matching method, which involves technologies such as natural language processing (NLP) of artificial intelligence, and the method can be executed by a terminal or a server, or by both the terminal and the server. The present application takes the text processing-based matching method executed by the server as an example for explanation. Specifically, the text processing-based matching method is executed by a text processing-based matching device integrated in the server, such as Figure 2The specific process of the text processing-based matching method may be as follows:
[0069] 101. Obtain a text to be processed, wherein the text to be processed includes a target segmentation to be matched and an associated segmentation that has an associated relationship with the target segmentation at a semantic level.
[0070] Among them, text refers to the expression of written language, usually a sentence or a combination of sentences with complete and systematic meanings. Sentences are the basic units of language use, and sentences can be composed of words and phrases.
[0071] The text to be processed may be in a variety of languages. For example, the text to be processed may be in Chinese, English, French, etc.; for another example, the text to be processed may be in a programming language; and so on.
[0072] For example, the text to be processed may be a Chinese text, for example, the text to be processed may be "Li X was influenced by his father since he was a child, and started practicing badminton in 1988. In 1989, he was spotted by the famous tennis coach Xia X and started practicing tennis." It is worth noting that "Li X" and "Xia X" in this example are both example words.
[0073] For another example, the text to be processed may be an English text, for example, the text to be processed may be “Influenced by his father since childhood, Zhang San began to practice badminton in 1988. In 1989, he was selected by Li Si, a famous tennis coach, to practice tennis.”.
[0074] The segmented words in the to-be-processed text are words or phrases in the to-be-processed text, and the target segmented words to be matched refer to the segmented words to be content-matched. Specifically, content matching of the segmented words is used to match the segmented words to corresponding content.
[0075] Among them, content is the carrier of information, and content can be composed of multiple pieces of information. For example, content can include text information, picture information, audio information, video information, etc. For example, content can be a knowledge record in a knowledge base, and the knowledge record can be expressed in the database as a related data record in the database, and the knowledge record can be expressed in the application as web page content, etc.
[0076] For example, reference Figure 3, where each sense corresponds to an entity named "Li X" in a knowledge base. Each entity in the knowledge base has relevant content information. Therefore, it is worth noting that in this application, the process of content matching for the target token to be matched in the text to be processed can also be referred to as the process of matching the named entity corresponding to the target token in the text to be processed, in order to match the named entity to the correct entity. For example, the process of matching the named entity to the correct entity in the knowledge base.
[0077] In practical applications, users can click on Figure 3 the senses to jump to the content display page of the corresponding entity. A polysemous word consists of a lemma and several senses. Each description of a different conceptual meaning thing under the same lemma is called a sense. The sense description is a clear narrative of the sense and should be the content that best represents the attributes and characteristics of the sense thing. For example, there are multiple senses under the lemma "apple", including fruit tree, fruit, company, and movie, etc.
[0078] In practical applications, content matching for the target token can have multiple different application scenarios. For example, it can be applied in search. As an example, for the text to be processed "X Dehua X Jiandao", if it is not only recognized that "X Dehua" is a movie star and "X Jiandao" is a movie, but also these two entities are linked to the corresponding entities in the knowledge base, then more detailed information about these two entities can be obtained through the knowledge base. For example, the age, constellation, representative works of "X Dehua", and the director, actors, release date of "X Jiandao", etc. These information can not only provide rich display information for users, but also be very helpful for the in-depth understanding of the text to be processed. At the same time, it can also better retrieve more relevant content information.
[0079] Another example is that in a question-answering system, it is necessary to accurately analyze the user's question, which is also an application scenario of content matching. For example, the text to be processed can be the user's question "The relationship between Qian XX and Tsinghua University", and "Qian XX" and "Tsinghua University" can be matched with the knowledge records in the knowledge base to obtain the correct answer to this question through the knowledge base.
[0080] Another example is that content matching can also be applied in a recommendation system. For example, if a user clicks on the article "X Amazon announces a cooperation with X Tencent Video", it can be determined that the user may be interested in the company entity "X Amazon" rather than the entity "X Amazon River", and then relevant information about the company entity "X Amazon" can be recommended to the user.
[0081] As an example, content matching can be applied to entity disambiguation in NLP. Specifically, entity disambiguation is a basic technique in NLP, aiming to link the named entities identified in the text to the correct entities in the knowledge base, sometimes also called entity linking. For example, the name "Li X" is identified as a personal name in the text to be processed. In one embodiment, referring to Figure 3 it can be seen that there are many people named "Li X" in the knowledge base. It is necessary to link "Li X" in the text to be processed to the correct entity, that is, the entity of "a famous Chinese female tennis player". And this process is the process of content matching for the target token "Li X", that is, matching the target token to the content that the target token should correspond to, or it can be said that matching the target token to the correct content that the target token corresponds to.
[0082] Among them, the associated tokens of the target token are the tokens in the text to be processed that have an associated relationship with the target token at the semantic level. And the associated relationship at the semantic level represents how the tokens are associated to form the meaning of the sentence.
[0083] As an example, if the text to be processed is "Li X was influenced by his father since childhood. He started practicing badminton in 1988. In 1989, he was spotted by the famous tennis coach Xia X and started practicing tennis", and the target token is "Li X", the associated tokens of the target token can be "Xia X" because after associating "Li X" and "Xia X", it is beneficial to understand the correct meaning of the text to be processed.
[0084] It should be noted that the number of associated tokens can be multiple. For example, in another example, if the text to be processed is "When interviewed by a reporter, X兰特 was asked about X姆斯' decision to return to X士. He said 'I think X姆斯 considered it very carefully and handled it beautifully'", and the target token is "X兰特", the associated tokens of the target token can include "X姆斯" and "X士" because after associating "X兰特", "X姆斯" and "X士", it is beneficial to understand the correct meaning of the text to be processed.
[0085] It should be noted that the associated tokens can also be the tokens to be matched in the text to be processed. That is to say, the text to be processed can include at least one target token to be matched, and these target tokens have an associated relationship at the semantic level. For example, if the text to be processed is "When interviewed by a reporter, X兰特 was asked about X姆斯' decision to return to X士. He said 'I think X姆斯 considered it very carefully and handled it beautifully'", then the target tokens can include "X兰特", "X姆斯" and "X士", and these target tokens have an associated relationship at the semantic level. That is to say, after associating these target tokens, it is beneficial to understand the correct meaning of the text to be processed.
[0086] In this application, there can be multiple ways to obtain the text to be processed. For example, the terminal can send the text to be processed to the server so that the server can obtain the text to be processed. Specifically, a client can run on the terminal, and the terminal can obtain the text to be processed through this client. For example, a search client, a question-and-answer system client, a recommendation system client, etc. can run on the terminal.
[0087] 102. Determine a candidate matching content set for the target word segment, where the candidate matching content set includes at least one candidate matching content for the target word segment, and each candidate matching content has corresponding content description information.
[0088] Among them, the candidate matching content for the target word segment refers to the matching content that may match the target word segment. For example, taking the text to be processed as "Li X was influenced by his father since childhood. He started practicing badminton in 1988. In 1989, he was spotted by the famous tennis coach Xia X and started practicing tennis" as an example, if the target word segment is "Li X", then the candidate matching content for the target word segment can be Figure 3 the 115 senses of "Li X" shown in [reference], and each sense has corresponding content information in the knowledge base.
[0089] Among them, the candidate matching content set for the target word segment is a set composed of the candidate matching content for the target word segment, which may include at least one candidate matching content for the target word segment. For example, the candidate matching content set for the target word segment "Li X" can be composed of Figure 3 the set composed of the 115 senses shown in [reference].
[0090] Among them, the content description information is the information describing the candidate matching content. For example, the content description information may include the content introduction information and the content attribute information of the candidate matching content. Among them, the content introduction information is the relevant information for briefly introducing the entity corresponding to the candidate matching content, and the content attribute information is the relevant information describing the attributes of the entity corresponding to the candidate matching content.
[0091] As an example, referring to Figure 3 , for the candidate matching content corresponding to "Famous Chinese female tennis player", its content description information may include the content introduction information and the content attribute information. For example, the content introduction information may be "Li X is a famous Chinese female tennis player who has participated in many international competitions and won many honors..."; the content attribute information may include the relevant information of the attributes of the entity corresponding to "Famous Chinese female tennis player". For example, the content attribute information may include the relevant information of the following attributes: Chinese name, foreign name, alias, nationality, ethnicity, place of birth, date of birth, height, weight, graduation institution, etc.
[0092] There may be many ways to determine the candidate matching content set of the target word segmentation. For example, the server may obtain the candidate matching content set of the target word segmentation by requesting relevant data from the terminal or other servers.
[0093] As an example, a candidate matching content set of the target word segmentation may be stored in a database, for example, a candidate matching content set of the target word segmentation may be included in a knowledge base, and then a data query request may be generated based on the target word segmentation, and the data query request is used to request to obtain the candidate matching content of the target word segmentation. Further, response data in response to the data query request may be obtained, and the response data may include at least one candidate matching content of the target word segmentation. Thus, the candidate matching content set of the target word segmentation may be determined based on the obtained candidate matching content.
[0094] 103. Based on the association relationship between the target segmentation and the associated segmentation, and the content description information of the candidate matching content, calculate the semantic matching degree between the target segmentation and the candidate matching content.
[0095] The semantic matching degree describes the matching degree between the target word segmentation and the candidate matching content at the semantic level. The semantic matching degree can be expressed in various forms. For example, the semantic matching score between the target word segmentation and the candidate matching content can be calculated and used to represent the semantic matching degree.
[0096] There are multiple ways to calculate the semantic matching degree between the target segmentation and the associated segmentation based on the association relationship between the target segmentation and the associated segmentation, and the content description information of the candidate matching content. For example, the semantic matching degree between the target segmentation and the associated segmentation can be calculated based on the association relationship between the target segmentation and the associated segmentation, and based on the content description information of the candidate matching content. Further, the semantic matching degree between the target segmentation and the candidate matching content is determined based on the calculation result. Specifically, the step of "calculating the semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and the associated segmentation, and the content description information of the candidate matching content" may include:
[0097] Based on the association relationship between the target segmentation and the associated segmentation, the semantic association between the target segmentation and the candidate matching content is calculated, wherein the semantic association represents the degree of association between the target segmentation and the candidate matching content at the semantic level;
[0098] Based on the content description information of the candidate matching content, the semantic similarity between the target word segmentation and the candidate matching content is calculated, wherein the semantic similarity represents the degree of similarity between the target word segmentation and the candidate matching content at the semantic level;
[0099] Based on the semantic association and semantic similarity, the semantic matching degree between the target word segmentation and the candidate matching content is calculated.
[0100] The following may first describe the step of “calculating the semantic association between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and the associated segmentation”.
[0101] Among them, the semantic relevance represents the degree of relevance between the target segmentation and the candidate matching content at the semantic level. Specifically, in the text to be processed, the target segmentation and its associated segmentation have an association relationship at the semantic level, and the association relationship describes how to understand the correct meaning of the text to be processed by associating the target segmentation with its associated segmentation. Therefore, it can be seen that the associated segmentation is helpful to determine the target matching content of the target segmentation from the candidate matching content set of the target segmentation.
[0102] For example, for the text to be processed, "In 2004, Li X chose to make a comeback with the encouragement and support of her husband Jiang X.", the target segmentation word can be "Li X", and the associated segmentation word of the target segmentation word can be "Jiang X". "Li X" and "Jiang X" can correspond to multiple entities in the knowledge base respectively. However, the semantic relevance between the entity pair "Li X (Chinese women's tennis star)" and "Jiang X (famous tennis coach)" is higher than the semantic relevance between other entities. Therefore, calculating the semantic relevance between the target segmentation word and its associated segmentation words helps to determine the target matching content of the target segmentation word from the candidate matching content set of the target segmentation word.
[0103] It is worth noting that after calculating the semantic association between the target segmentation and the associated segmentation, the semantic association not only helps to match the target segmentation, but also helps to match the associated segmentation. In this way, if the associated segmentation of the target segmentation is also a segmentation to be matched in the text to be processed, the calculation process helps to efficiently match the content of multiple segmentations to be matched in the text to be processed.
[0104] For example, for the text to be processed "In 2004, Li X chose to make a comeback with the encouragement and support of her husband Jiang X.", the target segmentation word "Li X" has the associated segmentation word "Jiang X". Since the semantic association between "Li X" and "Jiang X" is calculated during the content matching of "Li X", the semantic association not only helps to match the content of "Li X", but also helps to match the content of "Jiang X".
[0105] Based on the association relationship between the target token and the associated token, there can be multiple ways to calculate the semantic association degree between the target token and the candidate matching content of the target token. For example, the semantic association degree between the target token and the candidate matching content of the target token can be determined by calculating the correlation degree at the semantic level between the candidate matching content of the target token and the candidate matching content of the associated token. Specifically, the step of "calculating the semantic association degree between the target token and the candidate matching content based on the association relationship between the target token and the associated token" can include:
[0106] Determine the set of candidate matching contents of the associated token, where the set of candidate matching contents of the associated token includes at least one candidate matching content of the associated token;
[0107] Based on the association relationship between the target token and the associated token, calculate the semantic correlation degree between the candidate matching content of the target token and the candidate matching content of the associated token, where the semantic correlation degree represents the correlation degree at the semantic level between the candidate matching content of the target token and the candidate matching content of the associated token;
[0108] Based on the semantic correlation degree, determine the semantic association degree between the target token and the candidate matching content of the target token.
[0109] Among them, the candidate matching content of the associated token refers to the matching content that may be matched with the associated token. For example, taking the text to be processed as "Li X was influenced by his father since childhood. He started practicing badminton in 1988. In 1989, he was spotted by the famous tennis coach Xia X and started practicing tennis" as an example, the target token can be "Li X", and the associated token can be "Xia X", then the candidate matching content of this associated token can be the senses of "Xia X" in the knowledge base.
[0110] Among them, the set of candidate matching contents of the associated token is a set composed of the candidate matching contents of the associated token, which may include at least one candidate matching content of the associated token. For example, the set of candidate matching contents of the associated token "Xia X" can be a set composed of the senses of "Xia X" in the knowledge base.
[0111] Similarly, the method for determining the set of candidate matching contents of the associated token can refer to the method for determining the set of candidate matching contents of the target token, which will not be elaborated here.
[0112] Furthermore, the semantic correlation degree between the candidate matching content of the target token (hereinafter referred to as the first candidate content) and the candidate matching content of the associated token (hereinafter referred to as the second candidate content) can be calculated.
[0113] As an example, refer to Figure 4, the text to be processed may be "When Xlant was interviewed by a reporter, he was asked about Xms's decision to return to Xs. He said, 'I think Xms considered it very carefully and handled it very beautifully'", where the target segmentation word is "Xlant" and the associated segmentation words may be "Xms" and "Xs". The semantic relevance between the candidate matching content of the target segmentation word "Xlant" and the candidate matching content of the associated segmentation word "Xms" can be used as an example for introduction.
[0114] refer to Figure 4 , the semantic relevance between candidate matching contents can be represented by connecting lines. Specifically, in this example, the candidate matching contents of the target word "X rand" are the following two: "A1 · X rand (historian)" and "A2 · X rand (basketball player)". The candidate matching contents of the associated word "X muses" are the following two: "B1 · X muses (basketball player)" and "B2 · X muses (actor, singer)". Therefore, see Figure 4 , the semantic relevance between the candidate matching content of the target participle "X rand" and the candidate matching content of the associated participle "X mums" can be illustrated by connecting lines.
[0115] Similarly, the semantic relevance between the candidate matching content of "X rand" and the candidate matching content of "X scholar" can also be expressed as Figure 4 The diagram is shown as shown.
[0116] There are many ways to calculate the semantic relevance between the first candidate content and the second candidate content. For example, considering that in actual applications, there are content references between contents, for example, if the content exists in the form of pages, the content references can be links between pages; for example, if the content exists in the form of articles, the content references can be references between articles; for example, if the content exists in the form of program files, the content references can be references between programs; and so on. Since the more intersections of content references between two participles, the higher the semantic relevance of the two participles, for example, the more common pages linked to two entities, the higher the semantic relevance of the two entities. Therefore, when calculating the semantic relevance between the first candidate content and the second candidate content, it can be calculated based on the content references of each candidate content. Specifically, the step of "calculating the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the association relationship between the target participle and the associated participle" can include:
[0117] Determine a content reference set for each candidate matching content, wherein the content reference set includes at least one referenced content of the candidate matching content, and the referenced content has a content reference relationship with the candidate matching content;
[0118] Based on the content reference set corresponding to the candidate matching content of the target segmentation and the content reference set corresponding to the candidate matching content of the associated segmentation, the semantic relevance between the candidate matching content of the target segmentation and the candidate matching content of the associated segmentation is calculated.
[0119] Among them, the content reference relationship refers to the relationship of mutual reference between contents, or one-way reference. There can be many reference situations. For example, if the content exists in the form of pages, the content reference can be a link between pages; for example, if the content exists in the form of articles, the content reference can be a reference between articles; for example, if the content exists in the form of program files, the content reference can be a reference between programs; and so on.
[0120] The referenced content of the candidate matching content refers to the content that has a content reference relationship with the candidate matching content. For example, if the content exists in the form of pages, the referenced content of page A may include the inbound and outbound links of page A.
[0121] The content reference set of candidate matching content is a set consisting of references of candidate matching content. For example, the content reference set of the first candidate content is a set consisting of references of the first candidate content, and the content reference set of the second candidate content is a set consisting of references of the second candidate content.
[0122] As an example, content may exist in the form of pages, and content references may be links between pages. Figure 5 , taking the candidate matching content "A2·Xland (basketball player)" of the target participle "Xland" and the candidate matching content "B1·Xland (basketball player)" of the associated participle "Xland" as examples, the content reference set of the candidate matching content "A2·Xland (basketball player)" includes 5 reference contents, namely 5 inbound link pages: "D basketball team", "XX university", "XX league most valuable player", "XX sports brand" and "XX finals most valuable player". Similarly, the content reference set of the candidate matching content "B1·Xland (basketball player)" can be determined.
[0123] See also Figure 4 , the target word "X rand" and the associated word "X musi" both have multiple candidate matching contents, but their corresponding target matching contents have strong semantic relevance, that is, "A2 · X rand (basketball player)" and "B1 · X musi (basketball player)" have strong semantic relevance. And, combined with Figure 5It can be seen that the more common references two candidate matching contents have, the higher the semantic relevance between the two candidate matching contents. Specifically, the more common pages linking to the two candidate matching contents, the higher the semantic relevance between the two candidate matching contents. Therefore, the semantic relevance between the candidate matching contents can be calculated based on the content reference set of the candidate matching contents. Specifically, the step of "calculating the semantic relevance between the candidate matching contents of the target segmentation and the candidate matching contents of the associated segmentation based on the content reference set corresponding to the candidate matching contents of the target segmentation and the content reference set corresponding to the candidate matching contents of the associated segmentation" can include:
[0124] Performing a set operation on the content reference set corresponding to the candidate matching content of the target segmentation and the content reference set corresponding to the candidate matching content of the associated segmentation to obtain a target reference set after the operation, wherein the target reference set includes at least one target reference content, the target reference content has a content reference relationship with the candidate matching content of the target segmentation, and the target reference content has a content reference relationship with the candidate matching content of the associated segmentation;
[0125] According to the target reference set, the semantic relevance between the candidate matching content of the target segmentation and the candidate matching content of the associated segmentation is calculated.
[0126] The set operation is an operation performed on a set. For example, the set operation may include basic operations on sets, such as intersection, union, relative complement, absolute complement, subset, etc.
[0127] As an example, refer to Figure 5 It can be seen that the candidate matching content "A2·X Lant (basketball player)" of the target segmentation "X Lant" has a content reference relationship, and the target reference content having a content reference relationship with the candidate matching content "B1·X Lant (basketball player)" of the associated segmentation "X Mus" is the following three contents: "XX League Most Valuable Player", "XX Sports Brand", and "XX Comprehensive Excavation Most Valuable Player". After determining the target reference content, the target reference set composed of the target reference content can be determined.
[0128] Furthermore, the semantic relevance between the candidate matching contents can be calculated based on the target reference set. In one embodiment, the content can exist in the form of pages, and the content references can be links between pages. The semantic relevance between the candidate matching contents e1 and e2 can be calculated by using the Wikipedia link-based measure (WLM) according to the following formula: :
[0129]
[0130] in, represents the inlink set of page e1, that is, the set of pages that link to the candidate matching content e1; represents the inlink set of page e2, that is, the set of pages linked to the candidate matching content e2; D represents all documents, for example, D can be represented as all documents in Wikipedia.
[0131] Similarly, for the candidate matching content of each to-be-matched word segment in the to-be-processed text, the semantic relevance between any pair of candidate matching content can be calculated, and a relevance network can be constructed based on the calculation results. For example, as a diagram, a line can be used to represent the semantic relevance between each candidate matching content, and the thickness of the line can be adjusted accordingly based on the calculation result of the semantic relevance. For example, the line can be set to be thicker when the semantic relevance is greater. In this way, the semantic relevance between the candidate matching content can be better displayed through the relevance network. As an example, a network can be constructed. Figure 6 The correlation network shown, in which, by calculating the semantic correlation between candidate entities pairwise, it can be determined that the semantic correlation between "A2·X rand (basketball player)", "C2·X shi", and "B1·X mus" is the greatest.
[0132] After the semantic relevance between the candidate matching content of the target segmentation and the candidate matching content of the associated segmentation is calculated, the semantic relevance between the target segmentation and the candidate matching content of the target segmentation can be determined based on the semantic relevance.
[0133] For example, in one embodiment, for multiple candidate matching contents of a target segmentation, the semantic association between the target segmentation and each candidate matching content of the target segmentation can be calculated based on the constructed relevance network. For example, the semantic association can be represented by a semantic association score. Specifically, the semantic association score between the target segmentation and each candidate matching content of the target segmentation can be calculated by a pagerank algorithm to determine the semantic association between the target segmentation and each candidate matching content of the target segmentation.
[0134] For example, in one embodiment, the semantic association between the target word and each candidate matching content of the target word can be calculated based on the generated relevance network. Figure 6 , the target word "X rand" has two candidate matching contents: "A1 · X rand (historian)" and "A2 · X rand (basketball player)", and, Figure 6 The semantic relevance between each candidate match of the target word and each candidate match of the associated word is shown in . In practical applications, the semantic relevance can be embodied in numbers. For example, the semantic relevance score can be used as Figure 6The weight corresponding to each link in is used to mark each link.
[0135] Furthermore, for each candidate matching content of the target participle, the score of each candidate matching content of the target participle can be determined by these weight values, and the score is determined as the semantic association score between the candidate matching content and the target participle. For example, the weights corresponding to each candidate matching content of the target participle in the relevance network can be summed up, and the summed result can be used as the semantic association score between the candidate matching content and the target participle.
[0136] The step of “calculating the semantic similarity between the target word segment and the candidate matching content based on the content description information of the candidate matching content” may be described below.
[0137] It is worth noting that in the present application, there is no restriction on the execution order between the step "calculating the semantic association between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle" and the step "calculating the semantic similarity between the target participle and the candidate matching content based on the content description information of the candidate matching content". For example, they can be executed simultaneously or at different times; and there is no restriction on the order of execution when they are executed at different times.
[0138] The semantic similarity between the target word segmentation and the candidate matching content describes the similarity between the target word segmentation and the candidate matching content at the semantic level. Specifically, in the text to be processed, the target word segmentation can be replaced with the candidate matching content. If the candidate matching content has a high semantic similarity with the target word segmentation, the replaced text to be processed also has a high similarity with the original text to be processed at the semantic level.
[0139] There are many ways to calculate the semantic similarity between the target word segment and the candidate matching content based on the content description information of the candidate matching content. For example, considering that the content description information of the candidate matching content may include the content introduction information and content attribute information of the candidate matching content, and the content introduction information and the content attribute information are information describing the candidate matching content from different granularities, the content introduction information and the content attribute information may be combined, and the semantic similarity between the target word segment and the candidate matching content may be calculated through the combined result. Specifically, the step of "calculating the semantic similarity between the target word segment and the candidate matching content based on the content description information of the candidate matching content" may include:
[0140] Obtaining contextual text information of the target word in the text to be processed;
[0141] Combining the content brief information with the content attribute information to obtain combined content description information;
[0142] Calculate the semantic similarity between the target word segment and the candidate matching content based on the context text information and the combined content description information.
[0143] Among them, the context of the target word segment in the text to be processed is the context of the target word segment in the text to be processed. For example, the text in the text to be processed except the target word segment can be used as the context text of the target word segment in the text to be processed. Correspondingly, the context text information is the relevant information of the context text.
[0144] As an example, the text to be processed can be "Li X started practicing tennis in 1989", where the target word segment can be "Li X", and the context text information of "Li X" can be "started practicing tennis in 1989".
[0145] There are various ways to obtain the context text information of the target word segment in the text to be processed. For example, the text to be processed can be masked. Specifically, the target word segment in the text to be processed can be masked, and in this way, the context text information of the target word segment can be obtained. For example, for the text to be processed "Li X started practicing tennis in 1989", the target word segment "Li X" can be masked with the [MASK] string to obtain the masked context text information: "[MASK] started practicing tennis in 1989".
[0146] Furthermore, there are various ways to combine the content introduction information and the content attribute information of the candidate matching content. For example, considering that the candidate matching content can include multiple content attributes, correspondingly, the content description information can include multiple content attribute information. However, not every content attribute information is helpful or relevant for calculating the semantic similarity between the target word segment and the candidate matching content. Therefore, the content attribute information of the candidate matching content can be filtered to obtain the filtered content attribute information, and then further information combination can be carried out. Specifically, the step of "combining the content introduction information and the content attribute information to obtain the combined content description information" can include:
[0147] Calculate the semantic relevance between the content attribute information and the context text information, where the semantic relevance represents the degree of relevance between the content attribute information and the context text information at the semantic level;
[0148] Based on the calculation result, select the target content attribute information from at least one content attribute information;
[0149] Combine the content introduction information and the target content attribute information to obtain the combined content description information.
[0150] The semantic relevance between the content attribute information and the context text information represents the relevance between the content attribute information and the context text information at the semantic level.
[0151] There are many ways to calculate the semantic relevance. For example, the semantic relevance of the content attribute information and the context text information can be determined by calculating the distance between the two. Specifically, the context text information and the content attribute information can be segmented to obtain the segmented context text information and the segmented content attribute information, wherein the segmented context text information can include at least one context segmentation; the segmented content attribute information can include at least one content attribute segmentation.
[0152] In addition, pre-trained word vectors can be used to vectorize the context segmentation and content attribute segmentation respectively, so as to obtain the context segmentation vector corresponding to the context segmentation and the content attribute segmentation vector corresponding to the content attribute segmentation. Furthermore, the context segmentation vectors can be summed up and averaged, and the vector obtained after processing can be used as the context text vector corresponding to the context text information; the content attribute segmentation vectors can be summed up and averaged, and the vector obtained after processing can be used as the content attribute vector corresponding to the content attribute information.
[0153] In this case, the semantic relevance between the content attribute information and the context text information can be calculated by calculating the vector similarity between the context text vector and the content attribute vector. There are many methods for calculating vector similarity. For example, the vector similarity can be calculated by calculating cosine similarity, Euclidean distance, Manhattan distance, Pearson correlation coefficient, etc. Further, the semantic relevance between the content attribute information and the context text information can be determined based on the calculation result of the vector similarity. For example, the calculation result of the vector similarity can be used as the semantic relevance; for example, based on business needs, the calculation result of the vector similarity can be processed and the processing result can be used as the semantic relevance; and so on.
[0154] After determining the semantic relevance between the content attribute information and the context text information, the target content attribute information can be selected from at least one item of content attribute information based on the calculation result. For example, the content attribute information can be sorted based on the calculation result, and the target content attribute information can be selected from multiple items of content attribute information based on the sorting result. For example, the content attribute information whose semantic relevance meets the preset threshold condition can be selected as the target content attribute information; for another example, a preset proportion of content attribute information can be selected as the target content attribute information based on the sorting result; and so on.
[0155] After the content attribute information of the candidate matching content is screened and the target content attribute information is obtained, the content brief information and the target content attribute information can be combined to obtain the combined content description information. There are many ways to combine the information, for example, the information can be combined by connecting the content brief information and the target content attribute information to obtain the combined content description information.
[0156] Optionally, in order to better characterize the target content attribute information of the candidate matching content, an attribute descriptor may be set for the target content attribute information. Specifically, an identification code (Identity Document, ID) may be assigned to each target content attribute information, and an attribute ID sequence may be added to the text segment from which the current text segment comes. For example, refer to Figure 7 , the text to be processed can be "Li X started practicing tennis in 1989", where the candidate matching content of the target word "Li X" has the content introduction information "Li X's profile..." and the target content attribute information "February 2, 1982" including the birthday attribute information. 1 can be set as the attribute ID of the content introduction information, and 3 can be set as the attribute ID of the birthday attribute information. Then, Figure 7 As described above, corresponding attribute descriptors are added to the content brief information and birthday attribute information of the candidate matching content. It is worth noting that each attribute ID corresponds to a vector, which can be learned along with the model.
[0157] After obtaining the context text information and the combined content description information, the semantic similarity between the target word segmentation and the candidate matching content can be calculated based on the context text information and the combined content description information. There are many ways to calculate, for example, it can be calculated through a trained model. Specifically, the step of "calculating the semantic similarity between the target word segmentation and the candidate matching content based on the context text information and the combined content description information" can include:
[0158] Obtain the trained semantic feature extraction model;
[0159] Through the semantic feature extraction model, feature extraction is performed on the context text information and the combined content description information respectively to obtain context semantic features corresponding to the context text information and content semantic features corresponding to the combined content description information;
[0160] Based on the contextual semantic features and the content semantic features, the semantic similarity between the target word segmentation and the candidate matching content is calculated.
[0161] Among them, the semantic feature extraction model is a model used to extract semantic features from text information. There can be many types of semantic feature extraction models. For example, the Pre-training of Deep Bidirectional Transformers for Language Understanding (BERT) model can be used as a semantic feature extraction model; for example, the Long Short-Term Memory (LSTM) artificial neural network can be used; for example, the Gate Recurrent Unit (GRU) can be used as a semantic feature extraction model; and so on.
[0162] In one embodiment, reference Figure 7 , the BERT model can be used as a semantic feature extraction model, and, Figure 7 The dual-tower model architecture is shown. Specifically, in the left part of the model, the BERT model can be used to extract features from the context text information to obtain context semantic features corresponding to the context text features. Similarly, see Figure 7 , in the right part of the model, the BERT model can be used to extract features of the combined content description information to obtain the content semantic features corresponding to the combined content description information.
[0163] In the present application, the step of “extracting features from the context text information and the combined content description information respectively through a semantic feature extraction model to obtain context semantic features corresponding to the context text information and content semantic features corresponding to the combined content description information” may include:
[0164] The context text information is subjected to feature extraction through a semantic feature extraction model to obtain context semantic features corresponding to the context text information;
[0165] The combined content description information is subjected to feature extraction through a semantic feature extraction model to obtain content semantic features corresponding to the combined content description information.
[0166] As an example, the step of "performing feature extraction on context text information through a semantic feature extraction model to obtain context semantic features corresponding to the context text information" can be taken as an example to further explain the feature extraction process, and the execution method of the step of "performing feature extraction on the combined content description information through a semantic feature extraction model to obtain content semantic features corresponding to the combined content description information" can be referred to accordingly, and this application will not go into details about this.
[0167] In one embodiment, the semantic feature extraction model can be a BERT model. Specifically, the step of "extracting features from the context text information through the semantic feature extraction model to obtain the context semantic features corresponding to the context text information" may include:
[0168] Partition the context text information to obtain the partitioned context text information;
[0169] Perform feature transformation on the partitioned context text information to obtain the context text features corresponding to the partitioned context text information;
[0170] Through the semantic feature extraction model, based on the attention mechanism, extract features from the context text features to obtain the context semantic features corresponding to the context text features.
[0171] Among them, information partitioning is the process of partitioning information into sub-information with smaller granularity. There are various implementation methods for information partitioning. For example, information partitioning can be achieved through word segmentation processing; another example is that information partitioning can be achieved through character segmentation processing; and so on.
[0172] As an example, in this embodiment, information partitioning of the context text information can be achieved by performing character segmentation processing on the context text information. Specifically, referring to Figure 7 , taking the text to be processed as "Li X started practicing tennis in 1989" as an example, where the target word segment can be "Li X", and the target word segment can be masked by [MASK] to obtain the masked context text information. Further, character segmentation processing can be performed on the masked context text information, so that the processed context text information will be split according to the character granularity to obtain the split context text information: "1989 started practicing tennis", thereby obtaining the partitioned context text information.
[0173] Among them, feature transformation is the process of converting information into features. For example, the manifestation form of features can be vectors. Therefore, feature transformation can be the process of converting context text information into corresponding vectors.
[0174] In one embodiment, through pre-trained character vectors, multiple characters in the context text obtained after character segmentation processing can be respectively converted into corresponding character vectors to achieve feature transformation of the partitioned context text information and obtain the context text features corresponding to the partitioned context text information. Further, through the BERT model, based on the attention mechanism, features can be extracted from the context text features to obtain the context semantic features corresponding to the context text features output by the BERT model.
[0175] Optionally, before inputting the context text information into the BERT model, in order to comply with the specifications of the BERT model, special characters "[CLS]" and "[SEP]" may be added in front of and behind the context text information, respectively, so that the context text information can be input into the BERT model and features of the context text information can be extracted through the BERT model.
[0176] After obtaining the context semantic features and the content semantic features, the semantic similarity between the target word segmentation and the candidate matching content can be calculated based on the context semantic features and the content semantic features.
[0177] In one embodiment, the semantic feature extraction model may be a BERT model, and correspondingly, the obtained contextual semantic features and content semantic features are both vectors, so the semantic similarity may be calculated by calculating vector similarity. There may be multiple methods for calculating vector similarity, for example, the vector similarity may be calculated by calculating cosine similarity, Euclidean distance, Manhattan distance, Pearson correlation coefficient, etc.
[0178] As an example, the semantic similarity S can be calculated by referring to the following formula: ,in, Represents contextual semantic features, Represents the semantic features of the content.
[0179] It is worth noting that the above describes how to perform feature extraction through a trained semantic feature extraction model. In the present application, a trained semantic feature extraction model can also be obtained through model training. Specifically, the step of "obtaining a trained semantic feature extraction model" may include:
[0180] Determine a semantic feature extraction model to be trained and a sample data set required for model training, wherein the sample data set includes a sample text, and the sample text includes a sample segmented word to be matched and a sample associated segmented word that has an associated relationship with the sample segmented word at a semantic level;
[0181] Determine a candidate matching content set of the sample word segmentation, wherein the candidate matching content set of the sample word segmentation includes at least one sample candidate matching content of the sample word segmentation;
[0182] Calculate the semantic matching degree between the sample segmentation and the sample candidate matching content;
[0183] Based on the semantic matching degree, the semantic feature extraction model to be trained is trained to obtain a trained semantic feature extraction model.
[0184] The sample data set is a collection of sample data. In the present application, the sample data is sample text, wherein the sample text may include sample segmentations to be matched and sample associated segmentations that have an associated relationship with the sample segmentations at the semantic level.
[0185] Similarly, the method of determining the candidate matching content set of the sample segmentation can refer to the step "determining the candidate matching content set of the target segmentation"; the method of calculating the semantic matching degree between the sample segmentation and the sample candidate matching content can refer to the step "calculating the semantic matching degree between the target segmentation and the candidate matching content", which will not be repeated here.
[0186] As an example, you can refer to the following formula to calculate the loss Loss during model training: , where M is a hyperparameter, represents a negative example, Indicates a positive example.
[0187] The above explains the steps of "calculating the semantic association between the target participle and the associated participle based on the association relationship between the target participle and the associated participle" and the step of "calculating the semantic similarity between the target participle and the candidate matching content based on the content description information of the candidate matching content". The following explains the step of "calculating the semantic matching degree between the target participle and the candidate matching content based on the semantic association and the semantic similarity".
[0188] Specifically, the step of “calculating the semantic matching degree between the target word segmentation and the candidate matching content based on the semantic association degree and the semantic similarity” may include:
[0189] Determining the prior importance of the candidate matching content based on the content reference relationship between the candidate matching content;
[0190] The semantic relevance, semantic similarity, and prior importance are fused to obtain a fusion result;
[0191] Based on the fusion results, the semantic matching degree between the target word segmentation and the candidate matching content is determined.
[0192] Among them, the prior importance is the importance obtained based on previous experience and analysis.
[0193] In one embodiment, the content may exist in the form of pages, and the content references may be links between pages. The prior importance of the candidate matching content may be calculated based on the link relationship between the candidate matching content in the knowledge base. For example, based on the link relationship, the importance of the candidate matching content may be calculated using the pagerank algorithm to obtain a first prior importance.
[0194] For another example, the link probability of the candidate matching content can be calculated based on the link relationship of the candidate matching content in the encyclopedia, and the link probability can be used as the importance of the candidate matching content to obtain the second prior importance. For example, the candidate matching content can be in the form of anchor text in the encyclopedia. For the anchor text "X Dehua", if it appears 100 times in the encyclopedia, 90 times are linked to "A Dehua (film star)", then the link probability of "A Dehua (film star)" is 90 / 100=0.9.
[0195] There are many ways to perform fusion processing. For example, semantic relevance, semantic similarity, and prior importance can be fused through a linear model; or semantic relevance, semantic similarity, and prior importance can be fused through a nonlinear model.
[0196] In one embodiment, a linear model can be selected as the model required for fusion, and the linear model can be trained to obtain a trained model, so that the semantic association, semantic similarity, and prior importance can be fused through the trained model to obtain a fusion result.
[0197] As an example, the semantic association, semantic similarity, first a priori importance, and second a priori importance may be used to train the linear model S according to the following formula: ,in, , ,z, are the independent variables corresponding to semantic relevance, semantic similarity, first a priori importance, and second a priori importance, respectively. , , , Then is the parameter to be trained. And, the loss Loss during the model training process can be calculated by referring to the following formula: , where M is a hyperparameter, represents a negative example, Indicates a positive example.
[0198] After the trained linear model is used to fuse the semantic relevance, semantic similarity, and prior importance, the fusion result can be obtained, and then the semantic matching degree between the target word segmentation and the candidate matching content can be determined based on the fusion result. For example, the calculated fusion result S can be directly used as the semantic matching degree between the target word segmentation and the candidate matching content; for another example, the fusion result S can be processed based on business needs to obtain the processed S', and S' can be used as the semantic matching degree between the target word segmentation and the candidate matching content.
[0199] 104. Based on the semantic matching degree, determine and output the target matching content of the target word from the candidate matching content set.
[0200] Since the calculated semantic matching degree can represent the matching degree between the target word segmentation and the candidate matching content at the semantic level, the candidate matching content can be sorted based on the semantic matching degree, so that the candidate matching content that meets the requirements at the semantic level with the target word segmentation can be selected as the target matching content based on the sorting result. Specifically, the step of "determining and outputting the target matching content of the target word segmentation from the candidate matching content set based on the semantic matching degree" can include:
[0201] Based on the semantic matching degree, the candidate matching contents in the candidate matching content set are sorted;
[0202] Based on the ranking result, the target matching content of the target word is determined and output from the candidate matching content set.
[0203] There are many ways to sort. For example, the semantic matching degree can be directly used as a sorting indicator to sort the candidate matching contents in the candidate matching content set. For another example, the semantic matching degree can be further processed based on business needs, and the processing result can be used as a sorting indicator to sort the candidate matching contents in the candidate matching content set. And so on.
[0204] There are many ways to determine the target matching content based on the sorting results. For example, the candidate matching content whose sorting results meet the preset threshold conditions can be selected as the target matching content; for example, based on the sorting results, a preset proportion of the candidate matching content can be selected as the target matching content; and so on.
[0205] In one embodiment, the text processing-based matching method described in this application can be applied to search, and target matching content can be output based on the sorting results, so that the search client can display search results to users based on the target matching content.
[0206] In another embodiment, the text processing-based matching method described in the present application can be applied to a question-answering system, and the target matching content can be output based on the sorting results, so that the question-answering system client can generate a dialogue based on the target matching content and interact with the user in question-answering.
[0207] In another embodiment, the text processing-based matching method described in the present application can be applied to a recommendation system, and the target matching content can be output based on the sorting results, so that the sorting system can generate recommendation information based on the target matching content and recommend it to the user.
[0208] As can be seen from the above, this embodiment can obtain a text to be processed, wherein the text to be processed includes a target participle to be matched, and an associated participle that has an associated relationship with the target participle at a semantic level; determine a candidate matching content set for the target participle, wherein the candidate matching content set includes at least one candidate matching content for the target participle, and each candidate matching content has corresponding content description information; based on the association relationship between the target participle and the associated participle, and the content description information of the candidate matching content, calculate the semantic matching degree between the target participle and the candidate matching content; based on the semantic matching degree, determine and output the target matching content of the target participle from the candidate matching content set.
[0209] The scheme can calculate the semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and its associated segmentation. In this way, when the scheme performs content matching on the target segmentation, it is not only focused on the target segmentation, but also takes into account that there is a strong semantic correlation between the target segmentation and its associated segmentation in the text to be processed, and the scheme performs content matching on the target segmentation based on the semantic correlation. Therefore, this helps to improve the matching efficiency and matching accuracy. In addition, when the associated segmentation of the target segmentation is also the segmentation to be matched in the text to be processed, that is, when there are multiple segmentations to be matched in the text to be processed, the scheme performs content matching by combining the semantic correlation between multiple segmentations to be matched. In this way, compared with independently performing content matching on each segmentation to be matched in the text to be processed in turn, the scheme can simultaneously calculate the semantic correlation between multiple segmentations to be matched in the text to be processed, so that the content matching efficiency for multiple segmentations to be matched in the text to be processed is further improved.
[0210] According to the method described in the above embodiment, the following will give an example to further illustrate in detail.
[0211] In this embodiment, the text processing-based matching device integrated in a server and a terminal is taken as an example for explanation. The server can be a single server or a server cluster composed of multiple servers; the terminal can be a mobile phone, a tablet computer, a laptop computer and other devices.
[0212] like Figure 8 As shown in FIG. 1 , a matching method based on text processing is shown in FIG. 1 . The specific process is as follows:
[0213] 201. The terminal sends a text to be processed to a server, wherein the text to be processed includes a target segmented word to be matched and an associated segmented word that has an associated relationship with the target segmented word at a semantic level.
[0214] In one embodiment, the text processing-based matching method described in the present application may be applied to search, a search client may be running on the terminal, and the terminal may obtain the text to be processed input by the user through the search client.
[0215] As an example, the text to be processed input by the user may be “What are the common protocols in computers?”, wherein the text to be processed includes the target segmentation word “protocol” to be matched, and the associated segmentation word “computer” that has an associated relationship with the target segmentation word at the semantic level.
[0216] After the terminal obtains the to-be-processed text input by the user through the search client, the terminal can send the to-be-processed text to the server.
[0217] 202. The server obtains the text to be processed sent by the terminal.
[0218] 203. The server determines a candidate matching content set for the target word segment, wherein the candidate matching content set includes at least one candidate matching content for the target word segment, and each candidate matching content has corresponding content description information.
[0219] The server may determine a candidate matching content set for the target word segment “protocol”, wherein the candidate matching content set may include at least one candidate matching content for the target word segment “protocol”, for example, the candidate matching content may include “network protocol”, “user protocol”, “Chinese word ‘protocol’”, etc. Moreover, each candidate matching content has corresponding content description information, for example, the content description information may include content introduction information and content attribute information.
[0220] 204. The server calculates the semantic matching degree between the target segmented word and the candidate matching content based on the association relationship between the target segmented word and the associated segmented word and the content description information of the candidate matching content.
[0221] The server may calculate the semantic matching degree between the target word segmentation and each candidate matching content based on the association relationship between the target word segmentation “protocol” and the associated word segmentation “computer” and the content description information of each candidate matching content.
[0222] For example, the server may calculate the semantic association between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and the associated segmentation, wherein the semantic association represents the degree of association between the target segmentation and the candidate matching content at the semantic level. In addition, the server may calculate the semantic similarity between the target segmentation and the candidate matching content based on the content description information of the candidate matching content, wherein the semantic similarity represents the degree of similarity between the target segmentation and the candidate matching content at the semantic level. Furthermore, the server may calculate the semantic matching degree between the target segmentation and the candidate matching content based on the semantic association and the semantic similarity.
[0223] 205. The server determines and outputs target matching content of the target word segmentation from the candidate matching content set based on the semantic matching degree.
[0224] For example, the server may determine that the target matching content is “network protocol” from the candidate matching content set based on the semantic matching degree between the target word “protocol” and each candidate matching content, and output the target matching content.
[0225] 206. The terminal obtains the target matching content output by the server.
[0226] Correspondingly, the terminal can obtain the target matching content output by the server, and generate search results based on the target matching content, so that the search results can be displayed to the user in the search client.
[0227] As can be seen from the above, the embodiment of the present application can calculate the semantic matching degree of the target participle and the candidate matching content based on the association relationship between the target participle and its associated participle. In this way, when the scheme performs content matching on the target participle, it is not only focused on the target participle, but also takes into account that there is a strong semantic correlation between the target participle and its associated participle in the text to be processed, and the scheme is based on the semantic correlation to perform content matching on the target participle, so this helps to improve the matching efficiency and matching accuracy. In addition, when the associated participle of the target participle is also a participle to be matched in the text to be processed, that is, when there are multiple participles to be matched in the text to be processed, the scheme is to perform content matching by combining the semantic correlation between multiple participles to be matched, so that compared with independently performing content matching on each participle to be matched in the text to be processed in turn, the scheme can simultaneously calculate the semantic correlation between multiple participles to be matched in the text to be processed, so that the content matching efficiency for multiple participles to be matched in the text to be processed is further improved.
[0228] In order to better implement the above method, the embodiment of the present application also provides a text processing-based matching device, wherein the text processing-based matching device can be integrated in a server or a terminal. The server can be a single server or a server cluster composed of multiple servers; the terminal can be a mobile phone, a tablet computer, a laptop computer, and other devices.
[0229] For example, Fig. 9 As shown, the text processing-based matching device may include an acquisition unit 301, a determination unit 302, a calculation unit 303 and an output unit 304, as follows:
[0230] An acquisition unit 301 is used to acquire a text to be processed, wherein the text to be processed includes a target segmentation to be matched and an associated segmentation that has an associated relationship with the target segmentation at a semantic level;
[0231] A determination unit 302 is configured to determine a candidate matching content set for the target word segment, wherein the candidate matching content set includes at least one candidate matching content for the target word segment, and each candidate matching content has corresponding content description information;
[0232] A calculation unit 303 is used to calculate the semantic matching degree between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle and the content description information of the candidate matching content;
[0233] The output unit 304 is configured to determine and output the target matching content of the target word segment from the candidate matching content set based on the semantic matching degree.
[0234] In one embodiment, reference Fig.10 , the calculation unit 303 may include:
[0235] The first calculation subunit 3031 may be used to calculate the semantic association between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle, wherein the semantic association represents the degree of association between the target participle and the candidate matching content at the semantic level;
[0236] The second calculation subunit 3032 may be used to calculate the semantic similarity between the target word segment and the candidate matching content based on the content description information of the candidate matching content, wherein the semantic similarity represents the degree of similarity between the target word segment and the candidate matching content at the semantic level;
[0237] The third calculation subunit 3033 may be configured to calculate the semantic matching degree between the target word segment and the candidate matching content based on the semantic association degree and the semantic similarity degree.
[0238] In one embodiment, the first calculation subunit 3031 may be used to:
[0239] Determine a candidate matching content set of the associated participle, wherein the candidate matching content set of the associated participle includes at least one candidate matching content of the associated participle; calculate a semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the association relationship between the target participle and the associated participle, wherein the semantic relevance represents a degree of relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle at a semantic level; determine a semantic relevance between the target participle and the candidate matching content of the target participle based on the semantic relevance.
[0240] In one embodiment, the first calculation subunit 3031 may be specifically used for:
[0241] Determine a content reference set for each of the candidate matching contents, wherein the content reference set includes at least one referenced content of the candidate matching content, and the referenced content has a content reference relationship with the candidate matching content; and calculate the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the content reference set corresponding to the candidate matching content of the target participle and the content reference set corresponding to the candidate matching content of the associated participle.
[0242] In one embodiment, the first calculation subunit 3031 may be specifically used for:
[0243] A set operation is performed on a content reference set corresponding to the candidate matching content of the target participle and a content reference set corresponding to the candidate matching content of the associated participle to obtain a target reference set after operation, wherein the target reference set includes at least one target reference content, the target reference content has a content reference relationship with the candidate matching content of the target participle, and the target reference content has a content reference relationship with the candidate matching content of the associated participle; based on the target reference set, a semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle is calculated.
[0244] In one embodiment, the content description information includes content brief information and content attribute information of the candidate matching content; the second calculation subunit 3032 may be used to:
[0245] Acquire contextual text information of the target word segment in the text to be processed; combine the content introduction information with the content attribute information to obtain combined content description information; and calculate the semantic similarity between the target word segment and the candidate matching content based on the contextual text information and the combined content description information.
[0246] In one embodiment, the second calculation subunit 3032 may be specifically used for:
[0247] Calculate the semantic relevance between the content attribute information and the context text information, wherein the semantic relevance represents the degree of relevance between the content attribute information and the context text information at the semantic level; based on the calculation result, select target content attribute information from the at least one content attribute information; combine the content brief introduction information with the target content attribute information to obtain combined content description information.
[0248] In one embodiment, the second calculation subunit 3032 may be specifically used for:
[0249] Acquire a trained semantic feature extraction model; perform feature extraction on the context text information and the combined content description information respectively through the semantic feature extraction model to obtain context semantic features corresponding to the context text information and content semantic features corresponding to the combined content description information; calculate the semantic similarity between the target word segmentation and the candidate matching content based on the context semantic features and the content semantic features.
[0250] In one embodiment, the second calculation subunit 3032 may be specifically used for:
[0251] The context text information is divided to obtain divided context text information; the divided context text information is subjected to feature conversion to obtain context text features corresponding to the divided context text information; and the context text features are subjected to feature extraction based on the attention mechanism through the semantic feature extraction model to obtain context semantic features corresponding to the context text features.
[0252] In one embodiment, the second calculation subunit 3032 may be specifically used for:
[0253] Determine a semantic feature extraction model to be trained and a sample data set required for model training, wherein the sample data set includes a sample text, and the sample text includes a sample segmentation to be matched and a sample associated segmentation that has an associated relationship with the sample segmentation at a semantic level; determine a candidate matching content set for the sample segmentation, wherein the candidate matching content set for the sample segmentation includes at least one sample candidate matching content for the sample segmentation; calculate the semantic matching degree between the sample segmentation and the sample candidate matching content; and based on the semantic matching degree, perform model training on the semantic feature extraction model to be trained to obtain a trained semantic feature extraction model.
[0254] In one embodiment, the third calculation subunit 3033 may be used to:
[0255] Based on the content reference relationship between the candidate matching contents, the prior importance of the candidate matching contents is determined; the semantic association, the semantic similarity, and the prior importance are fused to obtain a fusion result; based on the fusion result, the semantic matching degree between the target word segment and the candidate matching contents is determined.
[0256] In one embodiment, reference Fig.11 , the output unit 304 may include:
[0257] The sorting subunit 3041 may be used to sort the candidate matching contents in the candidate matching content set based on the semantic matching degree;
[0258] The output subunit 3042 may be configured to determine and output the target matching content of the target word from the candidate matching content set based on the ranking result.
[0259] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.
[0260] As can be seen from the above, in the text processing-based matching device of this embodiment, the acquisition unit 301 acquires the text to be processed, wherein the text to be processed includes the target segmentation to be matched, and the associated segmentation that has an associated relationship with the target segmentation at the semantic level; the determination unit 302 determines the candidate matching content set of the target segmentation, wherein the candidate matching content set includes at least one candidate matching content of the target segmentation, and each candidate matching content has corresponding content description information; the calculation unit 303 calculates the semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and the associated segmentation, and the content description information of the candidate matching content; the output unit 304 determines and outputs the target matching content of the target segmentation from the candidate matching content set based on the semantic matching degree.
[0261] The scheme can calculate the semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and its associated segmentation. In this way, when the scheme performs content matching on the target segmentation, it is not only focused on the target segmentation, but also takes into account that there is a strong semantic correlation between the target segmentation and its associated segmentation in the text to be processed, and the scheme performs content matching on the target segmentation based on the semantic correlation. Therefore, this helps to improve the matching efficiency and matching accuracy. In addition, when the associated segmentation of the target segmentation is also the segmentation to be matched in the text to be processed, that is, when there are multiple segmentations to be matched in the text to be processed, the scheme performs content matching by combining the semantic correlation between multiple segmentations to be matched. In this way, compared with independently performing content matching on each segmentation to be matched in the text to be processed in turn, the scheme can simultaneously calculate the semantic correlation between multiple segmentations to be matched in the text to be processed, so that the content matching efficiency for multiple segmentations to be matched in the text to be processed is further improved.
[0262] In addition, the embodiment of the present application also provides a computer device, which can be a server or a terminal. Fig.12 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0263] The computer device may include a memory 401 having one or more computer-readable storage media, a processor 402 having one or more processing cores, and a power supply 403. Those skilled in the art will appreciate that Fig.12 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0264] The memory 401 can be used to store software programs and modules, and the processor 402 executes various functional applications and data processing by running the software programs and modules stored in the memory 401. The memory 401 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device (such as audio data, a phone book, etc.), etc. In addition, the memory 401 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 401 may also include a memory controller to provide the processor 402 and the input unit 603 with access to the memory 401.
[0265] The processor 402 is the control center of the computer device, which uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 401, and calling data stored in the memory 401, it executes various functions of the computer device and processes data, thereby performing an overall detection of the mobile phone. Optionally, the processor 402 may include one or more processing cores; preferably, the processor 402 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 402.
[0266] The computer device also includes a power supply 403 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 402 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 403 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0267] Although not shown, the computer device may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the processor 402 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 401 according to the following instructions, and the processor 402 will run the application programs stored in the memory 401 to implement various functions, as follows:
[0268] Acquire a text to be processed, wherein the text to be processed includes a target segmentation to be matched, and an associated segmentation that has an associated relationship with the target segmentation at a semantic level; determine a candidate matching content set for the target segmentation, wherein the candidate matching content set includes at least one candidate matching content for the target segmentation, and each candidate matching content has corresponding content description information; calculate a semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and the associated segmentation, and the content description information of the candidate matching content; and determine and output a target matching content for the target segmentation from the candidate matching content set based on the semantic matching degree.
[0269] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0270] As can be seen from the above, the computer device of this embodiment can calculate the semantic matching degree of the target segmentation and the candidate matching content based on the association relationship between the target segmentation and its associated segmentation. In this way, when the computer device performs content matching on the target segmentation, it is not only focused on the target segmentation, but also takes into account that there is a strong semantic correlation between the target segmentation and its associated segmentation in the text to be processed, and the computer device performs content matching on the target segmentation based on the semantic correlation. Therefore, this helps to improve the matching efficiency and matching accuracy. In addition, when the associated segmentation of the target segmentation is also a segmentation to be matched in the text to be processed, that is, when there are multiple segmentations to be matched in the text to be processed, the computer device performs content matching by combining the semantic correlation between multiple segmentations to be matched. In this way, compared with independently performing content matching on each segmentation to be matched in the text to be processed in turn, the computer device can simultaneously calculate the semantic correlation between multiple segmentations to be matched in the text to be processed, so that the content matching efficiency for multiple segmentations to be matched in the text to be processed is further improved.
[0271] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0272] To this end, an embodiment of the present application provides a storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any text processing-based matching method provided in the embodiment of the present application. For example, the instructions can execute the following steps:
[0273] Acquire a text to be processed, wherein the text to be processed includes a target segmentation to be matched, and an associated segmentation that has an associated relationship with the target segmentation at a semantic level; determine a candidate matching content set for the target segmentation, wherein the candidate matching content set includes at least one candidate matching content for the target segmentation, and each candidate matching content has corresponding content description information; calculate a semantic matching degree between the target segmentation and the candidate matching content based on the association relationship between the target segmentation and the associated segmentation, and the content description information of the candidate matching content; and determine and output a target matching content for the target segmentation from the candidate matching content set based on the semantic matching degree.
[0274] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0275] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0276] Since the instructions stored in the storage medium can execute the steps in any text processing-based matching method provided in the embodiments of the present application, the beneficial effects that can be achieved by any text processing-based matching method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0277] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the above-mentioned text-based matching aspects.
[0278] The above is a detailed introduction to a text processing-based matching method, device, computer equipment and storage medium provided in an embodiment of the present application. 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 of the present application and its core idea; at the same time, for 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 matching method based on text processing, characterized in that: include: Acquire a text to be processed, wherein the text to be processed includes a target segmentation to be matched and an associated segmentation that has an associated relationship with the target segmentation at a semantic level; Determine a candidate matching content set for the target word segment, wherein the candidate matching content set includes at least one candidate matching content for the target word segment, and each candidate matching content has corresponding content description information; Based on the association relationship between the target participle and the associated participle, and the content description information of the candidate matching content, calculating the semantic matching degree between the target participle and the candidate matching content, including: based on the association relationship between the target participle and the associated participle, calculating the semantic association degree between the target participle and the candidate matching content, wherein the semantic association degree represents the degree of association between the target participle and the candidate matching content at the semantic level; based on the content description information of the candidate matching content, calculating the semantic similarity between the target participle and the candidate matching content, wherein the semantic similarity represents the degree of similarity between the target participle and the candidate matching content at the semantic level; based on the semantic association degree and the semantic similarity, calculating the semantic matching degree between the target participle and the candidate matching content; Based on the semantic matching degree, determining and outputting target matching content of the target word from the candidate matching content set; The step of calculating the semantic association between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle includes: determining a candidate matching content set of the associated participle, wherein the candidate matching content set of the associated participle includes at least one candidate matching content of the associated participle; calculating the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the association relationship between the target participle and the associated participle, wherein the semantic relevance represents the degree of relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle at the semantic level; and determining the semantic association between the target participle and the candidate matching content of the target participle based on the semantic relevance.
2. The text processing-based matching method according to claim 1, characterized in that: Calculating the semantic relevance between candidate matching content of the target participle and candidate matching content of the associated participle based on the association relationship between the target participle and the associated participle includes: Determine a content reference set for each candidate matching content, wherein the content reference set includes at least one referenced content of the candidate matching content, and the referenced content has a content reference relationship with the candidate matching content; Based on the content reference set corresponding to the candidate matching content of the target participle and the content reference set corresponding to the candidate matching content of the associated participle, the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle is calculated.
3. The text processing-based matching method according to claim 2, characterized in that: Calculating the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the content reference set corresponding to the candidate matching content of the target participle and the content reference set corresponding to the candidate matching content of the associated participle, including: Performing a set operation on the content reference set corresponding to the candidate matching content of the target participle and the content reference set corresponding to the candidate matching content of the associated participle to obtain a target reference set after operation, wherein the target reference set includes at least one target reference content, the target reference content has a content reference relationship with the candidate matching content of the target participle, and the target reference content has a content reference relationship with the candidate matching content of the associated participle; The semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle is calculated according to the target reference set.
4. The text processing-based matching method according to claim 1, characterized in that: The content description information includes content brief information and content attribute information of the candidate matching content; Calculating the semantic similarity between the target word segment and the candidate matching content based on the content description information of the candidate matching content includes: Obtaining contextual text information of the target word in the text to be processed; Combining the content brief introduction information with the content attribute information to obtain combined content description information; Based on the context text information and the combined content description information, the semantic similarity between the target word segment and the candidate matching content is calculated.
5. The text processing-based matching method according to claim 4, characterized in that: The content description information includes at least one item of content attribute information of the candidate matching content; The content brief introduction information and the content attribute information are combined to obtain combined content description information, including: Calculating the semantic relevance between the content attribute information and the context text information, wherein the semantic relevance represents the relevance degree between the content attribute information and the context text information at the semantic level; Based on the calculation result, selecting target content attribute information from the at least one item of content attribute information; The content brief introduction information and the target content attribute information are combined to obtain combined content description information.
6. The text processing-based matching method according to claim 4, characterized in that: Calculating the semantic similarity between the target word segment and the candidate matching content based on the context text information and the combined content description information includes: Obtain the trained semantic feature extraction model; By using the semantic feature extraction model, feature extraction is performed on the context text information and the combined content description information respectively to obtain context semantic features corresponding to the context text information and content semantic features corresponding to the combined content description information; Based on the context semantic features and the content semantic features, the semantic similarity between the target word segment and the candidate matching content is calculated.
7. The text processing-based matching method according to claim 6, characterized in that: The context text information is subjected to feature extraction by the semantic feature extraction model to obtain context semantic features corresponding to the context text information, including: Performing information segmentation on the context text information to obtain segmented context text information; Performing feature conversion on the divided context text information to obtain context text features corresponding to the divided context text information; The semantic feature extraction model is used to extract the context text features based on the attention mechanism to obtain context semantic features corresponding to the context text features.
8. The text processing-based matching method according to claim 6, characterized in that: Get the trained semantic feature extraction model, including: Determine a semantic feature extraction model to be trained and a sample data set required for model training, wherein the sample data set includes a sample text, and the sample text includes a sample segmentation to be matched and a sample associated segmentation having an associated relationship with the sample segmentation at a semantic level; Determine a candidate matching content set of the sample word segmentation, wherein the candidate matching content set of the sample word segmentation includes at least one sample candidate matching content of the sample word segmentation; Calculating the semantic matching degree between the sample segmentation and the sample candidate matching content; Based on the semantic matching degree, model training is performed on the semantic feature extraction model to be trained to obtain a trained semantic feature extraction model.
9. The text processing-based matching method according to claim 1, characterized in that: Calculating the semantic association between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle includes: Determining the prior importance of the candidate matching contents based on the content reference relationship between the candidate matching contents; fusing the semantic relevance, the semantic similarity, and the prior importance to obtain a fusion result; Based on the fusion result, the semantic matching degree between the target word segment and the candidate matching content is determined.
10. The text processing-based matching method according to claim 1, characterized in that: Based on the semantic matching degree, determining and outputting the target matching content of the target word from the candidate matching content set includes: sorting the candidate matching contents in the candidate matching content set based on the semantic matching degree; Based on the ranking result, the target matching content of the target word segment is determined and output from the candidate matching content set.
11. A matching device based on text processing, characterized in that: include: An acquisition unit, configured to acquire a text to be processed, wherein the text to be processed includes a target segmentation to be matched and an associated segmentation that has an associated relationship with the target segmentation at a semantic level; A determination unit, configured to determine a candidate matching content set of the target word segment, wherein the candidate matching content set includes at least one candidate matching content of the target word segment, and each candidate matching content has corresponding content description information; A calculation unit, configured to calculate the semantic matching degree between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle, and the content description information of the candidate matching content, the calculation unit comprising: a first calculation subunit, configured to calculate the semantic association degree between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle, wherein the semantic association degree represents the association degree between the target participle and the candidate matching content at the semantic level; a second calculation subunit, configured to calculate the semantic similarity between the target participle and the candidate matching content based on the content description information of the candidate matching content, wherein the semantic similarity represents the similarity degree between the target participle and the candidate matching content at the semantic level; a third calculation subunit, configured to calculate the semantic matching degree between the target participle and the candidate matching content based on the semantic association degree and the semantic similarity; An output unit, configured to determine and output a target matching content of the target word from the candidate matching content set based on the semantic matching degree; The step of calculating the semantic association between the target participle and the candidate matching content based on the association relationship between the target participle and the associated participle includes: determining a candidate matching content set of the associated participle, wherein the candidate matching content set of the associated participle includes at least one candidate matching content of the associated participle; calculating the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle based on the association relationship between the target participle and the associated participle, wherein the semantic relevance represents the degree of relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle at the semantic level; and determining the semantic association between the target participle and the candidate matching content of the target participle based on the semantic relevance.
12. The text processing-based matching device according to claim 11, characterized in that: The first computing subunit is specifically configured to: Determine a content reference set for each candidate matching content, wherein the content reference set includes at least one referenced content of the candidate matching content, and the referenced content has a content reference relationship with the candidate matching content; Based on the content reference set corresponding to the candidate matching content of the target participle and the content reference set corresponding to the candidate matching content of the associated participle, the semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle is calculated.
13. The text processing-based matching device according to claim 12, characterized in that: The first computing subunit is specifically configured to: Performing a set operation on the content reference set corresponding to the candidate matching content of the target participle and the content reference set corresponding to the candidate matching content of the associated participle to obtain a target reference set after operation, wherein the target reference set includes at least one target reference content, the target reference content has a content reference relationship with the candidate matching content of the target participle, and the target reference content has a content reference relationship with the candidate matching content of the associated participle; The semantic relevance between the candidate matching content of the target participle and the candidate matching content of the associated participle is calculated according to the target reference set.
14. The text processing-based matching device according to claim 11, characterized in that: The content description information includes content brief information and content attribute information of the candidate matching content; the second calculation subunit is used to: Obtaining contextual text information of the target word in the text to be processed; Combining the content brief introduction information with the content attribute information to obtain combined content description information; Based on the context text information and the combined content description information, the semantic similarity between the target word segment and the candidate matching content is calculated.
15. The text processing-based matching device according to claim 14, characterized in that: The content description information includes at least one content attribute information of the candidate matching content, and the second calculation subunit is specifically configured to: Calculating the semantic relevance between the content attribute information and the context text information, wherein the semantic relevance represents the relevance degree between the content attribute information and the context text information at the semantic level; Based on the calculation result, selecting target content attribute information from the at least one item of content attribute information; The content brief introduction information and the target content attribute information are combined to obtain combined content description information.
16. The text processing-based matching device according to claim 14, characterized in that: The second computing subunit is specifically configured to: Obtain the trained semantic feature extraction model; By using the semantic feature extraction model, feature extraction is performed on the context text information and the combined content description information respectively to obtain context semantic features corresponding to the context text information and content semantic features corresponding to the combined content description information; Based on the context semantic features and the content semantic features, the semantic similarity between the target word segment and the candidate matching content is calculated.
17. The text processing-based matching device according to claim 16, characterized in that: The second computing subunit is specifically configured to: Performing information segmentation on the context text information to obtain segmented context text information; Performing feature conversion on the divided context text information to obtain context text features corresponding to the divided context text information; The semantic feature extraction model is used to extract the context text features based on the attention mechanism to obtain context semantic features corresponding to the context text features.
18. The text processing-based matching device according to claim 16, characterized in that: The second computing subunit is specifically configured to: Determine a semantic feature extraction model to be trained and a sample data set required for model training, wherein the sample data set includes a sample text, and the sample text includes a sample segmentation to be matched and a sample associated segmentation having an associated relationship with the sample segmentation at a semantic level; Determine a candidate matching content set of the sample word segmentation, wherein the candidate matching content set of the sample word segmentation includes at least one sample candidate matching content of the sample word segmentation; Calculating the semantic matching degree between the sample segmentation and the sample candidate matching content; Based on the semantic matching degree, model training is performed on the semantic feature extraction model to be trained to obtain a trained semantic feature extraction model.
19. The text processing-based matching device according to claim 11, characterized in that: The third computing subunit is configured to: Determining the prior importance of the candidate matching contents based on the content reference relationship between the candidate matching contents; fusing the semantic relevance, the semantic similarity, and the prior importance to obtain a fusion result; Based on the fusion result, the semantic matching degree between the target word segment and the candidate matching content is determined.
20. The text processing-based matching device according to claim 11, characterized in that: The output unit comprises: A sorting subunit, configured to sort the candidate matching contents in the candidate matching content set based on the semantic matching degree; The output subunit is used to determine and output the target matching content of the target word segmentation from the candidate matching content set based on the sorting result.
21. An electronic device, characterized in that: It comprises a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to execute the operations in the text processing-based matching method according to any one of claims 1 to 10.
22. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the text processing-based matching method according to any one of claims 1 to 10.
23. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in the text processing-based matching method described in any one of claims 1 to 10.
Citation Information
Patent Citations
Entity linking method and device and storage medium
CN110569496A