Method, device, computer equipment and medium for determining the relationship between words and their hyponyms

By using the relationship determination model trained based on the word database in natural language processing, word vectors are processed to determine the word relationship confidence, which solves the problem of difficulty in determining the confidence of word relationships that are not included in the database, and improves the accuracy of natural language processing.

CN112287070BActive Publication Date: 2024-09-06TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011281974.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-16
Publication Date
2024-09-06
Estimated Expiration
2040-11-16

AI Technical Summary

Technical Problem

In existing natural language processing technology, when the co-occurrence frequency of words in a word database is used to determine the hyponym relationship of words, it is difficult to accurately determine the confidence level of the relationship for words not included in the database, leading to recognition errors.

Method used

A relationship determination model based on word database training is used to determine the relationship confidence between two words through word vector processing. The word database and model are combined to ensure the accuracy of the relationship confidence.

Benefits of technology

It improves the accuracy of the relationship determination model, ensures that the relationship confidence between two words can be accurately determined regardless of the situation, and enhances the accuracy of natural language processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112287070B
    Figure CN112287070B
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, computer equipment and medium for determining the hyponymy of words, and belongs to the field of computer technology. The method includes: obtaining two words, querying the two words from a word database, the word database includes multiple words and the relationship confidence between each two words in the multiple words, in response to the fact that at least one of the two words does not exist in the word database, calling a relationship determination model trained based on the word database, processing the word vectors of the two words, and determining the relationship confidence between the two words. The accuracy of the trained relationship determination model is improved by the words and relationship confidence in the word database, and when determining the relationship confidence between the two words, the word database and the relationship determination model are combined to ensure that the relationship confidence between the two words can be determined under any circumstances, so as to ensure the accuracy of the relationship confidence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method, apparatus, computer equipment and medium for determining the hyponym-hypernym relationship of words. Background Art

[0002] With the development of computer technology, the application of natural language processing is becoming more and more extensive. In natural language processing, words with a hierarchical relationship in a sentence are usually considered, such as "dog" and "animal", "science fiction movie" and "movie", etc., to enhance the understanding of natural language.

[0003] In the related art, the relationship confidence between the two words is usually determined based on the co-occurrence frequency of the two words in a word database, that is, the frequency of their co-occurrence. The relationship confidence is used to indicate the possibility that the two words have a hyponymous relationship.

[0004] In the above method, the relationship confidence is determined only by the co-occurrence frequency of two words in the word database. However, for some words that are not included in the word database, it is impossible to determine whether they have a hyponym relationship, which easily leads to recognition errors in natural language processing. Summary of the invention

[0005] The embodiments of the present application provide a method, device, computer equipment and medium for determining the hyponymy relationship of a word, which can improve the accuracy of the relationship confidence. The technical solution is as follows:

[0006] In one aspect, a method for determining a hyponym relationship of a word is provided, the method comprising:

[0007] Get two words;

[0008] Querying the two words from a word database, wherein the word database includes a plurality of words and a confidence level of a relationship between each two words in the plurality of words;

[0009] In response to at least one of the two words not existing in the word database, calling a relationship determination model trained based on the word database, processing the word vectors of the two words, and determining a confidence level of the relationship between the two words;

[0010] The relationship confidence is used to indicate the possibility that the two words have a hyponymous relationship.

[0011] In another aspect, a device for determining a hyponym relationship of a word is provided, the device comprising:

[0012] A word acquisition module, used to acquire two words;

[0013] A word query module, used for querying the two words from a word database, wherein the word database includes a plurality of words and a confidence level of a relationship between each two words in the plurality of words;

[0014] A first confidence determination module is configured to, in response to at least one of the two words not existing in the word database, call a relationship determination model trained based on the word database, process the word vectors of the two words, and determine the confidence of the relationship between the two words;

[0015] The relationship confidence is used to indicate the possibility that the two words have a hyponymous relationship.

[0016] In a possible implementation, the word determination module includes:

[0017] a word determination unit, configured to determine a plurality of words included in the plurality of pairs of words based on the plurality of pairs of words;

[0018] A matrix construction unit, configured to construct a co-occurrence frequency matrix based on the multiple words and the co-occurrence frequencies corresponding to each pair of words, wherein each element in the co-occurrence frequency matrix is ​​used to represent the co-occurrence frequency of the corresponding two words;

[0019] The matrix decomposition unit is used to decompose the co-occurrence frequency matrix to determine the co-occurrence frequency corresponding to every two words in the multiple words.

[0020] In another possible implementation, the device further includes:

[0021] A sample determination module, used to use the words in the word database as sample words, and use the confidence of the relationship between every two sample words as the supervision value corresponding to the every two sample words;

[0022] The model training module is used to iteratively train the relationship determination model according to the word vectors and corresponding supervision values ​​of each two sample words.

[0023] In another possible implementation, the model training module includes:

[0024] A confidence determination unit, configured to, for any iteration round in the multiple iteration rounds, call the relationship determination model, process the word vectors of any two sample words, and determine the confidence of the predicted relationship between the any two sample words;

[0025] A loss value determination unit, configured to determine a loss value of the relationship determination model according to the predicted relationship confidence and the supervision values ​​corresponding to any two sample words;

[0026] A parameter adjustment unit is used to adjust the parameters of the relationship determination model according to the loss value. In another possible implementation, the loss value determination unit is used to determine the square of the difference between the predicted relationship confidence and the supervision value as the loss value.

[0027] In another possible implementation, the device further includes:

[0028] The word storage module is used for storing the two words in a hyponymy database in response to the relationship confidence between the two words being greater than the reference confidence, wherein the hyponymy database includes words with a hyponymy relationship.

[0029] In another possible implementation, the device further includes:

[0030] A first receiving module, configured to receive a search request, wherein the search request carries a target word;

[0031] The word query module is further used to query the target word from the hyponymy database;

[0032] The retrieval module is used to retrieve information related to the target word based on the target word and the corresponding hypernym in response to finding the hypernym corresponding to the target word.

[0033] In another possible implementation, the device further includes:

[0034] A second receiving module is used to receive a classification request, wherein the classification request carries target text information;

[0035] A keyword extraction module, used to extract keywords from the target text information to obtain keywords in the target text information;

[0036] The word query module is further used to query the keyword from the upper and lower relationship database;

[0037] The tag determination module is used to determine a corresponding type tag for the target text information according to the hypernym corresponding to the keyword in response to the query.

[0038] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the method for determining the hyponymy of words as described in the above aspects.

[0039] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the operations performed in the method for determining the hyponymy of words as described in the above aspects.

[0040] In another aspect, a computer program product or a computer program is provided, the computer program product or the computer program comprising a computer program code, the computer program code being stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device implements the operations performed in the method for determining the hyponymy relationship of a word as described in the above aspect.

