Dictionary construction method and device

Through a text classification model based on a semi-supervised learning algorithm, the product element dictionary is automatically expanded and updated, which solves the problems of low dictionary construction efficiency and poor accuracy in the existing technology, and improves the quality of product summaries.

CN113761882BActive Publication Date: 2024-09-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010513089.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-08
Publication Date
2024-09-20
Estimated Expiration
2040-06-08

AI Technical Summary

Technical Problem

In the existing technology, the construction efficiency of the product element dictionary is low and the accuracy is poor, resulting in poor quality of the generated product summary, mainly due to the low efficiency and poor consistency of manual annotation.

Method used

Using a text classification model based on a semi-supervised learning algorithm, by dividing the target text into clauses and predicting the element words in the commodity element dictionary based on the probability of the clause, the dictionary is automatically expanded and updated to improve the completeness and accuracy of the dictionary. .

Benefits of technology

It realizes the automatic expansion and update of the product element dictionary, improves the construction efficiency and accuracy, avoids the poor consistency caused by manual annotation, and improves the quality of the product summary.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113761882B
    Figure CN113761882B
Patent Text Reader

Abstract

The present invention discloses a dictionary construction method and device, and relates to the field of computer technology. A specific implementation of the method includes: dividing a sentence in a target text into one or more clauses according to punctuation marks; using a text classification model trained based on a semi-supervised learning algorithm to predict the first probability that a clause in the target text belongs to a commodity element contained in a pre-constructed commodity element dictionary; when the first probability that the clause belongs to the commodity element is greater than a first threshold probability, calculating the second probability that the words in the clause other than the element words currently contained in the commodity element belong to the commodity element; when the second probability that the word belongs to the commodity element is greater than a second threshold probability, adding the word as an element word of the commodity element to the commodity element dictionary. This implementation realizes the automatic expansion of the dictionary and improves the efficiency of dictionary construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a dictionary construction method and device. Background Art

[0002] In the field of e-commerce, in order to facilitate users to quickly understand the performance of goods and stimulate their desire to buy, it is often necessary to generate a product summary for users that includes product elements based on the detailed information of the goods. The so-called product elements refer to the words used to describe the performance of the goods. In the process of generating product summaries, it is necessary to determine the product elements contained in the detailed information of the goods based on the element words of the product elements contained in the pre-built product element dictionary, and then generate a product summary for users that includes product elements. Among them, element words refer to synonyms, antonyms or hyponyms of product elements. For example, "mobile phone" has multiple product elements such as "screen" and "battery", and the product element "screen" has element words such as "screen size", "resolution", "full screen" and "curved screen".

[0003] Therefore, the completeness and accuracy of the constructed product element dictionary are crucial to determine the product elements contained in the product detailed information, which in turn affects the quality of the generated product summary. At present, the product element dictionary is often constructed by manual annotation, but due to the huge amount of product description text, the efficiency of manual annotation is low, which affects the efficiency of constructing the product element dictionary; in addition, due to different people's different understanding of product elements, the annotation consistency is poor, the accuracy and coverage are low, and the actual application effect of the constructed product element dictionary is not good. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a dictionary construction method and device, which can use a text classification model constructed based on a semi-supervised learning algorithm to realize automatic expansion and updating of the product element dictionary, so that the constructed product element dictionary is more complete and accurate.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a dictionary construction method is provided, comprising:

[0006] Divide sentences in the target text into one or more clauses based on punctuation marks;

[0007] Using a text classification model trained based on a semi-supervised learning algorithm, predicting the first probability that a clause in the target text belongs to a product element included in a pre-built product element dictionary;

[0008] When the first probability that the clause belongs to the commodity element is greater than a first threshold probability, calculating a second probability that the words in the clause other than the element words currently included in the commodity element belong to the commodity element;

[0009] When the second probability that the word belongs to the commodity element is greater than a second threshold probability, the word is added to the commodity element dictionary as an element word of the commodity element.

[0010] Optionally, training the text classification model based on the semi-supervised learning algorithm includes:

[0011] Acquire training data based on the product element dictionary, the training data indicating one or more clauses and a first probability that the clauses belong to the product element;

[0012] Inputting the training data into the text classification model to calculate a current loss function of the text classification model according to a first probability that the clause belongs to the commodity element, and optimizing the text classification model according to the current loss function;

[0013] Using the optimized text classification model, predicting a third probability that the clause not containing the commodity element belongs to the commodity element;

[0014] When the third probability is greater than the first threshold probability, the clause and the third probability corresponding to the clause are added to the training data to continue optimizing the text classification model.

[0015] Optionally, the acquiring training data based on the product element dictionary, the training data indicating one or more clauses and a first probability that the clauses belong to the product element, includes:

[0016] Determining whether the clause contains an element word of a commodity element contained in the commodity element dictionary;

[0017] If the clause contains the element word of the commodity element, the first probability is a first value;

[0018] If the clause does not include the element word of the product element and other clauses adjacent to the clause in the same sentence include the element word of the product element, the first probability is a second value.

[0019] Optionally, when the first probability that the clause belongs to the product element is greater than a first threshold probability, calculating a second probability that a word in the clause other than the element word currently included in the product element belongs to the product element includes:

[0020] Determining the probability that the word belongs to the commodity element in different clauses according to the probability that the clause belongs to the commodity element;

[0021] The average probability of the word belonging to the commodity element in different clauses is calculated to obtain the second probability.

[0022] Optionally, when the first probability that the clause belongs to the commodity element is greater than a first threshold probability, the method further includes:

[0023] Calculate the frequency of occurrence of the word in all the clauses belonging to the same product element;

[0024] One or more of the words are determined according to the order of the occurrence frequencies of the words from high to low, so as to add the words as element words of the commodity elements to the commodity element dictionary.

[0025] Optionally, it also includes:

[0026] Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word belongs to a list of prohibited element words;

[0027] When the word does not belong to the prohibited element word list, a second probability that the word belongs to the commodity element is calculated.

[0028] Optionally, it also includes:

[0029] Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word is a stop word;

[0030] When the word is not a stop word, a second probability that the word belongs to the commodity element is calculated.

[0031] To achieve the above object, according to another aspect of an embodiment of the present invention, a dictionary construction device is provided, comprising: a clause acquisition module, a first probability prediction module, a second probability calculation module, and a dictionary expansion module; wherein:

[0032] The clause acquisition module is used to divide the sentences in the target text into one or more clauses according to punctuation marks;

[0033] The first probability prediction module is used to predict a first probability that a clause in the target text belongs to a commodity element included in a pre-built commodity element dictionary using a text classification model trained based on a semi-supervised learning algorithm;

[0034] The second probability calculation module is used to calculate the second probability that the words in the clause other than the element words currently included in the commodity element belong to the commodity element when the first probability that the clause belongs to the commodity element is greater than the first threshold probability;

[0035] The dictionary expansion module is configured to add the word as an element word of the commodity element to the commodity element dictionary when the second probability that the word belongs to the commodity element is greater than a second threshold probability.

[0036] Optionally, it further includes: a classification model training module; wherein the classification model training module is used to:

[0037] Acquire training data based on the product element dictionary, the training data indicating one or more clauses and a first probability that the clauses belong to the product element;

[0038] Inputting the training data into the text classification model to calculate a current loss function of the text classification model according to a first probability that the clause belongs to the commodity element, and optimizing the text classification model according to the current loss function;

[0039] Using the optimized text classification model, predicting a third probability that the clause not containing the commodity element belongs to the commodity element;

[0040] When the third probability is greater than the first threshold probability, the clause and the third probability corresponding to the clause are added to the training data to continue optimizing the text classification model.

[0041] Optionally, the acquiring training data based on the product element dictionary, the training data indicating one or more clauses and a first probability that the clauses belong to the product element, includes:

[0042] Determining whether the clause contains an element word of a commodity element contained in the commodity element dictionary;

[0043] If the clause contains the element word of the commodity element, the first probability is a first value;

[0044] If the clause does not include the element word of the product element and other clauses adjacent to the clause in the same sentence include the element word of the product element, the first probability is a second value.

[0045] Optionally, when the first probability that the clause belongs to the product element is greater than a first threshold probability, calculating a second probability that a word in the clause other than the element word currently included in the product element belongs to the product element includes:

[0046] Determining the probability that the word belongs to the commodity element in different clauses according to the probability that the clause belongs to the commodity element;

[0047] The average probability of the word belonging to the commodity element in different clauses is calculated to obtain the second probability.

[0048] Optionally, when the first probability that the clause belongs to the commodity element is greater than a first threshold probability, the method further includes:

[0049] Calculate the frequency of occurrence of the word in all the clauses belonging to the same product element;

[0050] One or more of the words are determined according to the order of the occurrence frequencies of the words from high to low, so as to add the words as element words of the commodity elements to the commodity element dictionary.

[0051] Optionally, the second probability calculation module is further used to:

[0052] Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word belongs to a list of prohibited element words;

[0053] When the word does not belong to the prohibited element word list, a second probability that the word belongs to the commodity element is calculated.

[0054] Optionally, the second probability calculation module is further used to:

[0055] Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word is a stop word;

[0056] When the word is not a stop word, a second probability that the word belongs to the commodity element is calculated.

[0057] To achieve the above object, according to another aspect of an embodiment of the present invention, there is provided an electronic device for dictionary construction, comprising:

[0058] one or more processors;

[0059] a storage device for storing one or more programs,

[0060] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described above in the dictionary building method.

[0061] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the methods described above in the dictionary construction method is implemented.

[0062] One embodiment of the above invention has the following advantages or beneficial effects: dividing sentences in the target text into one or more clauses according to punctuation marks; using a text classification model trained based on a semi-supervised learning algorithm, predicting the first probability that a clause in the target text belongs to a commodity element contained in a pre-constructed commodity element dictionary; when the first probability that the clause belongs to the commodity element is greater than a first threshold probability, calculating the second probability that the words in the clause other than the element words currently contained in the commodity element belong to the commodity element; when the second probability that the word belongs to the commodity element is greater than a second threshold probability, adding the word as the element word of the commodity element to the commodity element dictionary. Based on this, the automatic expansion of the commodity element dictionary is realized without a large amount of manual annotation, improving the efficiency of commodity element dictionary construction, avoiding the problem of poor consistency caused by manual annotation, and improving the quality of the commodity element dictionary.

[0063] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0065] Figure 1 is a schematic diagram of the main process of the dictionary construction method according to an embodiment of the present invention;

[0066] Figure 2 is a schematic diagram of the main process of the training method of the text classification model according to an embodiment of the present invention;

[0067] Figure 3 is a schematic diagram of main modules of a dictionary construction device according to an embodiment of the present invention;

[0068] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0069] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0071] Figure 1 is a schematic diagram of the main process of the dictionary construction method according to an embodiment of the present invention. Figure 1 As shown, the dictionary construction method may specifically include the following steps:

[0072] Step S101 : dividing a sentence in a target text into one or more clauses according to punctuation marks.

[0073] Specifically, taking the sentence "This mobile phone uses a full screen, with a screen-to-body ratio of up to 90% and high screen brightness" as an example, the sentence can be divided into the following three clauses based on the punctuation marks "," and "." in the sentence:

[0074] Clause 1: This phone uses a full screen

[0075] Clause 2: Screen-to-body ratio up to 90%

[0076] Clause 3: Screen brightness is high

[0077] Step S102 : using a text classification model trained based on a semi-supervised learning algorithm, predicting a first probability that a clause in the target text belongs to a commodity element included in a pre-built commodity element dictionary.

[0078] Among them, the semi-supervised learning algorithms that can be used include but are not limited to generative model algorithms (Generate semi-supervised models), self-training algorithms (Self-training), joint training (Co-training), semi-supervised support vector machines (S3VMs), BERT (Bidirectional Encoder Representations from Transformers) algorithms, etc.

[0079] The product element dictionary includes one or more product categories, one or more product elements corresponding to the product categories, and element words corresponding to each product element. The pre-constructed product element dictionary is completed based on manual annotation. In the process of manual annotation, one or more product elements and one or more element words corresponding to the product elements can be pre-constructed for the product category based on actual experience, and then in the process of annotating the clauses in the product description text, the element words corresponding to the product elements are added; at the same time, it is also not limited to the pre-defined product elements, and new product elements can be added or existing unreasonable product elements can be deleted according to actual conditions. For example, the pre-defined product elements for mobile phones include battery, screen, memory and material. When annotating the two clauses in the same sentence in the product description text, "This mobile phone uses a ceramic body" and "warm and smooth", it can be seen that "ceramic" can be used as an element word for the product element "material", and "warm" describes the "touch" of the mobile phone, but "touch" is not in the pre-defined product elements. Therefore, the new product element "touch" can be added to the product element dictionary, and the corresponding element words include "warm" and "feel". Specifically, the pre-constructed product element dictionary is shown in Table 1 below,