[0041] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0042] The method, apparatus, computer equipment and medium provided in the embodiments of the present application improve the accuracy of the trained relationship determination model through the words and relationship confidences in the word database, and when determining the relationship confidence between two words, the word database and the relationship determination model are combined to ensure that the relationship confidence between the two words can be determined under any circumstances, thereby ensuring the accuracy of the relationship confidence. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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 embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 It is a structural diagram of an implementation environment provided by an embodiment of the present application;

[0045] Figure 2 It is a flow chart of a method for determining the hyponymy relationship of a word provided in an embodiment of the present application;

[0046] Figure 3 It is a flow chart of a method for determining the hyponymy relationship of a word provided in an embodiment of the present application;

[0047] Figure 4 This is a flow chart of determining the hyponymy relationship of words provided by an embodiment of the present application;

[0048] Figure 5 It is a schematic diagram of determining the hyponymy relationship of words provided in an embodiment of the present application;

[0049] Figure 6 It is a structural schematic diagram of a device for determining a hyponymy relationship of a word provided in an embodiment of the present application;

[0050] Figure 7 It is a structural schematic diagram of a device for determining a hyponymy relationship of a word provided in an embodiment of the present application;

[0051] Figure 8 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;

[0052] Fig. 9 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0054] The terms "at least one", "a plurality", "each", and "any" used in this application include one, two, or more than two, a plurality includes two or more than two, each refers to each of the corresponding plurality, and any refers to any one of the plurality. For example, a plurality of words includes three words, and each refers to each of the three words, and any refers to any one of the three words, which can be the first, the second, or the third.

[0055] 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.

[0056] 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.

[0057] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.

[0058] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.

[0059] The solution provided in the embodiment of the present application is based on artificial intelligence natural language processing and machine learning technology, which can train a relationship determination model, and use the trained relationship prediction model to determine the hierarchical relationship between words.

[0060] The method for determining the hyponym relationship of a word provided in the embodiment of the present application can be used in a computer device, and optionally, the computer device is a terminal or a server. Optionally, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal is a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this.

[0061] Figure 1 is a schematic diagram of a structure of an implementation environment provided by an embodiment of the present application, such as Figure 1 As shown, the system includes a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, which is not limited in the present application.

[0062] The terminal 101 is used to provide the server with words whose hyponymy relationship is to be determined, and send the words whose hyponymy relationship is to be determined to the server 102 . The server 102 is used to determine the hyponymy relationship between any two words sent by the terminal 101 .

[0063] The method provided in the embodiments of the present application can be used in a variety of scenarios.

[0064] For example, in the text classification scenario:

[0065] By extracting multiple words from a corpus and using the method provided in an embodiment of the present application, the relationship confidence between each two words in the multiple words is determined, and two words whose relationship confidence is greater than a reference confidence are used as hyponymous and hyponymous relationship words, a hyponymous and hyponymous relationship database is constructed, and by performing keyword extraction on any text information, the hypernym corresponding to the keyword is determined through the keyword and the hyponymous and hyponymous relationship database, and a corresponding type label is assigned to the text information according to the hypernym.

[0066] For another example, in the information retrieval scenario:

[0067] By extracting multiple words from a corpus and adopting the method provided in an embodiment of the present application, the relationship confidence between each two words in the multiple words is determined, and two words whose relationship confidence is greater than a reference confidence are used as hyponymy and hyponymy words, a hyponymy and hyponymy database is constructed, and the hypernymy word corresponding to the target word is determined according to the target word carried in the received search request and the hyponymy and hyponymy database. Subsequently, information related to the target word is retrieved through the target word and the corresponding hypernymy word to ensure the accuracy of the retrieved information.

[0068] The following examples are brief descriptions of the principles of this application. Figure 2 is a flowchart of a method for determining the hyponymy relationship of a word provided in an embodiment of the present application, which is applied to a computer device, such as Figure 2 As shown, the method includes:

[0069] 201. The computer device obtains two words.

[0070] Among them, the two words obtained are words whose hyponymy relationship is to be determined. The two words may have a hyponymy relationship or may not have a hyponymy relationship. The confidence of the relationship between the two words needs to be determined later.

[0071] 202. The computer device searches for the two words from a word database.

[0072] The word database includes a plurality of words and the relationship confidence between each two words in the plurality of words, and the relationship confidence is used to indicate the possibility that the two words have a hyponymous relationship. The two words are queried from the word database to determine whether the two words exist in the word database.

[0073] 203. In response to at least one of the two words not existing in the word database, the computer device calls a relationship determination model trained based on the word database, processes the word vectors of the two words, and determines the confidence of the relationship between the two words.

[0074] The relationship determination model is used to determine the confidence of the relationship between any two words. The relationship determination model is obtained by training multiple words in the word database and the confidence of the relationship between each two words. The word vector is used to represent the vector of the corresponding word, and different words have different word vectors.

[0075] By inputting the word vectors of the two words whose hyponymy relationship is to be determined into the relationship determination model, the relationship determination model outputs the relationship confidence between the two words. Subsequently, the relationship confidence between the two words can be used to determine whether there is a hyponymy relationship between the two words.

[0076] The method provided in the embodiment of the present application improves the accuracy of the trained relationship determination model through the words and relationship confidences in the word database, and when determining the relationship confidence between two words, it combines the word database and the relationship determination model to ensure that the relationship confidence between the two words can be determined under any circumstances, thereby ensuring the accuracy of the relationship confidence.

[0077] The following embodiment is described by taking the process of first constructing a word database and then determining a relationship using a relationship determination model trained based on the word database as an example. Figure 3 is a flowchart of a method for determining the hyponymy relationship of a word provided in an embodiment of the present application, which is applied to a computer device, such as Figure 3 As shown, the method includes:

[0078] 301. The computer device extracts words from the text information in the corpus to obtain multiple pairs of words and the co-occurrence frequency corresponding to each pair of words.

[0079] Among them, the corpus is a database for providing corpus, for example, the corpus is English Wikipedia and Gigaword (a corpus), etc. The corpus includes text information, and the text information is stored in the corpus as corpus. The co-occurrence frequency is used to indicate the number of times the corresponding two words appear simultaneously in the text information. Optionally, the text information includes multiple sentences, and in the multiple sentences, the number of sentences that include the two words at the same time is determined as the co-occurrence frequency of the two words. For example, for any two words, including the two words in a sentence means that the two words appear together once, and the co-occurrence frequency of the two words can be determined through the multiple sentences in the text information.

[0080] In one possible implementation, step 301 includes: based on the reference grammatical condition, determining reference sentences in the text information that meet the reference grammatical condition, performing word extraction on the obtained multiple reference sentences, and obtaining multiple pairs of words and the co-occurrence frequency corresponding to each pair of words.

[0081] The reference grammatical condition is used to indicate the grammatical condition satisfied by the words with a hyponymy relationship. Since there may be words with a hyponymy relationship in the sentence satisfying the reference grammatical condition, multiple pairs of words with a hyponymy relationship and the co-occurrence frequency corresponding to each pair of words can be obtained by extracting words from the sentence satisfying the reference grammatical condition.