[0080] Table 1 Example of commodity element dictionary

[0081]

[0082]

[0083] In an optional embodiment, the text classification model is trained based on the semi-supervised learning algorithm, including: acquiring training data based on the commodity element dictionary, the training data indicating one or more clauses and a first probability that the clauses belong to the commodity elements; inputting the training data into the text classification model to calculate the current loss function of the text classification model according to the first probability that the clauses belong to the commodity elements, and optimizing the text classification model according to the current loss function; using the optimized text classification model, predicting a third probability that a clause that does not contain a commodity element belongs to the commodity element; and when the third probability is greater than the first threshold probability, adding the clause and the third probability corresponding to the clause to the training data to continue optimizing the text classification model.

[0084] That is to say, in the process of training the classification model, a small amount of training data obtained by manual annotation can be used in advance for training, and the probability of the clause belonging to the commodity element can be used to adjust the loss function of the sample to obtain a more accurate and realistic loss function, thereby optimizing the text classification model. On this basis, the text classification model is used to predict the probability that the clause that does not contain the commodity element belongs to the commodity element, and then on the basis that the predicted third probability of the clause belonging to the commodity element is greater than the first threshold probability, the clause and the corresponding third probability are added to the training data to achieve continuous expansion of the training data, which is used to further optimize the text classification model. This cycle not only improves the accuracy of the text classification model, but also eliminates the need for a large amount of manual annotation.

[0085] Furthermore, the acquisition of training data based on the commodity element dictionary, the training data indicating one or more clauses and the first probability that the clauses belong to the commodity element, includes: determining whether the clause contains the commodity element word contained in the commodity element dictionary; if the clause contains the commodity element word, the first probability is a first value; if the clause does not contain the commodity element word and other clauses adjacent to the clause in the same sentence contain the commodity element word, the first probability is a second value. The first value and the second value are preset according to actual needs. Generally speaking, the second value is smaller than the first value, such as the first value is 1 and the second value is 0.8.

[0086] Specifically, referring to Table 1, the sentence "This mobile phone adopts a full screen, the screen ratio is as high as 90%, and the screen brightness is high" is used as an example for explanation, which contains the following three clauses:

[0087] Clause 1: This phone uses a full screen

[0088] Clause 2: Screen-to-body ratio up to 90%

[0089] Clause 3: Screen brightness is high

[0090] Since clause 1 contains the element word "full screen" of the commodity element "screen", the first probability that clause 1 belongs to the commodity element "screen" is determined to be the first value (such as 1); clause 3 contains the element word "screen" of the commodity element "screen", so the first probability that clause 3 belongs to the commodity element "screen" is determined to be the first value (taking 1 as an example); clause 2 does not contain any element words of commodity elements contained in the commodity element dictionary, but since clauses 1 and 3 adjacent to clause 2 in the same sentence both contain element words of the commodity element "screen", it is determined that clause 2 is also very likely to be related to the commodity element "screen", and the probability that clause 2 belongs to the commodity element "screen" is the second value (taking 0.8 as an example). In this way, a small amount of clauses in the commodity description text can be annotated based on the commodity element dictionary, and then the value of the first probability corresponding to the clause can be determined to obtain training data. It is worth noting that in the process of obtaining training data, only clauses containing element words of product elements, or at least one adjacent clause in the same sentence containing product elements, are considered. As it is impossible to determine whether other clauses are related to product elements, they are not considered in this step.

[0091] Step S103, when the first probability that the clause belongs to the product element is greater than a first threshold probability, calculate a second probability that the words in the clause other than the element words currently included in the product element belong to the product element.

[0092] Among them, the first threshold is any value between 0 and 1 set according to actual experience, such as 0.8, 0.7, etc. Specifically, the text classification model can predict the first probability that the clause belongs to each commodity element contained in the commodity element dictionary, and the sum of the first probabilities that the same clause belongs to different commodity elements is 1. On this basis, the commodity element to which the clause belongs can be determined according to the maximum value of the first probabilities; then it is judged whether the first probability of the clause is greater than the first threshold probability. If it is greater, it indicates that it is credible that the clause belongs to the commodity element. If it is not greater, it indicates that it is not credible that the clause belongs to the commodity element. If and only if the probability that the clause belongs to the commodity element is credible, the second probability that the words in the clause belong to the commodity element will be calculated.