[0082] For example, the reference grammatical condition indicates "A includes B", and the text information includes "animals include dogs, rabbits, etc.", then "animals include dogs, rabbits, etc." in the text information satisfies the reference sentence of the reference grammatical condition, and word extraction is performed on the reference sentence, namely, "animals" and "dogs", "animals" and "rabbits" are obtained.

[0083] Optionally, the reference grammatical condition can be provided in the form of a template. Optionally, the reference grammatical condition is a Hearst pattern (a grammatical template), and the Hearst pattern includes multiple templates, through which the sentences in the text information are traversed to determine the reference sentence that satisfies the Hearst pattern. The multiple templates included in the Hearst pattern are shown in Table 1.

[0084] Table 1

[0085]

[0086]

[0087] Optionally, the process of determining the co-occurrence frequency includes: for any pair of words, traversing the text information, determining the number of sentences including the pair of words, and taking the number of the first sentences including the pair of words as the co-occurrence frequency of the pair of words.

[0088] Optionally, the process of determining the co-occurrence frequency includes: the reference grammatical condition is multiple reference grammatical conditions, for any pair of words, traversing the text information, determining multiple first sentences including the pair of words, determining the number of reference grammatical conditions satisfied by each first sentence, and determining the sum of the numbers of reference grammatical conditions satisfied by the multiple sentences as the co-occurrence frequency of the pair of words.

[0089] Optionally, the process of determining the co-occurrence frequency includes: the reference grammatical condition is multiple reference grammatical conditions, for any pair of words, traversing the text information, determining multiple first sentences including the pair of words, determining the number of reference grammatical conditions satisfied by each first sentence, and determining the sum of the number of multiple first sentences and the number of reference grammatical conditions satisfied by each sentence as the co-occurrence frequency of the pair of words.

[0090] 302. The computer device determines, based on the multiple pairs of words and the co-occurrence frequencies corresponding to each pair of words, multiple words included in the multiple pairs of words and the co-occurrence frequencies corresponding to every two words in the multiple words.

[0091] Since multiple pairs of words may include the same words or different words, by counting the multiple pairs of words, it is possible to obtain the multiple words included in the multiple pairs of words and the co-occurrence frequency corresponding to each two words.

[0092] For example, multiple pairs of words include: "animal" and "dog", "animal" and "cat", "movie" and "science fiction movie", etc., then the multiple words obtained include: "animal", "dog", "cat", "movie", "science fiction movie", and the co-occurrence frequency corresponding to each two words.

[0093] In one possible implementation, step 302 includes: based on multiple pairs of words, determining multiple words included in the multiple pairs of words, constructing a co-occurrence frequency matrix based on the multiple words and the co-occurrence frequencies corresponding to each pair of words, decomposing the co-occurrence frequency matrix, and determining the co-occurrence frequencies corresponding to every two words in the multiple words.

[0094] Among them, each element in the co-occurrence frequency matrix is ​​used to represent the co-occurrence frequency of the corresponding two words. Since the co-occurrence frequency matrix is ​​constructed by multiple pairs of words and the co-occurrence frequencies corresponding to each pair of words, multiple words are obtained through the multiple pairs of words, and each element in the co-occurrence frequency matrix is ​​used to indicate the co-occurrence frequency between two words in the multiple words. However, in the co-occurrence frequency matrix, except for the co-occurrence frequencies corresponding to the multiple pairs of words that have been determined, the co-occurrence frequencies between other words in the co-occurrence frequency matrix are unknown, that is, the constructed co-occurrence frequency matrix includes unknown elements. For example, the co-occurrence frequencies corresponding to the obtained multiple words are: the co-occurrence frequency corresponding to word 1 and word 2 is 5, and the co-occurrence frequency corresponding to word 3 and word 4 is 6. In the constructed co-occurrence frequency matrix, the co-occurrence frequency corresponding to word 1 and word 3 is unknown, the co-occurrence frequency corresponding to word 1 and word 4 is unknown, the co-occurrence frequency corresponding to word 2 and word 3 is unknown, and the co-occurrence frequency corresponding to word 2 and word 4 is unknown. Therefore, the co-occurrence frequency matrix includes unknown elements. By decomposing the co-occurrence frequency matrix to determine the values ​​of the unknown elements in the co-occurrence frequency matrix, the co-occurrence frequencies corresponding to every two words in the multiple words are determined.

[0095] Optionally, when constructing a co-occurrence frequency matrix, multiple words are used as row words and column words respectively, and the co-occurrence frequencies corresponding to each row word and each column word constitute the co-occurrence frequency matrix, and the elements corresponding to any row word and any column word are the co-occurrence frequencies corresponding to the row word and the column word. Optionally, the process of decomposing the co-occurrence frequency matrix includes: determining the co-occurrence frequencies corresponding to every two words in the multiple words by performing singular value decomposition on the co-occurrence frequency matrix. Among them, the singular value decomposition is SVD (Singular Value Decomposition).

[0096] In one possible implementation, step 302 includes: based on multiple pairs of words, determining multiple words included in the multiple pairs of words, and determining the co-occurrence frequency corresponding to each two words according to the co-occurrence frequency corresponding to the multiple words and each pair of words and the contextual relationship between the multiple words in the text information.

[0097] Optionally, a hyperbolic embedding method is used to determine the co-occurrence frequency of every two words through the contextual relationship of multiple words in the text information.

[0098] 303. The computer device determines the confidence level of the relationship between each two words based on the co-occurrence frequency of each two words.

[0099] For any two words, the higher the co-occurrence frequency of the two words, the greater the possibility that the two words have a hierarchical relationship, and the lower the co-occurrence frequency of the two words, the smaller the possibility that the two words have a hierarchical relationship. After determining the co-occurrence frequency corresponding to each two words in a plurality of words, the confidence of the relationship between each two words is determined according to the co-occurrence frequency corresponding to each two words.

[0100] In one possible implementation, step 303 includes: for any two words, determining the frequency of occurrence of each word in the text information of the corpus, and determining the confidence of the relationship between the two words based on the co-occurrence frequency of the two words and the occurrence frequency of each word in the two words.

[0101] Optionally, for any two words, the occurrence frequency of each word, the co-occurrence frequency p(x, y) of the two words, and the confidence score Score(x, y) of the relationship between the two words satisfy the following relationship:

[0102]

[0103] Among them, x and y represent words respectively; p(x) represents the frequency of occurrence of word x in the text information of the corpus; p(y) represents the frequency of occurrence of word y in the text information of the corpus; p(x, y) represents the co-occurrence frequency of a word and word y; Score(x, y) represents the confidence of the relationship between word x and word y, and the value of the relationship confidence Score(x, y) is greater than or equal to 0.

[0104] 304. The computer device constructs a word database based on multiple words and the confidence of the relationship between every two words.