[0093] In an optional embodiment, when the first probability that the clause belongs to the product element is greater than a first threshold probability, calculating the second probability that the words in the clause other than the element words currently contained in the product element belong to the product element, including: determining the probability that the word belongs to the product element in different clauses according to the probability that the clause belongs to the product element; and calculating the average probability that the word belongs to the product element in different clauses to obtain the second probability.

[0094] Specifically, taking the first probability of clause A belonging to commodity element a as 0.8 as an example, the probability of determining that any word X in clause A other than the element words currently contained in the commodity element belongs to the commodity element is also 0.8. It can be understood that in the actual execution process, it can also be adjusted based on the first probability according to the preset weight (such as 0.8 as an example), and the probability that word X belongs to commodity element a is 0.64. Based on this, after calculating the probability that the same word X belongs to commodity element a in different clauses, the average probability of word X belonging to commodity element a is calculated, which is the second probability of word X belonging to commodity element.

[0095] In an optional embodiment, when the first probability that the clause belongs to the product element is greater than the first threshold probability, it also includes: calculating the occurrence frequency of the word in all the clauses belonging to the same product element; determining one or more of the words according to the order of the occurrence frequency of the words from high to low, so as to add the words as element words of the product element to the product element dictionary, so as to expand the product element dictionary.

[0096] Specifically, the first probability of clause A belonging to commodity element a is 0.8, the first probability of clause B belonging to commodity element a is 0.7, the first probability of clause C belonging to commodity element a is 0.75, and the first probability of clause D belonging to commodity element a is 0.9. The occurrence frequencies of all words (taking word 1, word 2, and word 3 as examples) except the element words currently contained in the commodity element in clauses A, B, C, and D are counted. If the occurrence frequencies of word 1, word 2, and word 3 are 5, 4, and 3 respectively, the two words with higher occurrence frequencies, namely word 1 and word 2, can be used as element words of commodity element a and added to the commodity element dictionary to further expand the commodity element dictionary.

[0097] In an optional embodiment, before calculating the second probability that a word in the clause other than the element word currently contained in the product element belongs to the product element, it is determined whether the word belongs to a list of banned element words; if the word does not belong to the list of banned element words, the second probability that the word belongs to the product element is calculated.

[0098] That is to say, when constructing a prohibited element word according to actual needs, the words in the clause can be preliminarily screened to reduce the amount of words that need to calculate the second probability, thereby improving the calculation efficiency.

[0099] In an optional embodiment, before calculating the second probability that a word in the clause other than the element word currently contained in the product element belongs to the product element, it is determined whether the word is a stop word; if the word is not a stop word, the second probability that the word belongs to the product element is calculated.

[0100] Stop words refer to certain words or phrases that are automatically filtered out before or after processing natural language data (or text) in order to save storage space and improve search efficiency in information retrieval. These words or phrases are called Stop Words, such as "this", "that", etc. In this way, by filtering stop words, the number of words that need to be calculated for the second probability is further reduced, and the calculation efficiency is improved.

[0101] Step S104, when the second probability that the word belongs to the commodity element is greater than a second threshold probability, the word is used as an element word of the commodity element and added to the commodity element dictionary. The second threshold probability is also any value in the range of 0-1 set based on actual experience or demand, such as 0.75, 0.8, etc.

[0102] Based on the above embodiment, the sentences in the target text are divided into one or more clauses according to punctuation marks; a text classification model trained based on a semi-supervised learning algorithm is used to predict the first probability that the clauses in the target text belong to the commodity elements contained in the pre-constructed commodity element dictionary; when the first probability that the clause belongs to the commodity element is greater than the first threshold probability, the second probability that the words in the clause other than the element words currently contained in the commodity element belong to the commodity element is calculated; when the second probability that the word belongs to the commodity element is greater than the second threshold probability, the word is used as the element word of the commodity element and added to the commodity element dictionary. Based on this, the automatic expansion of the commodity element dictionary is realized without the need for a large amount of manual annotation, which improves the efficiency of the construction of the commodity element dictionary, avoids the problem of poor consistency caused by manual annotation, and improves the quality of the commodity element dictionary.

[0103] See also Figure 2 Based on the above embodiment, a text classification model training method is provided, and the method may specifically include the following steps:

[0104] Step S201 : acquiring training data based on the product element dictionary, wherein the training data indicates one or more clauses and a first probability that the clauses belong to the product element.

[0105] The method of obtaining training data based on the commodity element dictionary, wherein the training data indicates one or more clauses and the first probability that the clauses belong to the commodity element, includes: determining whether the clause contains the commodity element word contained in the commodity element dictionary; if the clause contains the commodity element word, the first probability is a first value; if the clause does not contain the commodity element word and other clauses adjacent to the clause in the same sentence contain the commodity element word, the first probability is a second value. The first value and the second value are set according to actual needs. Generally speaking, the second value is smaller than the first value, such as the first value is 1 and the second value is 0.8.

[0106] Specifically, referring to Table 1, the sentence "This mobile phone adopts a full screen, the screen ratio is as high as 90%, and the screen brightness is high" is used as an example for explanation, which contains the following three clauses:

[0107] Clause 1: This phone uses a full screen

[0108] Clause 2: Screen-to-body ratio up to 90%

[0109] Clause 3: Screen brightness is high

[0110] Since clause 1 contains the element word "full screen" of the commodity element "screen", the first probability that clause 1 belongs to the commodity element "screen" is determined to be the first value (such as 1); clause 3 contains the element word "screen" of the commodity element "screen", so the first probability that clause 3 belongs to the commodity element "screen" is determined to be the first value (taking 1 as an example); clause 2 does not contain any element words of commodity elements contained in the commodity element dictionary, but since clauses 1 and 3 adjacent to clause 2 in the same sentence both contain element words of the commodity element "screen", it is determined that clause 2 is also very likely to be related to the commodity element "screen", and the probability that clause 2 belongs to the epithelial element "screen" is the second value (taking 0.8 as an example). In this way, a small amount of clauses in the commodity description text can be annotated based on the commodity element dictionary, and then the value of the first probability corresponding to the clause can be determined to obtain training data. It is worth noting that in the process of obtaining training data, only clauses containing element words of product elements, or at least one adjacent clause in the same sentence containing product elements, are considered. As it is impossible to determine whether other clauses are related to product elements, they are not considered in this step.

[0111] Step S202: input the training data into the text classification model to calculate the current loss function of the text classification model according to the first probability that the clause belongs to the commodity element, and optimize the text classification model according to the current loss function.

[0112] Specifically, after the training data is input into the text classification model, the text classification model will predict the first probability that each training sample in the training data belongs to each commodity element in the commodity element word, and then calculate the loss function corresponding to each clause based on the first probability of the clause predicted by the text classification model and the first probability of the clause in the training data. For example, the loss function corresponding to clause i in the training data is li, and the loss function of the text classification model at the current moment can be calculated according to the following formula:

[0113] L=∑Pi*li

[0114] Among them, L is the loss function of the text classification model, li is the loss function corresponding to clause i in the training data, and Pi is the first probability that clause i in the training data belongs to the product element.

[0115] Step S203: using the optimized text classification model, predicting a third probability that the clause not containing the commodity element belongs to the commodity element.

[0116] Step S204, when the third probability is greater than the first threshold probability, adding the clause and the third probability corresponding to the clause to the training data to continue optimizing the text classification model.

[0117] That is to say, by using the text classification model to predict the probability that a clause that does not contain commodity elements belongs to commodity elements, and then on the basis that the third probability that the predicted clause belongs to commodity elements is greater than the first threshold probability, the clause and the corresponding third probability are added to the training data, thereby achieving continuous expansion of the training data, so that the text classification model can be further optimized based on the newly expanded training data. This cycle not only improves the accuracy of the text classification model, but also eliminates the need for a large amount of manual labeling.

[0118] See also Figure 3 Based on the above embodiments, the embodiment of the present invention provides a dictionary construction device 300, including: a clause acquisition module 301, a first probability prediction module 303, a second probability calculation module 304, and a dictionary expansion module 305; wherein,

[0119] The clause acquisition module 301 is used to divide the sentences in the target text into one or more clauses according to punctuation marks;

[0120] The first probability prediction module 303 is used to predict the first probability that a clause in the target text belongs to a commodity element included in a pre-built commodity element dictionary using a text classification model trained based on a semi-supervised learning algorithm;