[0105] After obtaining a plurality of words and the confidence of the relationship between each two words in the plurality of words, the word database is constructed so that the confidence of the relationship between two words included in the word database can be determined by querying the word database later.

[0106] 305. The computer device obtains two words.

[0107] Among them, the two words obtained are words whose hypernym-hyponym relationship is to be determined. In the embodiment of the present application, the hypernym-hyponym relationship is used to represent the relationship between words. For example, the two words are: "dog" and "animal", and "dog" belongs to a type of "animal", that is, there is a hypernym relationship between "dog" and "animal", and "animal" contains "dog". After the two words are obtained, the confidence of the relationship between the two words is determined based on the word database and the relationship determination model.

[0108] 306. The computer device queries two words from a word database.

[0109] The words whose hyponymy relationship is to be determined are searched from the word database to determine whether the two words exist in the word database.

[0110] 307. In response to at least one of the two words not existing in the word database, the computer device calls a relationship determination model trained based on the word database, processes the word vectors of the two words, and determines the confidence of the relationship between the two words.

[0111] The relationship determination model is used to determine the confidence of the relationship between any two words. The relationship determination model is obtained by training multiple words in the word database and the confidence of the relationship between every two words.

[0112] When at least one of the two words does not exist in the word database, it means that the relationship confidence between the two words cannot be queried based on the word database. Therefore, the relationship confidence between the two words is determined by calling the trained relationship determination model.

[0113] In one possible implementation, before step 307, the method includes: encoding two words to obtain word vectors of the two words. The word vectors of the words are obtained by distributed representation and are used to represent the corresponding words. When encoding the words, the word vectors of the words are obtained by mapping the words into a distributed vector space.

[0114] Optionally, an encoding model is called to encode the two words to obtain word vectors of the two words. The encoding model is BERT (Bidirectional Encoder Representations from Transformers), RoBERTa (a Robustly Optimized BERT Pretraining Approach), word2vec (word to vector), context2vec (context to vector), etc.

[0115] In one possible implementation, before step 307, the method includes: for any target word, querying text information in the corpus, determining multiple reference sentences containing the target word, encoding the multiple reference sentences, obtaining a sentence vector for each reference sentence, and aggregating the sentence vectors of the multiple reference sentences to obtain a word vector for the target word.

[0116] When encoding a sentence into a sentence vector, a sequence encoding algorithm can be used for encoding, for example, the sequence encoding algorithm is RNN (Recurrent Neural Network) or Transformers (a coding model).

[0117] After determining multiple reference sentences, the process of obtaining the sentence vector of each reference sentence includes the following three methods:

[0118] In the first method, the reference sentence includes multiple words: for any reference sentence, each word in the reference sentence is encoded to obtain initial word vectors of the multiple words, and the ratio between the sum of the initial word vectors of the multiple words and the number of the multiple words is determined as the sentence vector of the reference sentence.

[0119] Optionally, the sentence vector of the reference sentence satisfies the following relationship:

[0120]

[0121] Among them, D h represents the sentence vector of the reference sentence D; n represents the number of words included in the reference sentence D, and n is a positive integer not less than 1; j represents the sequence number of the word in the reference sentence D; c j Represents the initial word vector of the jth word in the reference sentence D.

[0122] The second method is that the reference sentence includes multiple words: for any reference sentence, each word in the reference sentence is encoded to obtain the initial word vectors of the multiple words, and the initial word vectors of the multiple words are weighted summed to obtain the sentence vector of the reference sentence.

[0123] Optionally, the sentence vector of the reference sentence satisfies the following relationship:

[0124]

[0125] Where D h represents the sentence vector of the reference sentence D; n represents the number of words included in the reference sentence D, and n is a positive integer not less than 1; j represents the sequence number of the word in the reference sentence D; α j represents the weight of the jth word in the reference sentence D; c j W represents the initial word vector of the jth word in the reference sentence D; a is the adjustment parameter, the adjustment parameter W a is a constant; T is used to represent the transpose of the matrix.

[0126] The third method: for any reference sentence, the sentence vector of the reference sentence is determined according to the contextual relationship of the reference sentence in the text information in the corpus.

[0127] Optionally, the sentence vector of the reference sentence satisfies the following relationship:

[0128]

[0129] Among them, D h The sentence vector representing the reference sentence D; Represents the vector of the sentence before the reference sentence D in the text information; Represents the vector of the sentence following the reference sentence D in the text information.

[0130] After determining the sentence vectors of the multiple reference sentences, the process of aggregating the sentence vectors of the multiple reference sentences includes the following two methods:

[0131] The first method is to determine the word vector of the target word by the ratio between the sum of the sentence vectors of multiple reference sentences and the number of the multiple reference sentences.

[0132] Optionally, the word vector of the target word and the sentence vector of the reference sentence satisfy the following relationship:

[0133]

[0134] Among them, x h represents the word vector of the target word x; M(x) represents the set of reference sentences including the target word x; |M(x)| represents the number of reference sentences including the target word x; D h represents the sentence vector of the reference sentence D; MLP(D h ) represents the sentence vector D h The sentence vector after conversion.

[0135] The second method is to perform weighted summation on the sentence vectors of multiple reference sentences to obtain the word vector of the target word.

[0136] Optionally, the sentence vector of the reference sentence satisfies the following relationship:

[0137]

[0138] Among them, x h represents the word vector of the target word x; M(x) represents the set of reference sentences including the target word x; i represents the sequence number of the reference sentence; |M(x)| represents the number of reference sentences including the target word x; β i represents the weight of the i-th reference statement; W represents the sentence vector of the i-th reference sentence; b is the adjustment parameter, the adjustment parameter W b is a constant; T is used to represent the transpose of the matrix.

[0139] In a possible implementation, after step 306, the method further includes: in response to the existence of two words in the word database, obtaining the confidence of the relationship between the two words in the word database.

[0140] Since the word database includes multiple words and the relationship confidence between each two words, if the two words exist in the word database, the relationship confidence between the two words in the word database can be directly obtained without calling the relationship determination model to determine the relationship confidence between the two words.

[0141] Optionally, the multiple words in the word database and the confidence of the relationship between each two words are stored in the form of a matrix. When the word database includes two words whose hyponymy relationship is to be determined, the confidence of the relationship between the two words can be determined according to the matrix in the word database.

[0142] It should be noted that the embodiment of the present application is explained by taking the process of first constructing a word database and then using a relationship determination model trained based on the word database as an example. After the word database is constructed, when determining the relationship confidence between other two words, there is no need to construct the word database again. The words whose hyponym and hyponym relationships are to be determined can be directly queried from the constructed word database.

[0143] In a possible implementation, after step 307, the method further includes: in response to the relationship confidence of the two words being greater than the reference confidence, the two words are stored in a hierarchical relationship database. The reference confidence is an arbitrary value, for example, the reference confidence is 0.7 or 0.9, etc. The hierarchical relationship database includes words with a hierarchical relationship, and in the hierarchical relationship database, multiple words are stored in correspondence with the hierarchical relationship. When the relationship confidence of the two words is greater than the reference confidence, it means that the two words have a hierarchical relationship, and the two words are added to the hierarchical relationship database.