[0121] The second probability calculation module 304 is used to calculate the second probability that the words in the clause other than the element words currently included in the commodity element belong to the commodity element when the first probability that the clause belongs to the commodity element is greater than the first threshold probability;

[0122] The dictionary expansion module 305 is configured to add the word as an element word of the product element to the product element dictionary when the second probability that the word belongs to the product element is greater than a second threshold probability.

[0123] In an optional implementation, the method further includes: a classification model training module 302; wherein the classification model training module 302 is used to:

[0124] Acquire training data based on the product element dictionary, the training data indicating one or more clauses and a first probability that the clauses belong to the product element;

[0125] Inputting the training data into the text classification model to calculate a current loss function of the text classification model according to a first probability that the clause belongs to the commodity element, and optimizing the text classification model according to the current loss function;

[0126] Using the optimized text classification model, predicting a third probability that the clause not containing the commodity element belongs to the commodity element;

[0127] When the third probability is greater than the first threshold probability, the clause and the third probability corresponding to the clause are added to the training data to continue optimizing the text classification model.

[0128] In an optional implementation, the acquiring of training data based on the product element dictionary, wherein the training data indicates one or more clauses and a first probability that the clauses belong to the product element, includes:

[0129] Determining whether the clause contains an element word of a commodity element contained in the commodity element dictionary;

[0130] If the clause contains the element word of the commodity element, the first probability is a first value;

[0131] If the clause does not include the element word of the product element and other clauses adjacent to the clause in the same sentence include the element word of the product element, the first probability is a second value.

[0132] In an optional implementation, when the first probability that the clause belongs to the product element is greater than a first threshold probability, calculating a second probability that a word in the clause other than the element word currently included in the product element belongs to the product element includes:

[0133] Determining the probability that the word belongs to the commodity element in different clauses according to the probability that the clause belongs to the commodity element;

[0134] The average probability of the word belonging to the commodity element in different clauses is calculated to obtain the second probability.

[0135] In an optional implementation, when the first probability that the clause belongs to the commodity element is greater than the first threshold probability, the method further includes:

[0136] Calculate the frequency of occurrence of the word in all the clauses belonging to the same product element;

[0137] One or more of the words are determined according to the order of the occurrence frequencies of the words from high to low, so as to add the words as element words of the commodity elements to the commodity element dictionary.

[0138] In an optional implementation, the second probability calculation module 304 is further configured to:

[0139] Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word belongs to a list of prohibited element words;

[0140] When the word does not belong to the prohibited element word list, a second probability that the word belongs to the commodity element is calculated.

[0141] In an optional implementation manner, the second probability calculation module 304 is further configured to:

[0142] Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word is a stop word;

[0143] When the word is not a stop word, a second probability that the word belongs to the commodity element is calculated.

[0144] Figure 4 An exemplary system architecture 400 is shown to which the dictionary building method or dictionary building device according to the embodiment of the present invention can be applied.

[0145] like Figure 4As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0146] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications, such as shopping applications, web browser applications, search applications, etc., can be installed on terminal devices 401, 402, 403.

[0147] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0148] Server 405 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using terminal devices 401, 402, and 403. The backend management server may analyze and process received data such as product information query requests to obtain one or more clauses in the product description text.

[0149] It should be noted that the dictionary construction method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the dictionary construction device is generally disposed in the server 405 .

[0150] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0151] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0152] like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0153] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0154] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0155] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0156] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0157] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes modules. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the sending unit may also be described as "a module for sending a picture acquisition request to the connected server".

[0158] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: dividing a sentence in a target text into one or more clauses according to punctuation marks; using a text classification model trained based on a semi-supervised learning algorithm, predicting a first probability that a clause in the target text belongs to a commodity element contained in a pre-built commodity element dictionary; when the first probability that the clause belongs to the commodity element is greater than a first threshold probability, calculating a second probability that a word in the clause other than the element word currently contained in the commodity element belongs to the commodity element; when the second probability that the word belongs to the commodity element is greater than a second threshold probability, adding the word as an element word of the commodity element to the commodity element dictionary.