[0144] Through the method provided in the embodiment of the present application, a hyponymy database can be constructed, and words with hyponymy relationships can be added to the hyponymy database, and the hyponymy database can be subsequently applied to various scenarios.

[0145] Taking the text information classification scenario as an example, based on the upper and lower relationship database provided by the embodiment of the present application, the text information can be classified. The text information classification process includes the following steps 3711-3714:

[0146] 3711. The computer device receives a classification request, which carries target text information.

[0147] 3712. The computer device extracts keywords from the target text information to obtain keywords from the target text information.

[0148] 3713. The computer device searches for keywords from the hierarchical relationship database.

[0149] 3714. In response to querying a hypernym corresponding to the keyword, the computer device determines a corresponding type tag for the target text information based on the hypernym corresponding to the keyword, so that the text information can be subsequently recommended to matching users according to the type tag of the text information.

[0150] Taking the text information classification scenario as an example, based on the upper and lower relationship database provided in the embodiment of the present application, the relevant information of the word can be retrieved to improve the accuracy of the retrieved relevant information. The information retrieval process includes the following steps 3721-3723:

[0151] 3721. The computer device receives a search request, and the search request carries a target word.

[0152] Among them, the target word is the word to be searched.

[0153] 3722. The computer device searches for the target word from the hypernym-hypernym relationship database.

[0154] 3723. In response to finding a hypernym corresponding to the target word, the computer device retrieves information related to the target word based on the target word and the corresponding hypernym.

[0155] For example, if the target word is "dog" and the superordinate word found is "animal", then "dog" and "animal" are used as search conditions to retrieve information related to the target word.

[0156] Through the hypernymy database, searches are performed according to the target words to be searched and the corresponding hypernyms, which improves the accuracy of the retrieved information.

[0157] In addition, before calling the relationship determination model, the relationship determination model needs to be trained. The process of training the relationship determination model includes the following steps 308-311:

[0158] 308. The computer device uses the words in the word database as sample words, and uses the confidence of the relationship between every two sample words as the supervision value corresponding to every two sample words.

[0159] Since the word database includes multiple words, each word is taken as a sample word, and the confidence degree of the relationship between any two words is the confidence degree of the relationship between the two sample words.

[0160] 309. For any iteration round in multiple iteration rounds, the computer device calls the relationship determination model, processes the word vectors of any two sample words, and determines the confidence of the predicted relationship between any two sample words.

[0161] The predicted relationship confidence is the relationship confidence output by the relationship determination model. This step is similar to the above step 307 and will not be described in detail here.

[0162] 310. The computer device determines the loss value of the relationship determination model based on the predicted relationship confidence and the supervision value corresponding to any two sample words.

[0163] Among them, the loss value is used to indicate the inaccuracy of the relationship determination model. The larger the loss value, the higher the inaccuracy of the relationship determination model, and the smaller the loss value, the lower the inaccuracy of the relationship determination model.

[0164] Since the predicted relationship confidence is obtained by calling the relationship determination model, and the supervision value is the true relationship confidence between the two sample words, the loss value of the relationship determination model can be determined through the predicted relationship confidence and the supervision value, so that the parameters of the relationship determination model can be adjusted according to the loss value later.

[0165] In one possible implementation, step 310 includes: determining the square of the difference between the predicted relationship confidence and the supervision value as the loss value.

[0166] Optionally, the predicted relationship confidence g(x h ,y h ; φ), the supervision value f(x, y) and the loss value l(x, y; φ) satisfy the following relationship:

[0167] l(x, y; φ) = [g(x h ,y h ;φ)-f(x,y)] 2

[0168] Among them, x and y represent words respectively; φ represents the model parameter of the relationship determination model; x h The word vector representing word x; x y Represents the word vector of word y; g(x h ,y h ; φ) represents the confidence of the predicted relationship between word x and word y; f(x, y) represents the supervision value of word x and word y.

[0169] 311. The computer device adjusts the parameters of the relationship determination model based on the loss value.

[0170] The parameters of the relationship determination model are adjusted according to the loss value to reduce the loss value or to make the loss value tend to be stable, thereby improving the accuracy of the relationship determination model.

[0171] In a possible implementation, during the iterative training of the relationship determination model, in response to the loss value being less than a reference threshold, the training of the relationship determination model is stopped. The reference threshold is an arbitrary value, for example, the reference threshold is 0.3 or 0.2. When the loss value of the relationship determination model is less than the reference threshold, it indicates that the accuracy of the current relationship determination model has met the requirements, and therefore, the training of the relationship determination model is stopped.

[0172] In a possible implementation, during the iterative training of the relationship determination model, in response to the number of iterations reaching a reference number, the training of the relationship determination model is stopped. The reference number is an arbitrary value, for example, the reference number is 10 or 20. When the relationship determination model is iteratively trained, if the number of iterations of training the relationship determination model reaches the reference number, it means that the accuracy of the current relationship determination model has met the requirements, and therefore, the training of the relationship determination model is stopped.

[0173] It should be noted that, with regard to the conditions for stopping training of the relationship determination model, the embodiments of the present application only use the above two methods as examples for explanation. In addition to the above two methods, there are other conditions for stopping training, which are not limited in the present application.

[0174] It should be noted that the embodiment of the present application adjusts the relationship determination model through the loss value, while in another embodiment, there is no need to execute steps 309-311, and other methods can be adopted to iteratively train the relationship determination model based on the word vectors of every two sample words and the corresponding supervision values.

[0175] In addition, after the relationship determination model is trained and obtained by the method provided in the embodiment of the present application, the relationship determination model is processed by model distillation to simplify the relationship determination model, so that the simplified relationship determination model not only ensures the accuracy of the output relationship confidence, but also improves the processing speed. By deploying the simplified relationship determination model online, the processing speed is increased when determining the relationship confidence between any two words online, thereby improving the throughput of the online system.

[0176] When performing model distillation on the relationship determination model, TinyBERT (a model distillation method) and Roberta-Tiny (a Robustly Optimized BERT Pretraining Approach Tiny, a robustly optimized BERT pretraining model distillation method) can be used.

[0177] The method provided in the embodiment of the present application improves the accuracy of the trained relationship determination model through the words and relationship confidences in the word database, and when determining the relationship confidence between two words, it combines the word database and the relationship determination model to ensure that the relationship confidence between the two words can be determined under any circumstances, thereby ensuring the accuracy of the relationship confidence.

[0178] Furthermore, the relationship determination model is trained by using a plurality of words in the word database and the confidence of the relationship between every two words as training samples to improve the accuracy of the relationship determination model.

[0179] Furthermore, during the training process of the relationship determination model, the parameters of the relationship determination model are adjusted according to the loss value of the relationship determination model to ensure the accuracy of the trained relationship determination model.