[0159] According to the technical solution of the embodiment of the present invention, the sentences in the target text are divided into one or more clauses according to punctuation marks; a text classification model trained based on a semi-supervised learning algorithm is used to predict the first probability that the clauses in the target text belong to the commodity elements contained in the pre-constructed commodity element dictionary; when the first probability that the clause belongs to the commodity element is greater than the first threshold probability, the second probability that the words in the clause other than the element words currently contained in the commodity element belong to the commodity element is calculated; when the second probability that the word belongs to the commodity element is greater than the second threshold probability, the word is used as the element word of the commodity element and added to the commodity element dictionary. Based on this, the automatic expansion of the commodity element dictionary is realized without a large amount of manual annotation, the efficiency of the construction of the commodity element dictionary is improved, and the problem of poor consistency caused by manual annotation is avoided, thereby improving the quality of the commodity element dictionary.

[0160] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A dictionary construction method, characterized in that: include: Divide sentences in the target text into one or more clauses based on punctuation marks; Using a text classification model trained based on a semi-supervised learning algorithm, predicting the first probability that a clause in the target text belongs to a product element included in a pre-built product element dictionary; When the first probability that the clause belongs to the commodity element is greater than the first threshold probability, calculating the second probability that the words in the clause other than the element words currently included in the commodity element belong to the commodity element; specifically comprising: determining the probability that the words in different clauses belong to the commodity element according to the probability that the clause belongs to the commodity element; Calculating an average of probabilities that the word in different clauses belongs to the commodity element to obtain the second probability; When the second probability that the word belongs to the commodity element is greater than a second threshold probability, the word is added to the commodity element dictionary as an element word of the commodity element.

2. The dictionary construction method according to claim 1, characterized in that: Based on the semi-supervised learning algorithm, training the text classification model includes: Acquire training data based on the product element dictionary, the training data indicating one or more clauses and a first probability that the clauses belong to the product element; Inputting the training data into the text classification model to calculate a current loss function of the text classification model according to a first probability that the clause belongs to the commodity element, and optimizing the text classification model according to the current loss function; Using the optimized text classification model, predicting a third probability that the clause not containing the commodity element belongs to the commodity element; When the third probability is greater than the first threshold probability, the clause and the third probability corresponding to the clause are added to the training data to continue optimizing the text classification model.

3. The dictionary construction method according to claim 2, characterized in that: The acquiring of training data based on the product element dictionary, wherein the training data indicates one or more clauses and a first probability that the clauses belong to the product element, includes: Determining whether the clause contains an element word of a commodity element contained in the commodity element dictionary; If the clause contains the element word of the commodity element, the first probability is a first value; If the clause does not include the element word of the product element and other clauses adjacent to the clause in the same sentence include the element word of the product element, the first probability is a second value.

4. The dictionary construction method according to claim 1, characterized in that: In the case where the first probability that the clause belongs to the commodity element is greater than the first threshold probability, the method further includes: Calculate the frequency of occurrence of the word in all the clauses belonging to the same product element; One or more of the words are determined according to the order of the occurrence frequencies of the words from high to low, so as to add the words as element words of the commodity elements to the commodity element dictionary.

5. The dictionary construction method according to claim 1, characterized in that: Also includes: Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word belongs to a list of prohibited element words; When the word does not belong to the prohibited element word list, a second probability that the word belongs to the commodity element is calculated.

6. The dictionary construction method according to claim 1, characterized in that: Also includes: Before calculating the second probability that a word in the clause other than the element word currently included in the product element belongs to the product element, determining whether the word is a stop word; When the word is not a stop word, a second probability that the word belongs to the commodity element is calculated.

7. A dictionary construction device, characterized in that: include: Clause acquisition module, first probability prediction module, second probability calculation module, dictionary expansion module; wherein, The clause acquisition module is used to divide the sentences in the target text into one or more clauses according to punctuation marks; The first probability prediction module is used to predict a first probability that a clause in the target text belongs to a commodity element included in a pre-built commodity element dictionary using a text classification model trained based on a semi-supervised learning algorithm; The second probability calculation module is used to calculate the second probability that the words in the clause other than the element words currently contained in the commodity element belong to the commodity element when the first probability that the clause belongs to the commodity element is greater than the first threshold probability; specifically, to: determine the probability that the words belong to the commodity element in different clauses according to the probability that the clause belongs to the commodity element; calculate the average probability that the words belong to the commodity element in different clauses to obtain the second probability; The dictionary expansion module is configured to add the word as an element word of the commodity element to the commodity element dictionary when the second probability that the word belongs to the commodity element is greater than a second threshold probability.

8. An electronic device for dictionary construction, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.