[0180] Based on the above embodiment, a flow chart of determining the hyponymy relationship of words is provided, such as Figure 4 As shown, the process includes the following steps 401-404:

[0181] 401. Based on reference grammatical conditions, multiple pairs of words and the co-occurrence frequencies corresponding to each pair of words are extracted from the text information in the corpus, and the multiple words included in the multiple pairs of words and the relationship confidence between each two words in the multiple words are determined by the co-occurrence frequencies corresponding to the multiple pairs of words and each pair of words. A word database is constructed based on the multiple words and the relationship confidence between each two words, and the multiple words constitute a word set 1.

[0182] 402. All words included in the text information in the corpus are combined into word set 2, where word set 2 includes the words in word set 1.

[0183] 403. The distributed semantic model is trained by using the multiple words in the word database and the confidence of the relationship between each two words. Based on the trained distributed semantic model, the confidence of the relationship between other words included in word set 2 except the words in word set 1 can be determined.

[0184] Among them, the distributed semantic model is a relationship determination model.

[0185] 404. After obtaining any two words, if the two words belong to word set 1, the confidence of the relationship between the two words can be obtained through the word database. If word set 1 does not include at least one of the two words, the two words are encoded by the context encoder to obtain word vectors of the two words, and the distributed semantic model is called to process the word vectors of the two words to obtain the confidence of the relationship between the two words.

[0186] Based on the method provided in the embodiment of the present application, a method for determining a hyponymous relationship based on a template and distributed semantic complementarity is provided. A word database is constructed through a Hearst template, and the distributed semantic model is trained based on the constructed word database. The relationship confidence between words in the word database constructed through the Hearst template is highly accurate, but only the relationship confidence between words included in the word database can be determined through the word database; the relationship confidence between any two words can be obtained through the distributed semantic model. Therefore, through the method for determining a hyponymous relationship based on a template and distributed semantic complementarity, the Hearst template and the distributed semantic model are combined, so that the two methods are complementary to each other and form a complementary framework. The complementary framework formed can not only ensure the accuracy of the relationship confidence, but also determine the relationship confidence between any two words, thereby improving the scope of application of the framework.

[0187] like Figure 5 As shown, word pairs are extracted from text information in a corpus through a Hearst template, and the obtained word pairs include: (bird, animal), (mammal, animal), (cat, mammal), (dog mammal, etc.), and a word database is constructed. If the relationship confidence between two words (dog, animal) is determined, the relationship confidence between the (dog, animal) can be determined through the word database constructed by the Hearst template; if the relationship confidence between two words (crocodile, animal) is determined, the word database does not include the two words, then the relationship confidence between the two words is determined through the relationship determination model.

[0188] Figure 6 is a schematic diagram of the structure of a device for determining the hyponymy relationship of a word provided in an embodiment of the present application, such as Figure 6 As shown, the device comprises:

[0189] A word acquisition module 601 is used to acquire two words;

[0190] A word query module 602 is used to query two words from a word database, where the word database includes a plurality of words and a confidence level of a relationship between each two words in the plurality of words;

[0191] A first confidence determination module 603 is used for, in response to at least one of the two words not existing in the word database, calling a relationship determination model trained based on the word database, processing the word vectors of the two words, and determining the confidence of the relationship between the two words;

[0192] Among them, the relationship confidence is used to indicate the possibility that two words have a hyponymous relationship.

[0193] In one possible implementation, Figure 7 As shown, the device also includes:

[0194] The word extraction module 604 is used to extract words from the text information in the corpus to obtain multiple pairs of words and the co-occurrence frequency corresponding to each pair of words;

[0195] A word determination module 605 is used to determine the co-occurrence frequencies of the multiple words included in the multiple word pairs and each two words in the multiple words based on the multiple word pairs and the co-occurrence frequencies corresponding to each word pair;

[0196] A second confidence determination module 606, configured to determine the confidence of the relationship between each two words based on the co-occurrence frequency corresponding to each two words;

[0197] The database construction module 607 is used to construct a word database based on multiple words and the confidence of the relationship between every two words.

[0198] In another possible implementation, Figure 7 As shown, the word extraction module 604 includes:

[0199] The sentence determination unit 6401 is used to determine a reference sentence satisfying the reference grammatical condition in the text information based on the reference grammatical condition, where the reference grammatical condition is used to indicate a grammatical condition satisfied by words having a hyponymous relationship;

[0200] The word extraction unit 6402 is used to extract words from the obtained multiple reference sentences to obtain multiple pairs of words and the co-occurrence frequency corresponding to each pair of words.

[0201] In another possible implementation, Figure 7 As shown, the word determination module 605 includes:

[0202] A word determination unit 6501, configured to determine, based on the plurality of pairs of words, a plurality of words included in the plurality of pairs of words;

[0203] A matrix construction unit 6502 is used to construct a co-occurrence frequency matrix based on the co-occurrence frequencies of the multiple words and each pair of words, wherein each element in the co-occurrence frequency matrix is ​​used to represent the co-occurrence frequency of the corresponding two words;

[0204] The matrix decomposition unit 6503 is used to decompose the co-occurrence frequency matrix to determine the co-occurrence frequency corresponding to every two words in the multiple words.

[0205] In another possible implementation, Figure 7 As shown, the device also includes:

[0206] A sample determination module 608 is used to use words in the word database as sample words, and use the confidence of the relationship between every two sample words as the supervision value corresponding to every two sample words;

[0207] The model training module 609 is used to iteratively train the relationship determination model according to the word vectors and corresponding supervision values ​​of every two sample words.

[0208] In another possible implementation, Figure 7 As shown, the model training module 609 includes:

[0209] A confidence determination unit 6901 is used to call the relationship determination model for any iteration round in multiple iteration rounds, process the word vectors of any two sample words, and determine the confidence of the predicted relationship between any two sample words;

[0210] A loss value determination unit 6902, used to determine the loss value of the relationship determination model according to the predicted relationship confidence and the supervision values ​​corresponding to any two sample words;

[0211] The parameter adjustment unit 6903 is used to adjust the parameters of the relationship determination model according to the loss value.

[0212] In another possible implementation, the loss value determination unit 6902 is used to determine the square of the difference between the prediction relationship confidence and the supervision value as the loss value.

[0213] In another possible implementation, Figure 7 As shown, the device also includes:

[0214] The word storage module 610 is used to store the two words in a hyponymy database in response to the relationship confidence between the two words being greater than the reference confidence, wherein the hyponymy database includes words having a hyponymy relationship.

[0215] In another possible implementation, Figure 7 As shown, the device also includes:

[0216] A first receiving module 611 is used to receive a search request, where the search request carries a target word;

[0217] The word query module 602 is also used to query the target word from the upper and lower relationship database;

[0218] The search module 612 is used to retrieve information related to the target word based on the target word and the corresponding hypernym in response to finding the hypernym corresponding to the target word.

[0219] In another possible implementation, Figure 7 As shown, the device also includes:

[0220] The second receiving module 613 is used to receive a classification request, where the classification request carries target text information;

[0221] The keyword extraction module 614 is used to extract keywords from the target text information to obtain keywords in the target text information;

[0222] The word query module 602 is also used to query keywords from the upper and lower relationship database;

[0223] The tag determination module 615 is used to determine a corresponding type tag for the target text information according to the hypernym corresponding to the keyword in response to the query.

[0224] It should be noted that the device for determining the hierarchical relationship of words provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for determining the hierarchical relationship of words provided in the above embodiment and the method for determining the hierarchical relationship of words belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0225] An embodiment of the present application also provides a computer device, which includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the method for determining the hyponymy relationship of words in the above embodiment.

[0226] Optionally, the computer device is provided as a terminal. Figure 8The structure block diagram of a terminal 800 provided by an exemplary embodiment of the present application is shown. The terminal 800 may be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 800 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.

[0227] The terminal 800 includes a processor 801 and a memory 802 .

[0228] The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0229] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one computer program, which is used to be executed by the processor 801 to implement the method for determining the hyponymy relationship of words provided in the method embodiment of the present application.

[0230] In some embodiments, the terminal 800 may further optionally include: a peripheral device interface 803 and at least one peripheral device. The processor 801, the memory 802 and the peripheral device interface 803 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 803 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807 and a power supply 809.

[0231] The peripheral device interface 803 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0232] The radio frequency circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 804 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 804 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 804 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0233] The display screen 805 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos and any combination thereof. When the display screen 805 is a touch display screen, the display screen 805 also has the ability to collect touch signals on the surface or above the surface of the display screen 805. The touch signal can be input to the processor 801 as a control signal for processing. At this time, the display screen 805 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 805 can be one, set on the front panel of the terminal 800; in other embodiments, the display screen 805 can be at least two, respectively set on different surfaces of the terminal 800 or in a folding design; in other embodiments, the display screen 805 can be a flexible display screen, set on the curved surface or folding surface of the terminal 800. Even, the display screen 805 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 805 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0234] The camera assembly 806 is used to capture images or videos. Optionally, the camera assembly 806 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 806 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0235] The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 801 for processing, or input them into the radio frequency circuit 804 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 800. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 801 or the radio frequency circuit 804 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 807 may also include a headphone jack.

[0236] The power supply 809 is used to power various components in the terminal 800. The power supply 809 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 809 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0237] In some embodiments, the terminal 800 further includes one or more sensors 810 , including but not limited to: an acceleration sensor 811 , a gyroscope sensor 812 , a pressure sensor 813 , an optical sensor 815 , and a proximity sensor 816 .

[0238] The acceleration sensor 811 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 800. For example, the acceleration sensor 811 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 801 can control the display screen 805 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 811. The acceleration sensor 811 can also be used to collect game or user motion data.

[0239] The gyroscope sensor 812 can detect the body direction and rotation angle of the terminal 800, and the gyroscope sensor 812 can cooperate with the acceleration sensor 811 to collect the user's 3D actions on the terminal 800. The processor 801 can implement the following functions based on the data collected by the gyroscope sensor 812: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0240] The pressure sensor 813 can be set on the side frame of the terminal 800 and / or the lower layer of the display screen 805. When the pressure sensor 813 is set on the side frame of the terminal 800, it can detect the user's holding signal of the terminal 800, and the processor 801 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 813. When the pressure sensor 813 is set on the lower layer of the display screen 805, the processor 801 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 805. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0241] The optical sensor 815 is used to collect the ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 according to the ambient light intensity collected by the optical sensor 815. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is reduced. In another embodiment, the processor 801 can also dynamically adjust the shooting parameters of the camera assembly 806 according to the ambient light intensity collected by the optical sensor 815.

[0242] The proximity sensor 816, also called a distance sensor, is disposed on the front panel of the terminal 800. The proximity sensor 816 is used to collect the distance between the user and the front of the terminal 800. In one embodiment, when the proximity sensor 816 detects that the distance between the user and the front of the terminal 800 is gradually decreasing, the processor 801 controls the display screen 805 to switch from the screen-on state to the screen-off state; when the proximity sensor 816 detects that the distance between the user and the front of the terminal 800 is gradually increasing, the processor 801 controls the display screen 805 to switch from the screen-off state to the screen-on state.

[0243] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the terminal 800, and the terminal 800 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.

[0244] Optionally, the computer device is provided as a server. Fig. 9This is a schematic diagram of the structure of a server provided in an embodiment of the present application. The server 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 901 and one or more memories 902, wherein the memory 902 stores at least one computer program, and at least one computer program is loaded and executed by the processor 901 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be described in detail here.

[0245] An embodiment of the present application also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the operations performed in the method for determining the hyponymy relationship of words in the above embodiment.

[0246] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer program code, and the computer program code is stored in a computer-readable storage medium. The processor of the computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device implements the operations performed in the method for determining the hyponymy relationship of words in the above embodiment.

[0247] A person of ordinary skill in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk, or an optical disk, etc.

[0248] The above description is only an optional embodiment of the embodiments of the present application and is not intended to limit the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the protection scope of the present application.

Claims

1. A method for determining the relationship between words and their sub-words, It is characterized in that The method comprises: Get two words; Querying the two words from a word database, wherein the word database includes a plurality of words and a confidence level of a relationship between each two words in the plurality of words; In response to at least one of the two words not existing in the word database, calling a relationship determination model trained based on the word database, processing the word vectors of the two words, and determining a confidence level of the relationship between the two words; Among them, the relationship confidence is used to indicate the possibility that the two words have a hyponymous relationship; the training process of the relationship determination model includes: taking the words in the word database as sample words, and taking the relationship confidence between each two sample words as the supervision value corresponding to each two sample words; and iteratively training the relationship determination model according to the word vectors and corresponding supervision values ​​of each two sample words.

2. The method according to claim 1, It is characterized in that Before querying the two words from the word database, the method further includes: Extract words from the text information in the corpus to obtain multiple pairs of words and the co-occurrence frequency of each pair of words; Based on the multiple pairs of words and the co-occurrence frequencies corresponding to each pair of words, determining the co-occurrence frequencies corresponding to the multiple words included in the multiple pairs of words and every two words in the multiple words; Determining the confidence of the relationship between each two words based on the co-occurrence frequency corresponding to each two words; The word database is constructed based on the multiple words and the confidence of the relationship between each two words.

3. The method according to claim 2, It is characterized in that The word extraction is performed on the text information in the corpus to obtain multiple pairs of words and the co-occurrence frequency corresponding to each pair of words, including: Based on a reference grammatical condition, determining a reference sentence in the text information that satisfies the reference grammatical condition, wherein the reference grammatical condition is used to indicate a grammatical condition satisfied by words having a hyponymous relationship; Word extraction is performed on the obtained multiple reference sentences to obtain the multiple pairs of words and the co-occurrence frequency corresponding to each pair of words.

4. The method according to claim 2, It is characterized in that The determining, based on the multiple pairs of words and the co-occurrence frequencies corresponding to each pair of words, the multiple words included in the multiple pairs of words and the co-occurrence frequencies corresponding to each two words in the multiple words comprises: Based on the plurality of pairs of words, determining a plurality of words included in the plurality of pairs of words; Based on the multiple words and the co-occurrence frequencies corresponding to each pair of words, construct a co-occurrence frequency matrix, wherein each element in the co-occurrence frequency matrix is ​​used to represent the co-occurrence frequency of the corresponding two words; The co-occurrence frequency matrix is ​​decomposed to determine the co-occurrence frequency corresponding to every two words in the multiple words.

5. The method according to claim 1, It is characterized in that The iterative training of the relationship determination model according to the word vectors and corresponding supervision values ​​of each two sample words includes: For any iteration round in the multiple iteration rounds, calling the relationship determination model, processing the word vectors of any two sample words, and determining the confidence of the predicted relationship between the any two sample words; Determining a loss value of the relationship determination model according to the predicted relationship confidence and the supervision values ​​corresponding to any two sample words; The parameters of the relationship determination model are adjusted according to the loss value.

6. The method according to claim 5, It is characterized in that The step of determining the loss value of the relationship determination model according to the predicted relationship confidence and the supervision values ​​corresponding to any two sample words includes: The square of the difference between the predicted relationship confidence and the supervision value is determined as the loss value.

7. The method according to claim 1, It is characterized in that In response to the fact that at least one of the two words does not exist in the word database, calling a relationship determination model trained based on the word database, processing the word vectors of the two words, and determining the confidence of the relationship between the two words, the method further includes: In response to the relationship confidence between the two words being greater than the reference confidence, the two words are correspondingly stored in a hyponymy database, wherein the hyponymy database includes words having a hyponymy relationship.

8. The method according to claim 7, It is characterized in that The method further comprises: receiving a search request, wherein the search request carries a target word; Querying the target word from the hyponymy database; In response to finding the hypernym corresponding to the target word, information related to the target word is retrieved based on the target word and the corresponding hypernym.

9. The method according to claim 7, It is characterized in that The method further comprises: receiving a classification request, wherein the classification request carries target text information; Extracting keywords from the target text information to obtain keywords in the target text information; Querying the keyword from the upper and lower relationship database; In response to finding the hypernym corresponding to the keyword, a corresponding type tag is determined for the target text information according to the hypernym corresponding to the keyword.

10. A device for determining the relationship between words, It is characterized in that The device comprises: A word acquisition module, used to acquire two words; A word query module, used for querying the two words from a word database, wherein the word database includes a plurality of words and a confidence level of a relationship between each two words in the plurality of words; A first confidence determination module is configured to, in response to at least one of the two words not existing in the word database, call a relationship determination model trained based on the word database, process the word vectors of the two words, and determine the confidence of the relationship between the two words; Among them, the relationship confidence is used to indicate the possibility that the two words have a hyponymous relationship; the training process of the relationship determination model includes: taking the words in the word database as sample words, and taking the relationship confidence between each two sample words as the supervision value corresponding to each two sample words; and iteratively training the relationship determination model according to the word vectors and corresponding supervision values ​​of each two sample words.

11. The device according to claim 10, It is characterized in that The device also includes: The word extraction module is used to extract words from the text information in the corpus to obtain multiple pairs of words and the co-occurrence frequency corresponding to each pair of words; A word determination module, configured to determine, based on the multiple pairs of words and the co-occurrence frequencies corresponding to each pair of words, the multiple words included in the multiple pairs of words and the co-occurrence frequencies corresponding to each two words in the multiple words; A second confidence determination module, configured to determine the confidence of the relationship between each two words based on the co-occurrence frequencies corresponding to each two words; The database construction module is used to construct the word database based on the multiple words and the confidence of the relationship between each two words.

12. The device according to claim 11, It is characterized in that The word extraction module comprises: A sentence determination unit, configured to determine, based on a reference grammatical condition, a reference sentence in the text information that satisfies the reference grammatical condition, wherein the reference grammatical condition is used to indicate a grammatical condition satisfied by words having a hyponymous relationship; The word extraction unit is used to extract words from the obtained multiple reference sentences to obtain the multiple pairs of words and the co-occurrence frequency corresponding to each pair of words.

13. The device according to claim 11, It is characterized in that The word determination module comprises: a word determination unit, configured to determine a plurality of words included in the plurality of pairs of words based on the plurality of pairs of words; A matrix construction unit, configured to construct a co-occurrence frequency matrix based on the multiple words and the co-occurrence frequencies corresponding to each pair of words, wherein each element in the co-occurrence frequency matrix is ​​used to represent the co-occurrence frequency of the corresponding two words; The matrix decomposition unit is used to decompose the co-occurrence frequency matrix to determine the co-occurrence frequency corresponding to every two words in the multiple words.

14. The device according to claim 10, It is characterized in that The device also includes a model training module; the model training module includes: A confidence determination unit, configured to, for any iteration round in the multiple iteration rounds, call the relationship determination model, process the word vectors of any two sample words, and determine the confidence of the predicted relationship between the any two sample words; A loss value determination unit, configured to determine a loss value of the relationship determination model according to the predicted relationship confidence and the supervision values ​​corresponding to any two sample words; A parameter adjustment unit is used to adjust the parameters of the relationship determination model according to the loss value.

15. The device according to claim 14, It is characterized in that The loss value determination unit is used to determine the square of the difference between the prediction relationship confidence and the supervision value as the loss value.

16. The device according to claim 10, It is characterized in that The device also includes: The word storage module is used for storing the two words in a hyponymy database in response to the relationship confidence between the two words being greater than the reference confidence, wherein the hyponymy database includes words with a hyponymy relationship.

17. The device according to claim 16, It is characterized in that The device also includes: A first receiving module, configured to receive a search request, wherein the search request carries a target word; The word query module is further used to query the target word from the hyponymy database; The retrieval module is used to retrieve information related to the target word based on the target word and the corresponding hypernym in response to finding the hypernym corresponding to the target word.

18. The device according to claim 16, It is characterized in that The device also includes: A second receiving module is used to receive a classification request, wherein the classification request carries target text information; A keyword extraction module, used to extract keywords from the target text information to obtain keywords in the target text information; The word query module is further used to query the keyword from the upper and lower relationship database; The tag determination module is used to determine a corresponding type tag for the target text information according to the hypernym corresponding to the keyword in response to the query.

19. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the method for determining the hyponymy relationship of words as described in any one of claims 1 to 9.

20. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the operations performed in the method for determining the hyponymy of words as claimed in any one of claims 1 to 9.

21. A computer program product, It is characterized in that The computer program product includes a computer program code, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device implements the operations performed in the method for determining the hyponymy of words as described in any one of claims 1 to 9.