Model training method, schedule processing method, and electronic device
By training the initial model and selecting keywords, and using metrics such as word frequency-inverse document frequency, information entropy, and information gain, the keyword selection was optimized, solving the problem of inaccurate keywords in existing technologies and improving the accuracy of calendar information creation and the model prediction probability.
Patent Information
- Application Number
- CN202411359404.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2044-09-26
AI Technical Summary
In existing technologies, the selection of keywords is not accurate or comprehensive enough, resulting in low accuracy in the creation of schedule information.
By training the initial model, keywords are selected using metrics such as word frequency-inverse document frequency, information entropy, and information gain. Combined with semantic expansion methods, the model is optimized to improve the accuracy and comprehensiveness of keywords.
It improves the accuracy of schedule information creation and the predictive probability of model output, thereby enhancing the reliability and efficiency of schedule processing.
Smart Images

Figure CN119444156B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of terminal, and in particular, to a model training method, a schedule processing method and an electronic device. BACKGROUND
[0002] In the current terminal device, user's schedule information can be added in the calendar application, for example, the schedule information can be added according to the data such as short message, email or screenshot, so as to improve the efficiency of schedule creation.
[0003] In the existing technology, the related algorithm can extract text from short message, email or screenshot, and then determine the schedule type indicated by the extracted text based on the keyword features. This method can determine the schedule type indicated by the text according to the different categories of keywords matched by the text, and then determine the title of the schedule information added in the calendar based on the recognized schedule type.
[0004] However, the current keyword selection is usually not accurate or comprehensive enough, which may cause the problem of low accuracy of schedule information creation. SUMMARY
[0005] The embodiments of the present application provide a model training method, a schedule processing method and an electronic device, which are applied to the technical field of terminal. The accuracy and comprehensiveness of keyword selection are improved, so as to improve the accuracy of schedule information creation.
[0006] In a first aspect, the embodiments of the present application provide a model training method. The method comprises: training an initial first model according to a first training set and a first keyword set to obtain a first version of the first model, the first training set comprising a plurality of training texts, each of which is marked with a corresponding real schedule category, and the first model is used to output a predicted schedule category for the training text.
[0007] In a possible implementation, the first training set and the first keyword set can be collected manually. Then, the initial first model is trained according to the first training set and the first keyword set. The first model is used to process the text and can output the prediction probability of each of the plurality of preset schedule categories corresponding to the text. It can be understood that when a training text passes through the first model, the first model can output the prediction probability of each of the plurality of preset schedule categories corresponding to the training text. In addition, the first model processes each of the plurality of training texts separately to output the prediction probability of each of the plurality of preset schedule categories corresponding to each of the plurality of training texts.
[0008] In this way, the first model, after being trained by high-quality texts and keywords, can output more accurate prediction probabilities of each of the plurality of preset schedule categories for the texts, thereby providing a more accurate data basis for subsequent processing.
[0009] Then, in order to mine more comprehensive keywords of each preset schedule category, the texts without the preset schedule category labels can be processed to obtain more accurate and comprehensive keywords belonging to each preset schedule category. This processing process can include two parts of text mining and keyword mining. First, suitable texts can be mined in the corpus, and then suitable keywords can be selected from the mined texts. The processing flow of text mining includes:
[0010] According to the first model of the first version, the prediction schedule categories of each of the plurality of reserve texts contained in the corpus are determined, and the prediction schedule categories correspond to prediction probabilities. According to the prediction schedule categories of each of the plurality of reserve texts, the prediction probabilities corresponding to each of the prediction schedule categories, and the first keyword set, a plurality of target texts are selected from the plurality of reserve texts.
[0011] Among them, according to the first model of the first version, the prediction schedule categories of each of the plurality of reserve texts contained in the corpus are determined, including:
[0012] For any reserve text in the corpus, the text vector of the reserve text is determined according to the first keyword set.
[0013] In a possible implementation, the term frequency-inverse document frequency method can be used to determine the text vector of the reserve text. For any reserve text and the keywords in the first keyword set, the term frequency-inverse document frequency of the text corresponding to all the keywords in the first keyword set can be obtained. According to the term frequency-inverse document frequency of the text corresponding to the first keyword set, the text vector corresponding to the text can be determined.
[0014] It can be understood that the term frequency-inverse document frequency composed of the term frequency of the keyword in the text and the inverse document frequency of the keyword in all texts can effectively reflect the correlation between the keyword and the text. By inputting the term frequency-inverse document frequency corresponding to the text into the model, the probability that the text belongs to the plurality of preset schedule categories can be predicted based on the correlation.
[0015] Then, the text vector of the reserve text is input into the first model of the first version to obtain the prediction probability corresponding to each of the plurality of preset schedule categories output by the first model, and the prediction probability is used to indicate the probability that the reserve text meets the preset schedule category.
[0016] And the preset schedule category with the maximum prediction probability is determined as the prediction schedule category corresponding to the reserve text.
[0017] In this way, the preset schedule category with the most obvious tendency predicted by the first model is used as the predicted schedule category corresponding to the reserved text in the corpus, ensuring the accuracy of the predicted schedule category assigned to the reserved text.
[0018] After obtaining the predicted schedule category corresponding to each of the plurality of reserved texts in the corpus, the first score corresponding to each of the plurality of intermediate texts is determined according to the predicted schedule category of each of the plurality of intermediate texts, the predicted probability corresponding to the predicted schedule category of each of the plurality of intermediate texts, and the first keyword set. The processing procedure includes:
[0019] Among the plurality of reserved texts, the plurality of intermediate texts are selected, for which the predicted probability corresponding to the predicted schedule category is greater than the first threshold.
[0020] In this way, the reserved text for which the predicted probability corresponding to the predicted schedule category is greater than the first threshold is determined as the intermediate text for text mining processing. These intermediate texts exhibit obvious tendencies, i.e., they have a high degree of relevance to their corresponding predicted schedule category. This feature ensures that they can serve as a reliable data basis in subsequent processing, thereby supporting the first model to more accurately mine and analyze text information.
[0021] Then, the first score corresponding to each of the plurality of intermediate texts is determined according to the predicted schedule category of each of the plurality of intermediate texts, the predicted probability corresponding to the predicted schedule category of each of the plurality of intermediate texts, and the first keyword set. The processing procedure includes:
[0022] For any intermediate text, the keyword density corresponding to the intermediate text is determined according to the first number of feature keywords contained in the intermediate text and the second number of words contained in the intermediate text, the feature keywords being the keywords in the first keyword set that belong to the predicted schedule category of the intermediate text, the keyword density being directly proportional to the first number and inversely proportional to the second number.
[0023] In one possible implementation, the ratio of the first number of feature keywords contained in the intermediate text to the second number of words contained in the intermediate text can be determined as the keyword density corresponding to the intermediate text.
[0024] After obtaining the keyword density corresponding to the intermediate text, the first score of the intermediate text can be determined according to the keyword density corresponding to the intermediate text and the predicted probability corresponding to the predicted schedule category of the intermediate text, the first score being directly proportional to both the keyword density and the predicted probability.
[0025] In one possible implementation, the product of the keyword density corresponding to the intermediate text and the predicted probability corresponding to the predicted schedule category of the intermediate text can be determined as the first score of the intermediate text.
[0026] Finally, the target texts can be selected from the plurality of intermediate texts according to the first scores corresponding to the plurality of intermediate texts.
[0027] In a possible implementation, the first intermediate text with the highest first score can be selected from the plurality of intermediate texts as the target text according to the first scores corresponding to the plurality of intermediate texts.
[0028] It can be understood that the keyword density can reflect the number of predicted schedule category keywords contained in the intermediate text, which mainly considers the breadth of the keywords in the text. The prediction probability reveals the degree of association between the intermediate text and the predicted schedule category, which more deeply evaluates the fit degree of the keywords in the text and the category. In this way, the relevance of the keywords and the intermediate text is measured based on the two aspects, and the text with greater relevance to the keywords is selected as the target text, which can filter out the text that best reflects the theme of the preset schedule category, and provide a solid and reliable data foundation for subsequent keyword mining processing.
[0029] After obtaining the plurality of target texts, a supplementary keyword can be selected from a plurality of vocabularies contained in the plurality of target texts according to the plurality of target texts and the plurality of vocabularies, and the process includes:
[0030] For any vocabulary in the plurality of vocabularies, a first parameter corresponding to the vocabulary and the plurality of target texts is calculated, and the first parameter is used to indicate the importance of the vocabulary in the target text.
[0031] In a possible implementation, the importance of the vocabulary in the text can be measured based on the term frequency-inverse document frequency, that is, the term frequency-inverse document frequency corresponding to the vocabulary and the target text is taken as the first parameter. Specifically, for a vocabulary and a plurality of target texts, the term frequency-inverse document frequency corresponding to the vocabulary and the plurality of target texts can be calculated. Each term frequency-inverse document frequency is used to indicate the importance of the vocabulary in a target text.
[0032] Then, the variance corresponding to the vocabulary is obtained by calculating the variance according to the first parameters corresponding to the vocabulary and the plurality of target texts.
[0033] In addition, a part of the vocabularies is selected as candidate vocabularies from the plurality of vocabularies according to the target variances corresponding to the plurality of vocabularies.
[0034] It can be understood that if the difference between the first parameters corresponding to the vocabulary and the plurality of target texts is greater, the target variance corresponding to the vocabulary is greater, which means that the text discrimination ability of the vocabulary in the plurality of target texts is stronger. On the contrary, if the difference between the first parameters corresponding to the vocabulary and the plurality of target texts is smaller, the target variance corresponding to the vocabulary is smaller, which means that the text discrimination ability of the vocabulary in the plurality of target texts is weaker.
[0035] Therefore, the words with large first parameter difference corresponding to each of the plurality of target texts can be selected as candidate keywords for subsequent keyword processing. In a possible implementation, the target variances of all words can be sorted to measure the size of the target variance of the words, and the top 200 (or any other number) with the highest target variance can be selected as candidate words.
[0036] In this way, words with high text relevance and strong text distinguishing ability can be selected to provide a solid and reliable data foundation for subsequent processing.
[0037] After obtaining the plurality of candidate words, the supplementary keywords can be selected from the plurality of candidate words according to the plurality of target texts and the plurality of candidate words. In the process of screening the plurality of candidate words, the candidate words can be measured according to some indicators to achieve the purpose of screening.
[0038] In a possible implementation, there can be an indicator named first information entropy. The first information entropy can be used to measure the uniformity of the distribution of the candidate words in the plurality of texts of a certain specific schedule category. There can also be an indicator named first information gain. The first information gain can be used to quantify the information gain brought to the target text as a whole when the candidate words are used as features.
[0039] The process of selecting supplementary keywords from the plurality of candidate words using the two indicators of the first information entropy and the first information gain includes:
[0040] For any candidate word in the plurality of candidate words, the first frequency proportion of the candidate word corresponding to each of the plurality of target texts of the first type is determined according to the third number of occurrences of the candidate word in each of the plurality of target texts of the first type and the total number of occurrences of the candidate word in the plurality of target texts of the first type, the predicted schedule category of the target text of the first type is the first schedule category, and the first schedule category is any of the plurality of preset schedule categories.
[0041] In a possible implementation, the ratio of the third number of occurrences of the candidate word in each of the plurality of target texts of the first type to the total number of occurrences of the candidate word in the plurality of target texts of the first type can be determined as the first frequency proportion of the candidate word corresponding to each of the plurality of target texts of the first type.
[0042] Then, the first information entropy of the candidate word corresponding to the first schedule category is determined according to the first frequency proportion of the candidate word corresponding to each of the plurality of target texts of the first type, and the first information entropy is inversely proportional to the difference degree of the plurality of first frequency proportions as a whole.
[0043] In a possible implementation, the uncertainty of the candidate vocabulary corresponding to the plurality of target texts can be determined based on a first frequency proportion of the candidate vocabulary corresponding to the plurality of target texts. Then, the uncertainty degrees corresponding to the plurality of target texts in the first schedule category are summed up, to obtain the first information entropy of the candidate vocabulary corresponding to the first schedule category.
[0044] It can be understood that the first information entropy can measure the distribution of the candidate vocabulary in the target texts included in the first schedule category. Therefore, according to the first information entropy of the candidate vocabulary corresponding to the first schedule category, the relevance of the candidate vocabulary to the first schedule category can be measured. Specifically, the more uniform the distribution of the candidate vocabulary in the target texts included in the first schedule category, the greater the first information entropy of the candidate vocabulary corresponding to the first schedule category, which indicates that the candidate vocabulary is likely to be a concept that is more commonly present in the target texts included in the first schedule category, and the relevance of the candidate vocabulary to the first schedule category is higher. Therefore, the vocabulary has a greater probability of becoming a keyword of the preset schedule category.
[0045] Then, the first category proportion corresponding to the first schedule category is determined according to the number of target texts whose predicted schedule category is the first schedule category, and the total number of the plurality of target texts. And the second category proportion of the candidate vocabulary corresponding to the first schedule category is determined according to the number of target texts containing the candidate vocabulary and whose predicted schedule category is the first schedule category, and the total number of target texts containing the candidate vocabulary.
[0046] In a possible implementation, the ratio of the number of target texts whose predicted schedule category is the first schedule category to the total number of the plurality of target texts can be determined as the first category proportion corresponding to the first schedule category. And the ratio of the number of target texts containing the candidate vocabulary and whose predicted schedule category is the first schedule category to the total number of target texts containing the candidate vocabulary can be determined as the second category proportion of the candidate vocabulary corresponding to the first schedule category.
[0047] Then, the first information gain of the candidate vocabulary is determined according to the first category proportion corresponding to each of the plurality of preset schedule categories, and the second category proportion of the candidate vocabulary corresponding to each of the plurality of preset schedule categories. The first information gain is proportional to the difference degree of the first category proportion and the second category proportion.
[0048] In a possible implementation, the information entropy of the target text based on the first category proportion can be calculated first, and the information entropy of the target text containing the candidate vocabulary based on the second category proportion can be calculated, and then the first information gain of the candidate vocabulary can be determined in combination with the design idea of normalization. Specifically, the difference between the information entropy of the target text based on the first category proportion and the information entropy of the target text containing the candidate vocabulary based on the second category proportion is determined first. Then, the ratio of the difference to the information entropy of the target text based on the first category proportion is determined as the first information gain corresponding to the candidate vocabulary.
[0049] The first information gain can reflect the difference between the distribution of the target text of each preset schedule category in the entire target text in the case of taking a certain candidate vocabulary as a feature (that is, the candidate vocabulary is considered) and the distribution of the target text of each preset schedule category in the entire target text in the original case (without considering the specific candidate vocabulary). The greater the first information gain corresponding to the candidate vocabulary, the greater the difference, which indicates that the greater the distribution difference of the target text of each preset schedule category in the entire target text in the case of taking a certain candidate vocabulary as a feature. In other words, the greater the distribution difference of the target text containing the candidate vocabulary in the entire target text containing the candidate vocabulary in each preset schedule category, which means that the text containing the candidate vocabulary is more concentrated in one or more preset schedule categories. Therefore, according to the first information gain corresponding to the candidate vocabulary, the category distinguishing ability of the candidate vocabulary can be determined.
[0050] Then, the second score of the candidate vocabulary is determined according to the first information entropy and the first information gain corresponding to the preset schedule category to which the candidate vocabulary belongs. The second score is directly proportional to the first information entropy and the first information gain, and the preset schedule category to which the candidate vocabulary belongs is the preset schedule category with the maximum first information entropy.
[0051] In a possible implementation, the product of the first information entropy and the first information gain corresponding to the preset schedule category to which the candidate vocabulary belongs can be determined as the second score of the candidate vocabulary.
[0052] The supplementary key word is selected from the plurality of candidate vocabularies according to the second scores corresponding to the plurality of candidate vocabularies respectively.
[0053] In a possible implementation, in order to ensure uniform classification, the candidate vocabularies under each preset schedule category can be sorted respectively. After sorting the second scores corresponding to the candidate vocabularies contained in each preset schedule category, the first candidate vocabulary with the maximum second score in each preset schedule category is selected as the supplementary key word of the preset schedule category.
[0054] In another possible implementation, the second scores of all the candidate words can be sorted to select a certain number of candidate words with the highest second scores as the supplementary keywords. The number depends on the number of preset schedule categories and the number of supplementary keywords per category.
[0055] In the present application, both the two ways can be implemented, and then the union of the candidate words is taken, and the selected candidate words are all taken as the supplementary keywords.
[0056] In this way, the relevance of the words to the preset schedule categories is measured by calculating the first information entropy and the first information gain corresponding to the words, so as to obtain the supplementary keywords that are more suitable for each preset schedule category and provide a solid data foundation for subsequent processing.
[0057] Generally, the supplementary keywords screened out through the above process are noun words, however, theoretically, verb words with obvious tendencies can also be used as keywords. At the same time, since the word frequency of noun words in the text is usually higher than that of verb words in the text, it can not be possible to screen out verb words as supplementary keywords. Therefore, the candidate keywords can be screened out again from all the verb words, and the process includes:
[0058] The candidate words with the part of speech of verb are screened out from the candidate words to obtain a plurality of verb words.
[0059] According to the plurality of target texts and the plurality of verb words, the supplementary keywords are selected from the plurality of verb words. This process is the same as the process of selecting the supplementary keywords from the plurality of target texts described above.
[0060] In this way, the limitation that verb words cannot be screened out is avoided, so that the supplementary keywords can be selected more comprehensively.
[0061] Then, the plurality of target texts are added to the first training set to obtain a second training set, and the supplementary keywords are added to the first keyword set to obtain a second keyword set. The first model of the first version is trained according to the second training set and the second keyword set to obtain a second version of the first model.
[0062] In this way, the second training set and the second keyword set are used to train the first model of the first version to optimize the first model based on more high-quality keywords, so as to improve the accuracy and reliability of the predicted probability of each predicted schedule category output by the first model.
[0063] After obtaining the second version of the first model, the operation of expanding the training set and the keyword set is repeatedly performed, and the first model is repeatedly trained according to the expanded training set and the expanded keyword set until the iteration end condition is met, so as to obtain the target version of the first model.
[0064] Thus, the first model is trained and optimized according to the training set of each round and the keyword set to improve the accuracy of the prediction probability output by the first model, and a more accurate and comprehensive keyword set is obtained.
[0065] In a possible implementation, to further expand the coverage of the keywords and discover more detailed keywords, the keyword mining can also be implemented by a semantic expansion method. For example, the keyword set expanded before the last round of model training and the training set can be used as data basis to perform secondary recall processing, so that a further expanded keyword is obtained. The process includes:
[0066] According to the first model of the target version, the prediction schedule categories of the plurality of reserve texts contained in the corpus are determined.
[0067] According to the prediction schedule categories of the plurality of reserve texts, the prediction probabilities of the respective prediction schedule categories, and the third keyword set, a plurality of expansion texts are selected from the plurality of reserve texts.
[0068] For any expansion text, a plurality of expansion keywords are determined from the plurality of keywords contained in the expansion text according to the first similarity of the respective keywords to the expansion text.
[0069] In a possible implementation, the KeyBert model can be used to process the expansion text to obtain the plurality of expansion keywords. In this process, for any expansion text, the keyword with the highest similarity to the expansion text can be selected according to the similarity of each keyword in the expansion text to the expansion text. Then, from the remaining keywords in the expansion text except the keyword, a keyword is selected as an expansion keyword according to certain rules. In a possible implementation, the similarity can be calculated according to the cosine similarity calculation method.
[0070] After the plurality of expansion keywords are obtained, the first model of the target version is trained according to the plurality of expansion keywords, the plurality of expansion texts, and the third keyword set to obtain the first model of the final version. The process includes:
[0071] For any expansion keyword in the plurality of expansion keywords, a third similarity of the expansion keyword to the second schedule category is determined according to the second similarity of the expansion keyword to the plurality of keywords belonging to the second schedule category in the third keyword set, and the second schedule category is any preset schedule category in the plurality of preset schedule categories.
[0072] In a possible implementation, the similarity between the extended vocabulary and the plurality of keywords belonging to the second schedule category can be calculated to obtain a plurality of second similarities of the extended vocabulary corresponding to the second schedule category. Then, the plurality of second similarities of the extended vocabulary corresponding to the second schedule category are averaged to determine a third similarity of the extended vocabulary corresponding to the second schedule category.
[0073] Then, according to the third similarity of the extended vocabulary corresponding to each of the plurality of preset schedule categories, the preset schedule category with the maximum third similarity and / or the preset schedule category with the third similarity greater than a second threshold value is determined as the preset schedule category to which the extended vocabulary belongs.
[0074] In a possible implementation, the preset schedule category with the maximum third similarity can be determined as the preset schedule category corresponding to the extended vocabulary. In this way, the accuracy of the determined preset schedule category corresponding to the extended vocabulary can be improved.
[0075] In a possible implementation, the preset schedule category with the greater third similarity can be determined as the preset schedule category corresponding to the extended vocabulary. In this way, one extended vocabulary can belong to one or more preset schedule categories, so that the coverage of the preset schedule category corresponding to the extended vocabulary is more comprehensive.
[0076] In a possible implementation, the preset schedule category corresponding to each extended vocabulary can be determined first. Then, the extended vocabulary with a third similarity of the preset schedule category lower than a second threshold value can be discarded, and the extended vocabulary is no longer counted in the preset schedule category, so as to further improve the accuracy of the determined preset schedule category corresponding to the extended vocabulary. The second threshold value is a preset threshold value.
[0077] After determining the preset schedule category to which the extended vocabulary belongs, a third score of the extended vocabulary can be determined according to a fourth similarity of the extended vocabulary corresponding to the preset schedule category to which the extended vocabulary belongs and a fourth number of times that the extended vocabulary appears in the plurality of extended vocabularies. The third score is directly proportional to the fourth similarity and the fourth number of times.
[0078] In a possible implementation, the product of the fourth similarity of the extended vocabulary corresponding to the preset schedule category to which the extended vocabulary belongs and the fourth number of times that the extended vocabulary appears in the plurality of extended vocabularies can be determined as the third score of the extended vocabulary.
[0079] According to the third score of each of the plurality of extended vocabularies, a supplementary keyword is determined in the plurality of extended vocabularies.
[0080] In a possible implementation, a preset threshold value can be set, and the extended vocabulary with a third score greater than or equal to the preset threshold value is determined as the supplementary keyword, and the extended vocabulary with a third score less than the preset threshold value is discarded and is not determined as the supplementary keyword.
[0081] After obtaining the supplementary keywords, the supplementary keywords contained in each preset schedule category can be further judged by combining scene artificial judgment to eliminate some supplementary keywords with low relevance to the preset schedule category.
[0082] Then, the supplementary keywords are added to the third keyword set to obtain a fourth keyword set, and the plurality of extended texts are added to the third training set to obtain a fourth training set. The third training set is the training set obtained by expansion before the last round of model training.
[0083] In addition, the first model of the target version is trained according to the fourth keyword set and the fourth training set to obtain the final version of the first model.
[0084] In this way, according to the semantic similarity between the vocabulary and the text, the differentiated vocabulary can be screened as the keyword, the diversity of the keyword is increased, and the coverage area of the keywords contained in the preset schedule category is further expanded, so as to obtain more comprehensive keywords. The accurate and comprehensive keywords obtained by expansion can make the first model more accurately recognize the schedule category corresponding to the input text.
[0085] In addition, in the present application, one corresponding first model can be trained for one language. It should be noted that after obtaining the first model of one language, when implementing keyword mining of another language, only the first training set, the first keyword set and the corpus of the target language need to be collected again, and they are input into the first model according to the above process to implement keyword mining of multiple preset schedule categories in the target language. At the same time, the first model corresponding to the target language obtained by the above process can accurately and reliably identify the schedule category of the input text to create schedule information.
[0086] In a second aspect, the embodiments of the present application provide a schedule processing method. The method comprises: in response to a first operation for submitting schedule indication data, obtaining a to-be-processed text corresponding to the schedule indication data. According to the to-be-processed text, adding schedule information corresponding to the to-be-processed text in a first application. Wherein, the first application is used to process the to-be-processed text according to the first model to obtain a schedule type output by the first model, the schedule type is used to add the schedule information in the first application, and the first model is obtained by training the above method.
[0087] In a possible implementation, the user may, for example, operate in the first application. In response to the user's operation of creating a schedule in the first application, the first application obtains schedule indication data. Then, the first application performs text extraction or OCR recognition on the schedule indication data, and the like, to obtain the to-be-processed text corresponding to the schedule indication data. After obtaining the to-be-processed text, the first application analyzes and processes the to-be-processed text according to the first model, to obtain a preset schedule category to which the to-be-processed text belongs. After obtaining the schedule category corresponding to the to-be-processed text, the schedule category can be added to the first application.
[0088] It can be understood that, based on the model training method introduced in the first aspect, the first model can output more accurate prediction probabilities of the multiple preset schedule categories corresponding to the text after receiving the text, and then determine the schedule category to which the input text belongs.
[0089] In this way, after deeply learning and mastering the related knowledge of the more comprehensive extended keywords obtained in the above training process, the first model can more accurately identify the schedule category corresponding to the to-be-processed text. This improvement not only provides a solid guarantee for the accurate creation of schedule information, but also effectively enhances the overall performance and efficiency of the first application.
[0090] In a third aspect, an embodiment of the present application provides a schedule processing apparatus. The schedule processing apparatus can be an electronic device, or a chip or chip system in the electronic device. The schedule processing apparatus can include a display unit and a processing unit.
[0091] When the schedule processing apparatus is an electronic device, the display unit can be a display screen. The display unit is configured to perform the step of displaying, so that the electronic device implements a schedule processing method described in the first aspect or any possible implementation of the first aspect.
[0092] When the schedule processing apparatus is an electronic device, the processing unit can be a processor. The schedule processing apparatus can further include a storage unit, which can be a memory. The storage unit is configured to store instructions, and the processing unit is configured to execute the instructions stored in the storage unit, so that the electronic device implements a schedule processing method described in the first aspect or any possible implementation of the first aspect.
[0093] When the schedule processing apparatus is a chip or a chip system in an electronic device, the processing unit can be a processor. The processing unit executes instructions stored in the storage unit, so that the electronic device implements a schedule processing method described in the first aspect or any possible implementation manner of the first aspect. The storage unit can be a storage unit (for example, a register, a cache, etc.) in the chip, or a storage unit (for example, a read-only memory, a random access memory, etc.) in the electronic device and located outside the chip.
[0094] For example, the processing unit is configured to process data such as text or screenshots and create schedule information based on the schedule processing apparatus. The display unit is configured to display the created schedule information.
[0095] In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory. The memory is configured to store code instructions, and the processor is configured to execute the code instructions to perform the method described in the first aspect or any possible implementation manner of the first aspect.
[0096] In a fifth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer programs or instructions. When the computer programs or instructions are executed on a computer, the computer executes the method described in the first aspect or any possible implementation manner of the first aspect.
[0097] In a sixth aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program is executed on a computer, the computer executes the method described in the first aspect or any possible implementation manner of the first aspect.
[0098] In a seventh aspect, the present application provides a chip or a chip system, including at least one processor and a communication interface. The communication interface and the at least one processor are interconnected through a line. The at least one processor is configured to execute computer programs or instructions to perform the method described in the first aspect or any possible implementation manner of the first aspect. The communication interface in the chip can be an input / output interface, a pin or a circuit, etc.
[0099] In a possible implementation, the chip or the chip system described in the present application further includes at least one memory, and the at least one memory stores instructions. The memory can be a storage unit (for example, a register, a cache, etc.) in the chip, or a storage unit (for example, a read-only memory, a random access memory, etc.) of the chip.
[0100] It should be understood that the third aspect to the seventh aspect of the present application correspond to the technical solutions of the first aspect and the second aspect of the present application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar, which will not be repeated. BRIEF DESCRIPTION OF DRAWINGS
[0101] Figure 1 A schematic diagram of a schedule creation scenario provided for an embodiment of the present application;
[0102] Figure 2 A schematic diagram of a hardware structure of a terminal device provided for an embodiment of the present application;
[0103] Figure 3 A schematic diagram of a software structure of a terminal device provided for an embodiment of the present application;
[0104] Figure 4 A schematic diagram of first model training provided for an embodiment of the present application;
[0105] Figure 5 A schematic diagram of calculating a TF-IDF value for a piece of text provided for an embodiment of the present application;
[0106] Figure 6 A schematic diagram of initial training of a first model provided for an embodiment of the present application;
[0107] Figure 7 A schematic diagram of a text mining process provided for an embodiment of the present application;
[0108] Figure 8 A schematic diagram of a keyword mining process provided for an embodiment of the present application;
[0109] Figure 9 A schematic diagram of first parameter calculation provided for an embodiment of the present application;
[0110] Figure 10 A schematic diagram of information entropy calculation provided for an embodiment of the present application;
[0111] Figure 11 A schematic diagram of first information gain calculation provided for an embodiment of the present application;
[0112] Figure 12 A schematic diagram of determining a preset schedule category to which a candidate vocabulary belongs provided for an embodiment of the present application;
[0113] Figure 13 A schematic diagram of an implementation manner of selecting a supplementary keyword in a candidate vocabulary provided for an embodiment of the present application;
[0114] Figure 14 A schematic diagram of another implementation manner of selecting a supplementary keyword in a candidate vocabulary provided for an embodiment of the present application;
[0115] Figure 15 A schematic diagram of first model training based on secondary recall provided for an embodiment of the present application;
[0116] Figure 16 A schematic diagram of schedule identification application of the first model provided for an embodiment of the present application;
[0117] Figure 17 A hardware structure schematic diagram of an electronic device provided for an embodiment of the present application. DETAILED DESCRIPTION
[0118] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, the following, some terms and technologies involved in the embodiments of the present application are briefly introduced:
[0119] 1. Term Frequency-Inverse Document Frequency (TF-IDF)
[0120] TF-IDF is used to represent the representativeness of a word or phrase to a document. In this embodiment, the document refers to a piece of text. TF represents the frequency of a word or phrase appearing in the text.
[0121] IDF represents the text discrimination ability of a word. If the frequency of a word or phrase appearing in a piece of text is high and rarely appears in other texts, it means that the word or phrase has good text discrimination ability and is suitable for classification.
[0122] The TF-IDF value is the product of the TF value and the IDF value. The larger the TF-IDF value, the higher the importance of a word or phrase in the text, and the greater the discrimination of the text, that is, the higher the representativeness of the word or phrase to the text.
[0123] 2. Key word
[0124] The key word is used to match the input text to determine the category to which the input text belongs. The key word is the core vocabulary of each category, which can accurately reflect the theme and content of the category.
[0125] 3. Secondary recall
[0126] Secondary recall can be understood as further optimization and screening of the preliminary recall result. The main purpose of the preliminary recall (rough sorting) stage is to quickly screen out a small number of candidates that may meet the user's interest from a large number of candidate sets.
[0127] After the preliminary recall, the secondary recall (fine arrangement) stage uses more complex models and methods to further accurately rank the candidate items screened out in the preliminary stage. In this embodiment, the process of expanding the keywords based on the statistical information of the words can be the preliminary recall, and the process of expanding the keywords based on the semantic relevance of the words can be the secondary recall.
[0128] 4. Other terms
[0129] In the embodiments of the present application, the same items or similar items with basically the same functions and effects are distinguished by using "first", "second", and the like. For example, the first chip and the second chip are only used to distinguish different chips, and do not limit the sequence. Those skilled in the art can understand that "first", "second", and the like do not limit the number and execution sequence, and "first", "second", and the like do not necessarily mean different.
[0130] It should be noted that in the embodiments of the present application, "exemplary" or "for example" is used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplary" or "for example" in the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the use of "exemplary" or "for example" is intended to present the relevant concept in a specific manner.
[0131] In the embodiments of the present application, "at least one" means one or more, and "multiple" means two or more. The "and / or" describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B, which can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it. "At least one of the following" or the like means any combination of these items, including any combination of single item or multiple items. For example, at least one of a, b, or c, can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.
[0132] 5. Electronic device
[0133] The electronic device of the embodiments of the present application can include a handheld device, a vehicle-mounted device, etc. having a data processing function. For example, some electronic devices are: a mobile phone, a tablet computer, a palm computer, a notebook computer, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a cellular phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital assistant (PDA), a handheld device with a wireless communication function, a computing device or other processing device connected to a wireless modem, a vehicle-mounted device, a wearable device, a terminal device in a 5G network, or a terminal device in a future evolved public land mobile network (PLMN), etc. The embodiments of the present application are not limited thereto.
[0134] By way of example and not limitation, in the embodiments of the present application, the electronic device can also be a wearable device. The wearable device can also be referred to as a wearable smart device, which is a general term for devices that are designed and developed by applying wearable technology to daily wear, such as glasses, gloves, watches, clothing, and shoes, etc. The wearable device is a portable device that is directly worn on the body or integrated into the clothes or accessories of the user. The wearable device is not only a hardware device, but also a device that realizes powerful functions through software support and data interaction and cloud interaction. The general wearable smart device includes a device with full functions and large size, which can realize complete or partial functions without relying on a smart phone, such as a smart watch or smart glasses, etc., and a device that focuses on a certain application function and needs to be used in cooperation with other devices, such as a smart phone, such as various smart wristbands and smart jewelry for monitoring vital signs, etc.
[0135] In addition, in the embodiments of the present application, the electronic device can also be a terminal device in an Internet of Things (IoT) system. The IoT is an important part of future information technology development, and its main technical feature is to connect objects through communication technology and network, so as to realize the intelligent network of man-machine interconnection and object-object interconnection.
[0136] The electronic device in the embodiments of the present application can also be referred to as a terminal device, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), an access terminal, a subscriber unit, a subscriber station, a mobile station, a mobile terminal, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communication device, a user agent, or a user equipment, etc.
[0137] In the embodiments of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes a central processing unit (CPU), a memory management unit (MMU), and a memory (also known as main memory), etc. The operating system can be any one or more computer operating systems that implement business processing through processes, such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a windows operating system, etc. The application layer includes a browser, an address book, word processing software, instant messaging software, etc.
[0138] In order to better understand the technical solutions of the present application, the related technologies involved in the present application are further described in detail below.
[0139] The schedule creation task refers to the process of creating a new schedule in the calendar after the user purchases a ticket, a train ticket, and reserves a hotel or other matters. Since it is relatively cumbersome and inconvenient to manually input the schedule title, the program for automatically identifying the schedule category can simplify the operation process and improve the efficiency of schedule creation.
[0140] The scenario of creating a new schedule in the calendar usually involves the input of text, which can come from the short message received by the user, the content of the email, or the text recognized by the Optical Character Recognition (OCR) technology after the user takes a screenshot in the software application interface.
[0141] The following will be described in combination with Figure 1 The schedule creation scenario is briefly described. Figure 1A schematic diagram of a schedule creation scenario provided by an embodiment of the present application.
[0142] In an implementation, a user can operate in a calendar application of a terminal device, for example, to provide short messages, emails or screenshots to the calendar application, and then the calendar application analyzes and processes the data to create a corresponding schedule in the calendar application.
[0143] Reference Figure 1 , the diagram contains three scenarios and created schedules. Among them, the three scenarios can be short messages, emails received by the user and screenshots of the user in the software application interface. Then, the text of the relevant transaction can be extracted or recognized according to the short messages, emails and screenshots. Based on the transaction text, a schedule can be created, and the created schedule 104 can include the title of the schedule and the specific content of the schedule. Among them, the transaction can be understood as an event made or to be made by the user. The type of schedule can be divided according to the category of the transaction. Therefore, in Figure 1 , three schedules can be created according to three different transaction categories in the above three scenarios.
[0144] As Figure 1 shown, in the first scenario 101, the user receives a short message / MMS of successful train reservation. The content of the short message can be the detailed information of the train ticket reservation, which can specifically include: train number, departure date, departure time, arrival time, departure station, terminal station, ticket purchaser and other information.
[0145] As Figure 1 shown, in the second scenario 102, the user receives an email of successful hotel reservation. The content of the email can be the detailed information of the hotel reservation, which can specifically include: the name and location of the hotel, and the check-in date and check-out date of the user's reservation.
[0146] And, in the third scenario 103, the user takes a screenshot after reserving an airplane ticket on the app of the airplane ticket reservation. The screenshot can be saved in the photo album of the mobile phone. In Figure 1 , the third scenario shows the order screenshot of the flight trip in the photo album of the mobile phone. The screenshot can contain detailed information of the airplane ticket reservation, which can specifically include: the name of the airline, the flight number of the airplane, the departure date, the departure time, the arrival time, the departure station, the terminal station and other information.
[0147] The text of the transactions in these scenarios can be obtained by performing text extraction or OCR recognition on the text or screenshots of the transactions. The types of the transactions in different scenarios can be the same or different. The types of the transactions are classified to determine the schedule titles of the transactions. The types of the transactions can include, but are not limited to, at least one of the following: train travel, high-speed rail travel, flight travel, hotel accommodation, and the like. In actual implementation, the types can be extended according to actual needs. The types can also include, for example, meetings, hospital visits, participation in activities, and movie ticket booking, and the like.
[0148] Reference Figure 1 After obtaining the text or screenshots of the transactions in the three scenarios, the text is obtained by processing the text or screenshots. The classification fields to which the transactions in the scenarios belong are determined based on the content of the text, to determine the schedule titles of the transactions.
[0149] Reference Figure 1 The three scenarios in the figure involve three transactions, which are the train ticket booking transaction 101, the hotel booking transaction 102, and the flight ticket booking transaction 103. According to the three transactions, three schedules can be created in the calendar, which are 105, 106, and 107. The titles of the three schedules can be train travel, hotel accommodation, and flight travel, respectively. The creation of the content in the schedules is not involved in the present application. Figure 1 The schedule content shown in the figure is only an example.
[0150] Next, how to distinguish the categories of the schedules to determine the titles of the schedules will be specifically introduced. In the prior art, keyword features are usually used to distinguish the categories of the schedules. The selection of the keywords of each category has a huge impact on the effect of the algorithm. Therefore, the selection of appropriate keywords is crucial.
[0151] In one scheme, a fixed template of each category can be pre-set. When the text matches the pre-set template, it is predicted that the text belongs to the category of the pre-set template, that is, it is predicted that the user wants to create the schedule of the category.
[0152] As an example, it can be assumed that the pre-set template is “Help me book a ticket for xxx today, from xxx to xxx.” The category to which the template belongs is the flight travel category. The content of the “xxx” part in the template is not fixedly constrained. The content of the “xxx” can be a place, and is irrelevant to the judgment of the category of the template. When the text matches the pre-set template, it can be predicted that the text belongs to the flight travel category, so that it is predicted that the user wants to create the schedule of the flight travel.
[0153] In one scheme, a keyword library can be pre-set, and weights can be set for keywords in the pre-set keyword library, the weights being used to represent the degree to which the keywords belong to a certain category. Then the input text is matched with keywords included in each category, and the prediction probability of each category corresponding to the text is determined according to the weights of the keywords matched by the text. Subsequently, the category to which the text belongs can be obtained according to the prediction probability of each category corresponding to the text, so that the creation type of the schedule can be determined.
[0154] As an example, for a transaction of flight travel, it can be assumed that keywords of this category include "flight number", "airport", "pick-up", and "landing". The weight corresponding to the keyword "flight number" is pre-set as 0.8, the weight corresponding to the keyword "airport" is pre-set as 0.4, the weight corresponding to the keyword "pick-up" is pre-set as 0.3, and the weight corresponding to the keyword "landing" is pre-set as 0.2. If the text matches the keyword "flight number", it indicates that the probability that the text belongs to the category of flight travel is relatively large, which means that the text can belong to the category of flight travel, i.e., the creation type of the schedule is determined. If the text matches the keyword "pick-up", it indicates that the probability that the text belongs to the category of flight travel is relatively small, which means that the text can not belong to this category but belong to other categories.
[0155] In the above two schemes, the category of the text is distinguished by matching the text with pre-set matching information, and then the title of the schedule creation is determined, based on pre-set matching information of each category. The matching information can be a template or a keyword, etc.
[0156] It can be understood that the method of matching text information based on a fixed pre-set template can achieve good results in a specific scenario, but has the problem of scenario limitation. The method of matching text by using a pre-set keyword library can have the problem of not comprehensive enough matching range.
[0157] In another implementation, a small number of basic keywords can be mined to expand the keyword library. Subsequently, keyword matching is performed by using the expanded keyword library.
[0158] In one scheme, the expansion of keywords is implemented based on the method of splitting and grouping basic keywords. However, due to different word formation methods of different languages, for example, most European languages have prefixes and suffixes, and some words are not obtained by combining two complete words. The method of directly expanding keywords by splitting and grouping cannot effectively expand to other languages.
[0159] Based on the above analysis, it can be understood that when mining keywords of a multilingual topic, the following two aspects need to be considered. On the one hand, in different scenarios, the text information of the transaction that can be obtained can be more or less, and the content of the text information can not be a fixed pattern. At this time, if the obtained text information is to be effectively matched with the keywords of the category, each category in the keyword library needs to contain as comprehensive keywords as possible to adapt to the text information obtained in different scenarios.
[0160] On the other hand, in the case of cross-language, the selection of keywords is affected by the characteristics of different languages. Due to the different cultures and connotations of each country, different countries have different language characteristics, such as great differences in vocabulary and sentence structure in different countries. Therefore, the selection and expansion of keywords are highly dependent on language knowledge, and appropriate methods need to be used to select and expand keywords according to different languages to adapt to the text information of different languages obtained in different scenarios.
[0161] Therefore, it can be understood that in the related technology described above, because the selection and expansion of keywords are affected by the feature information in the text and different language scenarios, the algorithm may not be ideal or the algorithm may not be implemented, which may affect the overall performance of the schedule processing system.
[0162] To solve the above problems, the present application proposes the following technical concept: in the process of creating a schedule based on text, the model can be used to determine the schedule category to which the text belongs, and then create corresponding schedule information. Then, in the process of training the model, for example, an initial model can be trained based on training data carrying labels (labeled text and seed keywords). Then, based on the initial model, some text that is more related to the initial keywords is mined from the corpus. Then, keywords are mined for these texts to achieve the purpose of expanding keywords. Finally, the mined keywords and the text are used to train the model again, and then the expanded keywords are applied to the model. This process continues until the model no longer improves or the model iteration reaches the number of cycles, and the training of the model is stopped, so that an effective model with expanded keywords can be obtained.
[0163] The model training method and schedule processing method of the embodiments of the present application can be executed by an electronic device provided with a processor or a chip, or can be executed by a chip, a chip system or a processor supporting the electronic device to implement the model training method and the schedule processing method, or can be executed by a logic module or software capable of implementing all or part of the functions of the electronic device. The present application does not make specific limitations. The model training method and schedule processing method of the embodiments of the present application will be described in detail below taking the electronic device as an example.
[0164] The electronic device may, for example, be a terminal device. First, a terminal device is briefly introduced below. Figure 2 The terminal device may, for example, be a terminal device. Figure 3 A terminal device is briefly introduced.
[0165] An exemplary terminal device is described below. Figure 2 A hardware structure of a terminal device is provided in an embodiment of the present application.
[0166] Figure 2 A hardware structure of a terminal device is provided in an embodiment of the present application. The terminal device may, for example, include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0167] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may, for example, include more or fewer components than those illustrated, or combine certain components, or split certain components, or arrange different components. The illustrated components may, for example, be implemented in hardware, software, or a combination of software and hardware.
[0168] The processor 110 may, for example, include one or more processing units. For example, the processor 110 may, for example, include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may, for example, be independent devices or integrated in one or more processors. In the present embodiment, the processor 110 may, for example, be used to perform various logical processing and data processing included in the model training method and the schedule processing method provided by the present application.
[0169] The terminal device implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.
[0170] The display screen 194 is used to display images, videos, and the like.
[0171] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Embodiments of the present application take the Android system with a layered architecture as an example to exemplarily illustrate the software structure of the terminal device.
[0172] Exemplarily, Figure 3 A software structure schematic diagram of a terminal device provided by an embodiment of the present application is shown.
[0173] As Figure 3 shown, the layered architecture divides the software into several layers, each of which has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system can include an application layer, an application framework layer, an Android runtime and a system library, a hardware abstraction layer (HAL), and a kernel layer. It should be noted that the embodiments of the present application take the Android system as an example for illustration, and in other operating systems (such as the Harmony system, the IOS system, etc.), as long as the functions of the various functional modules are similar to those of the embodiments of the present application, the scheme of the present application can also be implemented.
[0174] Among them, the application layer can include a series of application packages.
[0175] As Figure 3 shown, the application packages can include camera, calendar, phone, map, phone, music, settings, mailbox, video, social, and the like. Of course, the application layer can also include other application packages, such as payment applications, shopping applications, bank applications, social applications, and the like. Third-party applications are not limited in the present application. In an implementation manner, for example, the calendar application in the application layer can perform the schedule creation work introduced above. For example, the user can submit information such as short messages, emails, or screenshots in the calendar application, and then the calendar application adds corresponding schedules in the calendar application based on the processing results fed back by the underlying data processing.
[0176] The application framework layer provides an application programming interface (API) and a programming framework for the application of the application layer. The application framework layer includes some predefined functions.
[0177] As shown in Figure 3 The application framework layer can include a window manager, a content provider, a resource manager, a view system, a notification manager, and the like.
[0178] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.
[0179] The core library includes two parts: one part is the function function called by the java language, and the other part is the core library of Android.
[0180] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the java file of the application layer and the application framework layer into a binary file. The virtual machine is used to execute the management of object life cycle, stack management, thread management, security and exception management, and garbage collection.
[0181] The system library can include multiple functional modules. For example: surface manager, media library, three-dimensional graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), and the like.
[0182] The HAL layer is a packaging of the Linux kernel driver, which provides an interface upward and shields the implementation details of the low-level hardware.
[0183] The HAL layer can include Wi-Fi HAL, audio HAL, camera service (Camera HALServer) unit and software code library of the HAL layer, and the like. In the embodiment, a first model can be deployed in the HAL layer, for example, wherein the first model is used to analyze the text corresponding to the information such as short message, email or screenshot submitted by the user, so as to obtain the corresponding processing result. Then the HAL layer can feed back the processing result output by the first model to the calendar application, so that the calendar application adds the corresponding schedule.
[0184] The kernel layer is the layer between hardware and software. The kernel layer at least includes display driver, camera driver, audio driver, sensor driver.
[0185] The technical solutions of the embodiments of the present application and how the technical solutions of the embodiments of the present application solve the above technical problems will be described in detail below with specific embodiments in combination with the drawings. The following specific embodiments can be implemented independently, or can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments.
[0186] The technical solutions of the present application are related to training of a model and application of the model, which will be introduced below.
[0187] In the present embodiment, the training of the first model may, for example, include an initial training process and a subsequent post-processing process. First, the initial training process of the first model will be described in combination with specific embodiments. The following will be described in combination with Figure 4 to Figure 6 specifically, Figure 4 a schematic diagram of the training of the first model provided by the embodiments of the present application, Figure 5 a schematic diagram of calculating the TF-IDF value for a piece of text provided by the embodiments of the present application, Figure 6 a schematic diagram of the initial training of the first model provided by the embodiments of the present application. The initial training process of the first model may, for example, include the following steps:
[0188] The initial first model is trained according to the first training set and the first keyword set to obtain the first version of the first model. The first training set includes a plurality of training texts, and each of the plurality of training texts is marked with a corresponding real schedule category. The first model is used to output a predicted schedule category for the training text.
[0189] The related concepts and specific implementations in the above steps will be described below.
[0190] In the present embodiment, the first training set includes a plurality of training texts, and each of the plurality of training texts is marked with a corresponding real schedule category. The real schedule category can be understood as the correct schedule category corresponding to the training text. The set of training texts with real schedule category labels can also be referred to as any name according to actual needs, which is not limited in the present embodiment.
[0191] For example, a plurality of preset schedule categories can be pre-set in the present embodiment, wherein the preset schedule categories may, for example, include but are not limited to train travel, flight travel, hotel accommodation, etc. The specific division method of the schedule category is not limited in the present embodiment. In short, a plurality of preset schedule categories can be pre-divided according to actual needs.
[0192] For example, the real-world travel categories corresponding to the multiple training texts described above could belong to the multiple preset travel categories mentioned above. For instance, the real-world travel category corresponding to training text 1 might be train travel, and the real-world travel category corresponding to training text 2 might be flight travel, and so on.
[0193] In one implementation, multiple training texts can be selected for each preset schedule category. For example, multiple training texts belonging to the train travel schedule category and multiple training texts belonging to the flight travel schedule category can be selected, etc., to obtain the first training set described above. It is understood that the training texts described in this embodiment come from the actual schedule creation process. Therefore, in the actual schedule creation process, the schedule categories corresponding to these training texts are already clear, and the actual schedule categories corresponding to these training texts can be directly obtained. In this embodiment, the first training set can be obtained through manual collection. Since collecting the first training set consumes a lot of time and effort, a small-scale first training set can be collected to train the model. The specific amount of data corresponding to the small-scale range can be set according to actual needs, and this embodiment does not impose any restrictions on this.
[0194] In this embodiment, the first keyword set may contain multiple keywords, each corresponding to a preset schedule category in the target language. The set of keywords contained in the multiple preset schedule categories in the target language is called the first keyword set. This set of keywords can also be given any name according to actual needs; this embodiment does not impose any restrictions on this. The keywords included in the first keyword set can be understood as the core vocabulary (or basic vocabulary or seed words) of each preset schedule category, accurately reflecting the theme and content of that category in the most basic way.
[0195] The keywords included in the same preset schedule category may differ across languages. For example, taking the preset schedule category of train travel as an example, the keywords included in the Chinese train travel category might include words such as "Harmony Express" and "high-speed train," while the keywords included in the German train travel category might include words such as "Zug," "Bahnhof," and "Fahrkarte." The Chinese meaning of the word "Zug" can be similar to "train," the Chinese meaning of the word "Bahnhof" can be similar to "train station," and the Chinese meaning of the word "Fahrkarte" can be similar to "ticket."
[0196] It can be seen that for German, the text related to train travel may not contain the "Harmony" and other words described in Chinese, that is, in different languages, the keywords corresponding to the same preset schedule category are different. Accordingly, it can be understood that the keywords included in one language may not correspond to the keywords included in another language, and therefore directly translating the keywords of one language into another language cannot achieve the purpose of keyword expansion in multiple target languages.
[0197] Therefore, in order to achieve keyword expansion in multiple target languages, in the present embodiment, a first keyword set corresponding to each language can be set for different languages. The seed keywords (that is, very basic keywords) corresponding to each preset schedule category of the target language being processed are included in the first keyword set, which can be referred to as seed words. Then, keyword expansion is performed for the target language according to the first keyword set set for it, thereby effectively achieving keyword expansion in the language.
[0198] Further, the seed word can be understood as the simplest concept under each preset schedule category in the target language. The seed word can be used as a classification reference point to guide the subsequent classification process. For example, in German, "Zug (train)", "Bahnhof (train station)", and "Fahrkarte (ticket)" can be selected as seed words for the train travel category.
[0199] In one implementation, for example, in the first training set corresponding to the target language, the training texts of multiple preset schedule categories can be screened respectively to screen out the concepts commonly existing under each preset schedule category, thereby obtaining the basic keywords corresponding to each preset schedule category. The screening described herein can be manual screening or automatic screening by a machine, and the present embodiment does not limit this. In the present embodiment, the basic keywords in each preset schedule category can be set as seed words.
[0200] The first model in the present embodiment is used to process the text to output the predicted probability of each preset schedule category corresponding to the text. The present embodiment describes the training process of the first model, and therefore it can be understood that when a text passes through the first model, the first model can output the predicted probability of each preset schedule category corresponding to the text. The predicted probability is used to indicate the probability that the text conforms to the preset schedule category. Among the predicted probabilities of each preset schedule category, there is a highest predicted probability, which can be used to indicate the preset schedule category corresponding to the text predicted by the model.
[0201] As an example, it is assumed that preset schedule categories can include three categories of train travel, flight travel, and hotel accommodation. When a text corresponding vector passes through the first model, the model outputs another vector [0.25, 0.6, 0.15], which indicates that the predicted probability of the text belonging to the train travel category is 0.25, the predicted probability of the text belonging to the flight travel category is 0.6, and the predicted probability of the text belonging to the hotel accommodation category is 0.15. This means that the model predicts that the preset schedule category corresponding to the text is the flight travel category.
[0202] In actual scenarios, a text can contain information of one category or multiple preset schedule categories, but a text corresponds to one preset schedule category. As an example, there can be a text "book an airport hotel at the international airport", which contains two keywords "airport" and "hotel", and the two keywords correspond to different preset schedule categories, but in an ideal case, the preset schedule category corresponding to the text should be the hotel accommodation category. It can be understood that after a text passes through the first model, the model outputs the predicted probability of each of the multiple preset schedule categories to predict the preset schedule category to which the text belongs.
[0203] Exemplarily, the first model can be a naive Bayes model, or the specific implementation of the first model can also be arbitrarily selected according to actual needs, as long as the first model can be used to implement the functions described above.
[0204] In this embodiment, the first model can be trained by multiple training texts. In the training process of the first model, the multiple training texts can be input into the first model at one time to perform subsequent training processing. Alternatively, the multiple training texts can be input into the first model in batches to perform subsequent training processing. Alternatively, the multiple training texts can be input into the first model one by one to perform subsequent training processing.
[0205] However, it should be understood that no matter which training method is used for the multiple training texts, the first model processes the multiple training texts individually to output the predicted probability of the multiple preset schedule categories corresponding to each of the multiple training texts. At the same time, the processing method of the first model for each of the multiple training texts is similar.
[0206] The first model of the first version can refer to a model obtained by training an initial first model based on the first training set and the first keyword set. In one implementation, the training process of the first model of the first version can be as follows: Figure 4 It should be understood that the training process of the first model of the first version can correspond to Figure 4Step 1, which involves processing the training set and keyword set before inputting them into the first model 401 for training, is described below. In this embodiment, the training set and keyword set refer to the first training set and the first keyword set, respectively.
[0207] The training process for the first model in the first version is described in detail below. This process may include:
[0208] 1. Preprocess the training texts contained in the first training set.
[0209] Preprocessing operations can include word segmentation, punctuation removal, stop word removal, and case-sensitivity saving, which are used to reduce redundant or meaningless data and improve the efficiency of model training.
[0210] 2. Convert the training texts in the first training set and the keywords in the first keyword set into vector representations.
[0211] For example, the training text in the current step can refer to the training text after the preprocessing described above. Before inputting the first training set and the first keyword set into the first model, the training text contained in the first training set can be converted into vector representations based on the keywords contained in the first keyword set, to facilitate subsequent data processing by the model. Common methods for converting text into numerical form can include bag-of-words model, TF-IDF, etc.
[0212] In this embodiment, TF-IDF can be used, for example, to convert the training text into vector representations. TF-IDF measures the importance of keywords and the text distinguishing ability by calculating the TF-IDF value between keywords and text. A TF-IDF value can be obtained for each keyword and each piece of text. In this embodiment, the TF-IDF value is calculated for any keyword in the first keyword set and any training text in the first training set. The formula for calculating the TF-IDF value can satisfy the following formula:
[0213] Formula 1
[0214] In Formula 1, Indicates the first In this embodiment, the keyword specifically refers to the first keyword in the first keyword set. i One keyword. Indicates the first in the data In this embodiment, the text specifically refers to the first text in the first training set. Item text. Keywords In the sentence Word frequency in. The calculation formula can satisfy the following formula two:
[0215] Formula 2
[0216] In Formula 2, Keywords In the text The number of times it appears in the text.
[0217] In Formula 1, It is the inverse document frequency of keywords in the text. The calculation formula can satisfy the following formula three:
[0218] Formula 3
[0219] In Formula 3, Represents all text in the data In this embodiment, the number of training texts specifically refers to the number of training texts in the first training set. This indicates that the data contains the first... The number of texts containing the keyword, in this embodiment, specifically refers to the number of texts in the first training set that contain the keyword. The number of training texts containing the keyword. Adding 1 to the denominator is for smoothing to prevent a denominator of 0, meaning no sentence contains the keyword. The first keyword. It can be understood that the larger the IDF value, the more likely the first training set contains the first keyword. The fewer training texts a keyword has, the higher its discriminative power over the training texts.
[0220] Based on the above analysis, it can be understood that the larger the TF-IDF value, the higher the word frequency or inverse document frequency of the word in the text. This means that the word is more important in the training text and has a greater discriminative power for the training text.
[0221] The following is combined with Figure 5 A brief explanation of how to calculate the TF-IDF value for a single text string. For example... Figure 5As shown, assuming there is a piece of text "Ich werde um 10 Uhr mit dem Zugticket zum Flughafen fahren.", the meaning of which can refer to "I will take the train ticket to the airport at 10 o'clock in the morning.", and five keywords ["Zug", "Zugticket", "Hotel", "Termin", "Flughafen"], wherein the Chinese meaning of the word "Zug" can refer to "train", the Chinese meaning of the word "Zugticket" can refer to "train ticket", the Chinese meaning of the word "Hotel" can refer to "hotel", the Chinese meaning of the word "Termin" can refer to "date", the Chinese meaning of the word "Flughafen" can refer to "airport", and in order to facilitate subsequent calculation and description, it is assumed that the IDF value is 1. It should be understood that the IDF value of each keyword is assumed to be 1 here, but in the actual calculation process, the IDF value of each keyword may be different, which can be calculated according to Formula Three.
[0222] The TF value of each keyword for this piece of text is the word frequency of the keyword in this piece of text. As shown, Figure 5 The keyword "Zug (train)" appears 0 times in this piece of text, so the word frequency of this keyword is 0. The keyword "Zugticket (train ticket)" appears 1 time in this piece of text, so the word frequency of this keyword is 1. The keyword "Hotel (hotel)" appears 0 times in this piece of text, so the word frequency of this keyword is 0. The keyword "Termin (date)" appears 0 times in this piece of text, so the word frequency of this keyword is 0. The keyword "Flughafen (airport)" appears 1 time in this piece of text, so the word frequency of this keyword is 1.
[0223] According to the TF value and the IDF value of each keyword, the converted vector of this piece of text can be determined based on the above Formula One. .
[0224] 3. Training the first model to make category prediction.
[0225] After the pre-processing operation is performed on the data contained in the small-scale first training set and the first keyword set, and the TF-IDF vector representation, the vector corresponding to the training text is input into the first model to train the model, so as to make the model output more accurate prediction probabilities of a plurality of preset schedule categories. As shown, Figure 6 After the first training set and the first keyword set are pre-processed and converted into vectors, they are input into the first model 401.
[0226] After the above data is input into the first model, it is referred to Figure 6, the first model 401 can output the prediction probability of the plurality of preset schedule categories corresponding to the plurality of texts. Then, the prediction schedule category of the training text can be determined according to the prediction probability of each preset schedule category corresponding to the training text. And based on the prediction schedule category of the training text and the real schedule category of the text itself, the error of the prediction schedule category output by the first model can be determined.
[0227] After obtaining the error, the error is returned to the first model, and the model can continuously adjust the parameters of the model according to the error. This process will continue until the model no longer improves, or the current iteration number of the model reaches the preset number of cycles, at which time the iteration training of the model is stopped, and the first version of the first model is obtained. Figure 6
[0228] In this way, the first version of the first model obtained through the above training can output the prediction probability of each preset schedule category corresponding to each text, and can ensure the correctness of the prediction probability output by the model to provide accurate data basis for subsequent processing.
[0229] As can be understood from the above embodiments, after obtaining the first version of the first model, the first model can be used to predict the schedule category corresponding to the text. Then, in order to mine more keywords for each preset schedule category, for example, a plurality of texts in the corpus without labeled schedule categories can be input into the first version of the first model, so as to obtain the prediction schedule category of each text in the corpus. Then, the corpus is filtered based on the prediction schedule category corresponding to each text, so as to obtain a new data set, and new keywords are extracted based on the new data set. In the process of determining the new keywords, the statistical information based on the vocabulary is considered for coarse-grained filtering to preliminarily mine the keywords. And the keywords are finely filtered based on the semantic correlation of the vocabulary to further mine and select the keywords.
[0230] The above introduces the process of preliminarily mining keywords, for example, a plurality of texts can be mined in the corpus, and then new keywords are mined based on the mined texts. The following will introduce the two parts of mining texts and mining keywords respectively.
[0231] First, the process of text mining is described in combination with specific embodiments. The following will be specifically introduced in combination with Figure 4 and Figure 7 , the schematic diagram of the first model training provided by the embodiments of the present application, Figure 4 is the schematic diagram of the text mining process provided by the embodiments of the present application. The process of text mining may, for example, include the following steps: Figure 7
[0232] S701. For any one of the reserve texts in the corpus, determine a text vector of the reserve text according to the first keyword set.
[0233] The corpus includes a plurality of texts. In this embodiment, the texts included in the corpus are referred to as reserve texts. The texts included in the corpus can also be referred to as desired according to actual needs. This embodiment does not limit this. The corpus is composed of a plurality of texts without annotations, i.e., the text data in the corpus does not have a corresponding real schedule category. In order to obtain a wide corpus, these texts can come from information publicly available on Internet websites and local media news reports, etc. The texts of the corpus are not limited to texts related to schedules. The texts in the corpus can be of any content. This embodiment does not limit this.
[0234] In addition, in order to avoid repeated screening of keywords and texts that have been selected in the screening process, the data in the first training set and the data in the first keyword set included in the corpus can be checked and deleted before this round of processing, for example. Figure 4 As shown in the following formula, the data of the training set and the keyword set are excluded from the corpus.
[0235] It can be understood that the processing manner of each of the plurality of reserve texts in step S701 is similar. Therefore, any one of the reserve texts will be introduced below.
[0236] In this embodiment, the text vector of the reserve text can be determined according to the first keyword set, for example. The first keyword set has been introduced in the above embodiment and will not be described again here. In addition, the implementation of determining the text vector of the reserve text according to the first keyword set is similar to the implementation of determining the text vector of the training text according to the first keyword set introduced above. Therefore, it will not be described again here.
[0237] For example, after the corpus is collected, a pre-processing operation can also be performed on any one of the reserve texts in the corpus. The pre-processing operation introduced here is similar to the pre-processing operation introduced above and can include word segmentation, punctuation removal, stop word removal, and case preservation operations. Then, the text vector of the pre-processed reserve text can be determined according to the first keyword set. Through the pre-processing operation, the data format of the text can be effectively simplified and standardized to improve the subsequent data processing efficiency.
[0238] S702. Input the text vector of the reserve text into the first model of the first version to obtain a plurality of prediction probabilities corresponding to each of the plurality of preset schedule categories output by the first model. The prediction probability is used to indicate the probability that the reserve text meets the preset schedule category.
[0239] For example, reference can be made to Figure 4The winning bid No. 2 step to understand the current operation, refer to Figure 4 The text vector of the reserve text in the corpus can be input into the first model to obtain the prediction probability of the reserve text corresponding to each of the plurality of preset schedule categories output by the first model. The first model introduced herein can be understood as a first version of the first model.
[0240] Based on the above introduction, it can be determined that the first version of the first model is a model obtained by training the initial first model based on the first training set and the first keyword set. When the text vector of a text is input into the first version of the first model, the first model can output the prediction probability of the text corresponding to the plurality of preset schedule categories. Among them, the prediction probability is used to indicate the probability that the text conforms to the preset schedule category.
[0241] Therefore, the text vector of the reserve text can be input into the first version of the first model to obtain the prediction probability of the reserve text corresponding to each of the plurality of preset schedule categories output by the first model.
[0242] S703, determine the preset schedule category with the maximum prediction probability as the predicted schedule category corresponding to the reserve text.
[0243] In one implementation, for example, among the prediction probabilities of the plurality of preset schedule categories output by the first model, the preset schedule category with the highest prediction probability can be selected as the predicted schedule category of the reserve text.
[0244] As an example, assume that the preset schedule categories can include train travel, flight travel, and hotel accommodation. And assume that after inputting the text vector of a reserve text into the first model, the first model outputs the vector: [0.85, 0.1, 0.05], which indicates that the prediction probability of the reserve text belonging to the train travel category is 0.85, the prediction probability of belonging to the flight travel category is 0.1, and the prediction probability of belonging to the hotel accommodation category is 0.05. Based on the above three prediction probabilities, the preset schedule category with the prediction probability of 0.85 is selected as the schedule category corresponding to the reserve text, i.e. the schedule category of the reserve text is train travel.
[0245] In this way, the correctness of the predicted schedule category corresponding to the reserve text in the corpus can be ensured as much as possible.
[0246] S704, among the plurality of reserve texts, select a plurality of intermediate texts with a prediction probability corresponding to the predicted schedule category greater than a first threshold value.
[0247] For example, refer to Figure 4 The winning bid No. 3 step to understand the current operation, refer to Figure 4The prediction probabilities corresponding to the plurality of reserve texts output by the first model are processed to mine target texts with relatively large relevance to the predicted schedule category. The first model introduced herein can be understood as a first version of the first model.
[0248] It can be determined through the above analysis that the first model outputs prediction probabilities of reserve texts corresponding to each preset schedule category, and in this embodiment, the preset schedule category with the highest prediction probability is selected as the predicted schedule category of the reserve text. It can be understood that the predicted schedule category of each reserve text corresponds to a prediction probability.
[0249] It can be understood that the greater the prediction probability corresponding to the predicted schedule category of the reserve text, the higher the reliability of the reserve text belonging to the corresponding predicted schedule category. Therefore, when the reserve texts are screened, for example, the reserve texts with relatively large prediction probabilities corresponding to the predicted schedule category can be screened, and the subsequent processing is based on these reserve texts. The smaller the prediction probability corresponding to the predicted schedule category, the lower the reliability of the reserve text belonging to the corresponding predicted schedule category, and therefore, these reserve texts can be screened out.
[0250] In one implementation, for example, a first threshold value can be set, and the reserve texts are screened based on the first threshold value. The first threshold value is a threshold value for measuring the prediction probability corresponding to the predicted schedule category of the reserve text to screen the intermediate texts from the plurality of reserve texts. In this embodiment, the reserve texts screened after the preliminary screening are referred to as intermediate texts.
[0251] For example, the first threshold value can be a pre-set value. For example, the reserve texts with prediction probabilities corresponding to the predicted schedule category greater than or equal to the first threshold value are intermediate texts, and the reserve texts with prediction probabilities corresponding to the predicted schedule category less than the first threshold value are discarded and not used as intermediate texts.
[0252] For example, it is assumed that the total number of texts in the corpus is U , the first threshold value is set to 0.55, and it is assumed that the total number of reserve texts with prediction probabilities corresponding to the predicted schedule category greater than or equal to the first threshold value 0.55 is V , then the V reserve texts are used as intermediate texts for subsequent operations.
[0253] In this way, by screening the reserve texts with prediction probabilities corresponding to the predicted schedule category greater than or equal to the first threshold value as intermediate texts, the reserve texts with obvious intention can be used as intermediate texts to ensure that the intermediate texts have high relevance to the predicted schedule category corresponding to the intermediate texts, and to ensure the subsequent keyword processing.
[0254] S705. For any one intermediate text, determine a keyword density corresponding to the intermediate text according to a first quantity of feature keywords contained in the intermediate text and a second quantity of words contained in the intermediate text, the feature keywords being keywords in the first keyword set belonging to a predicted schedule category of the intermediate text, the keyword density being proportional to the first quantity and inversely proportional to the second quantity.
[0255] It can be understood that the processing manner for each of the plurality of intermediate texts in step S705 is similar, and therefore the following is introduced by taking any one intermediate text as an example.
[0256] In this embodiment, the keywords in the first keyword set belonging to the predicted schedule category of the intermediate text are defined as the feature keywords. For example, there is currently one intermediate text 1, and the predicted schedule category corresponding to the intermediate text 1 is train travel, and then the keywords in the first keyword set belonging to the schedule category of train travel are the feature keywords currently introduced. Thereafter, for example, the keyword density of the intermediate text can be determined based on the first quantity of feature keywords contained in the intermediate text and the second quantity of words contained in the intermediate text.
[0257] In one implementation, the keyword density can be used to measure the relevance of the text to the preset schedule category. The more keywords of a preset schedule category mentioned in a text, the higher the keyword density of the text corresponding to the preset schedule category, and accordingly, it indicates that the text is more relevant to the preset schedule category. Therefore, in this embodiment, the keyword density of the intermediate text and the corresponding predicted schedule category can be determined according to the first quantity and the second quantity introduced above, to measure the relevance of the intermediate text to the corresponding predicted schedule category.
[0258] It can be understood that in the case of long text, the feature keywords contained in the text itself can be more, which can cause the keyword density of the long text to be naturally higher. That is, the long text has an advantage in the calculation of keyword density. In order to balance the density of the text and reduce the influence of the length of the text on the density of the text, for example, the processing idea of normalization can be used, and the first quantity of feature keywords contained in the intermediate text is processed according to the second quantity of words contained in the intermediate text, to obtain the keyword density corresponding to the intermediate text.
[0259] In one implementation, for example, the first quantity of feature keywords contained in the intermediate text can be reduced according to the second quantity of words contained in the intermediate text, to adjust the first quantity corresponding to the intermediate text to a smaller numerical level, and then obtain the keyword density corresponding to the intermediate text.
[0260] For example, keyword density is directly proportional to a first quantity and inversely proportional to a second quantity. Specifically, the greater the first quantity of feature keywords contained in the intermediate text, and the smaller the second quantity of words contained in the intermediate text, the greater the keyword density of the intermediate text.
[0261] As an example, in one implementation, it can be assumed, for instance, that... It is the first of multiple intermediate texts The middle text, It is the first The predicted schedule category corresponding to the intermediate text, then the intermediate text The predicted schedule category corresponding to this text Keyword density Formula 4 can be satisfied as follows:
[0262] Formula 4
[0263] In Formula 4, It is intermediate text Includes categories belonging to the forecast schedule The One keyword (i.e., the feature keywords introduced above), Type ( () represents the number of unique items determined after deduplication for the feature keywords. It is intermediate text The first in The number of words. Referring to Formula 4, it can be determined that, for example, the ratio of the first number of feature keywords contained in the intermediate text to the second number of words contained in the intermediate text can be used to determine the keyword density of the intermediate text.
[0264] However, it's understandable that in actual implementation, the method of calculating the keyword density of the intermediate text based on the first number of feature keywords and the second number of words contained in the intermediate text can be arbitrarily extended according to actual needs. As long as the processing logic is based on the principle that keyword density is directly proportional to the first number and inversely proportional to the second number, it can achieve the effect of measuring the keywords in the text that predict the calendar category.
[0265] S706. Based on the keyword density corresponding to the intermediate text and the prediction probability corresponding to the predicted schedule category of the intermediate text, determine the first score of the intermediate text. The first score is proportional to both the keyword density and the prediction probability.
[0266] Based on the above introduction, it can be understood that the keyword density can be used to measure the relevance of the text and the schedule category. Specifically, the higher the keyword density, the more concentrated the keywords in the text, and accordingly, it can be indicated that the category of the keywords covered by the text for the predicted schedule category is wider.
[0267] In addition, the prediction probability corresponding to the predicted schedule category of the intermediate text can be used to indicate the possibility of the intermediate text belonging to the corresponding predicted schedule category. Specifically, the higher the prediction probability corresponding to the predicted schedule category of the intermediate text, the greater the possibility of the intermediate text belonging to the corresponding predicted schedule category.
[0268] Therefore, in the embodiment, the first score corresponding to the intermediate text can be determined according to the keyword density corresponding to the intermediate text and the prediction probability corresponding to the predicted schedule category of the intermediate text. The keyword density corresponding to the intermediate text can be regarded as starting from the breadth of the relevance of the text and the schedule category, to measure the relevance of the intermediate text and the corresponding predicted schedule category. The prediction probability can be regarded as starting from the depth of the relevance of the text and the schedule category, to measure the relevance of the intermediate text and the corresponding predicted schedule category.
[0269] Then, measuring the relevance of the intermediate text and the predicted schedule category corresponding to the intermediate text from the above two dimensions can make the mined text have greater relevance to the predicted schedule category, so as to realize further filtering of the text, thereby facilitating subsequent keyword mining processing.
[0270] In one implementation, the first score is proportional to the keyword density corresponding to the intermediate text and the prediction probability corresponding to the predicted schedule category of the intermediate text. Specifically, the greater the keyword density corresponding to the intermediate text and the greater the prediction probability corresponding to the predicted schedule category of the intermediate text, the greater the first score of the intermediate text.
[0271] As an example, in one implementation, the first score The following Formula Five can be satisfied:
[0272] Formula Five
[0273] In Formula Five, is the i-th intermediate text in the plurality of intermediate texts, is the i-th intermediate text, is the predicted schedule category corresponding to the i-th intermediate text, is the keyword density corresponding to the predicted schedule category of the i-th intermediate text, is the keyword density corresponding to the predicted schedule category of the i-th intermediate text, is the keyword density corresponding to the predicted schedule category of the i-th intermediate text, is the keyword density corresponding to the predicted schedule category of the i-th intermediate text, is the keyword density corresponding to the predicted schedule category of the i-th intermediate text, The prediction probability corresponding to the predicted schedule category of the intermediate text. It can be determined according to Formula Five that, for example, the product of the keyword density corresponding to the intermediate text and the prediction probability corresponding to the predicted schedule category of the intermediate text can be determined as the first score of the intermediate text.
[0274] However, it can be understood that, in actual implementation, the implementation manner of calculating the first score of the intermediate text according to the keyword density corresponding to the intermediate text and the prediction probability corresponding to the predicted schedule category of the intermediate text can be arbitrarily extended according to actual requirements. As long as the processing logic is proportional to the first score, the keyword density, and the prediction probability, the effect of measuring the relevance of the text and the predicted schedule category can be achieved.
[0275] S707, selecting a plurality of target texts from the plurality of intermediate texts according to the first scores corresponding to the plurality of intermediate texts respectively.
[0276] As can be understood from the above introduction, the first score corresponding to each intermediate text can reflect the relevance of the intermediate text and the predicted schedule category corresponding to the intermediate text. The greater the first score, the greater the relevance of the intermediate text and the predicted schedule category corresponding to the intermediate text.
[0277] Therefore, for example, the first intermediate text with the highest first score can be selected as the target text from the plurality of intermediate texts according to the first scores corresponding to the plurality of intermediate texts respectively.
[0278] In one implementation, the first scores of all intermediate texts can be sorted, for example, the first scores of the intermediate texts can be sorted in descending order to measure the size of the first scores of the intermediate texts, and the first intermediate text with the highest first score can be selected as the target text.
[0279] As can be understood from the above embodiments, the plurality of reserve texts in the corpus are input into the first model of the first version, and the first model can output the prediction probability of each preset schedule category corresponding to each reserve text. And the predicted schedule category corresponding to the reserve text can be determined according to the highest prediction probability. In this way, the most significant preset schedule category of the first model for the prediction of the reserve text is specified as the predicted schedule category corresponding to the reserve text, which can ensure the accuracy of the predicted schedule category assigned to the reserve text.
[0280] Then, according to the first threshold, a plurality of intermediate texts can be selected from the plurality of reserve texts. The reserve texts with a prediction probability greater than the first threshold are selected as the intermediate texts, which have a high relevance with the predicted schedule category, thereby providing an accurate and reliable data basis for subsequent processing.
[0281] Further, according to the keyword density corresponding to the plurality of intermediate texts and the prediction probability corresponding to the prediction schedule category of the intermediate text, the first score corresponding to each of the plurality of intermediate texts can be determined. Moreover, according to the first score corresponding to each of the plurality of intermediate texts, the plurality of target texts can be selected from the plurality of intermediate texts. This process comprehensively considers the breadth and depth of the relevance of the text to the schedule category, effectively quantifies the relevance of the intermediate text to the prediction schedule category, and thus filters out the text highly matched with the prediction schedule category, thereby providing reliable and solid data support for subsequent processing.
[0282] The above introduces the processing flow of text mining. The mined target text is used to implement the processing of keyword mining.
[0283] The process of keyword mining is described in combination with specific embodiments. The process of keyword mining is described in combination with specific embodiments. Figure 4 , Figure 8 to Figure 14 is specifically introduced, Figure 4 is a schematic diagram of the first model training provided by the embodiments of the present application, Figure 8 is a flowchart of the keyword mining provided by the embodiments of the present application, Figure 9 is a schematic diagram of the first parameter calculation provided by the embodiments of the present application, Figure 10 is a schematic diagram of the information entropy calculation provided by the embodiments of the present application, Figure 11 is a schematic diagram of the first information gain calculation provided by the embodiments of the present application, Figure 12 is a schematic diagram of determining the preset schedule category to which the candidate vocabulary belongs provided by the embodiments of the present application, Figure 13 is a schematic diagram of one implementation of selecting a supplementary keyword in the candidate vocabulary provided by the embodiments of the present application, Figure 14 is a schematic diagram of another implementation of selecting a supplementary keyword in the candidate vocabulary provided by the embodiments of the present application. The process of keyword mining may, for example, include the following steps:
[0284] S801. For any one of the plurality of vocabularies, a first parameter corresponding to the vocabulary for each of the plurality of target texts is calculated, the first parameter being used to indicate the importance of the vocabulary in the target text.
[0285] As can be understood from the above description, in the embodiments, the new keyword can be determined according to the plurality of target texts. For example, a plurality of vocabularies can be first determined according to the plurality of target texts, and then the new keyword can be selected from the plurality of vocabularies. The implementation of determining the plurality of vocabularies according to the plurality of target texts is first described below.
[0286] In this embodiment, for example, multiple words can be obtained by splitting multiple target texts into n-grams. A 1-gram word is essentially a single word, a 2-gram word is essentially a combination of two words, and an n-gram word is a combination of n words. For example, "Zug (train)" is a 1-gram word, and "Der Zug (train)" is a 2-gram word. This embodiment does not limit the specific implementation of n; it can be arbitrarily set according to actual needs. It should also be noted that in the process of splitting into multiple words in the n-gram form, in addition to obtaining words containing n words, it is also necessary to obtain words containing n-1 words, n-2 words, ..., and so on, until words containing only one word.
[0287] Subsequently, this embodiment will process multiple words separately, and the processing method for each word is similar. Therefore, the following description will use any one word as an example. In one implementation, for example, the importance of a word in the target text can be measured. Then, for example, a first parameter corresponding to the word in the target text can be calculated. The first parameter is used to indicate the importance of the word in the target text.
[0288] For example, the importance of words in text can be measured based on TF-IDF, that is, the TF-IDF value of a word relative to the target text can be used as the first parameter. Alternatively, the specific implementation of the first parameter can be arbitrarily chosen according to actual needs, as long as the first parameter can be used to achieve the functions described above. The following steps will be explained using the TF-IDF value as the first parameter as an example.
[0289] For example, further references can be made. Figure 9 Understanding the calculation of TF-IDF values. For example, as... Figure 9 As shown, suppose there are multiple words and multiple target texts. The multiple words can include, for example, word a, word b, and word c, and the multiple target texts can include, for example, text 1, text 2, and text 3. Then, for example, we can calculate the TF-IDF value of word a corresponding to text 1, thus obtaining value 1a as shown in the figure; and we can calculate the TF-IDF value of word a corresponding to text 2, thus obtaining value 2a as shown in the figure, and so on, to obtain the TF-IDF values of each word corresponding to each of the multiple target texts.
[0290] Each word corresponds to a TF-IDF value of multiple target texts, for example, it can be represented as: Figure 9 The form shown is a two-dimensional matrix.
[0291] S802, calculate a variance of the first parameter corresponding to the vocabulary for each of the plurality of target texts to obtain a target variance corresponding to the vocabulary.
[0292] As can be understood from the foregoing, a vocabulary can correspond to a first parameter of each of a plurality of target texts. Further, if the values of the first parameter (e.g., TF-IDF values) of the vocabulary in the plurality of target texts differ greatly, it indicates that the vocabulary appears more frequently in some target texts and less frequently or not at all in other target texts, which means that the vocabulary has strong text distinguishing ability. Conversely, if the values of the first parameter (e.g., TF-IDF values) of the vocabulary in the plurality of target texts differ less, it indicates that the vocabulary appears in most or even all of the target texts, which means that the vocabulary has poor text distinguishing ability.
[0293] When a vocabulary has strong text distinguishing ability, the likelihood that the vocabulary represents the theme of a preset schedule category is also greater. Therefore, in this embodiment, the vocabulary can be screened according to the difference of the first parameter corresponding to the vocabulary for each of the plurality of target texts. The vocabulary corresponding to a first parameter that differs greatly for each of the plurality of target texts is taken as a candidate keyword for subsequent keyword processing.
[0294] For example, the difference of the first parameter corresponding to the vocabulary for each of the plurality of target texts can be calculated to obtain a target variance corresponding to the vocabulary, and then the target variance is used to measure the difference of the first parameter corresponding to the vocabulary for each of the plurality of target texts, and the text distinguishing ability of the vocabulary in the plurality of target texts is determined.
[0295] S803, screen a part of the plurality of vocabularies as candidate vocabularies according to the target variance corresponding to each of the plurality of vocabularies.
[0296] As can be determined from the foregoing, the target variance corresponding to each of the plurality of vocabularies reflects the text distinguishing ability of each vocabulary. Specifically, the greater the target variance corresponding to the vocabulary, the stronger the text distinguishing ability of the vocabulary in the plurality of target texts, and the smaller the target variance corresponding to the vocabulary, the weaker the text distinguishing ability of the vocabulary in the plurality of target texts.
[0297] Therefore, for example, a part of the plurality of vocabularies having a greater target variance can be screened as candidate keywords according to the target variance corresponding to each of the plurality of vocabularies. The part of the vocabulary having a greater target variance is also the vocabulary having strong text distinguishing ability.
[0298] In an implementation, the target variance of all the words can be sorted, and for example, the target variance of the words can be sorted in descending order to measure the size of the target variance of the words, and then the top 200 (or any other number) of the sorted target variance can be selected as the candidate words.
[0299] S804, for any one of the plurality of candidate words, determining a first word frequency proportion of the candidate word corresponding to each of the plurality of target texts of the first type according to a third number of occurrences of the candidate word in each of the plurality of target texts of the first type and a total number of occurrences of the candidate word in the plurality of target texts of the first type, the predicted schedule category of the target text of the first type being the first schedule category, the first schedule category being any one of the plurality of preset schedule categories.
[0300] S805, determining a first information entropy of the candidate word corresponding to the first schedule category according to the first word frequency proportion of the candidate word corresponding to each of the plurality of target texts of the first type, the first information entropy being inversely proportional to the difference degree of the plurality of first word frequency proportions as a whole.
[0301] The steps of S804 and S805 are explained together below. It can be understood that the processing manner of the plurality of candidate words in steps S804 and S805 is similar, and therefore any one of the candidate words is taken as an example for introduction below.
[0302] After screening the plurality of candidate words, further screening can be performed within the range of the plurality of candidate words to obtain a plurality of screened words, which can be used as expanded keywords, for example. In the process of screening the plurality of candidate words, the candidate words can be measured according to some indicators to achieve the purpose of screening. The indicators corresponding to the screening are briefly described below.
[0303] In information theory, information entropy is an important indicator for measuring the degree of information disorder or uncertainty. Specifically, the smaller the information entropy, the lower the degree of information disorder, that is, the higher the certainty of information, which usually means that the average amount of information contained in the information is less. On the contrary, the larger the information entropy, the higher the degree of information disorder, that is, the greater the uncertainty of information, and at this time, the average amount of information contained in the information is also more.
[0304] For example, the information entropy of the candidate word corresponding to a specific schedule category can be used to measure the distribution of the candidate word in the schedule category.
[0305] In this embodiment, an index called first information entropy can be used to measure the uniformity of the distribution of candidate words across multiple texts within a specific schedule category. Taking the schedule category of "train travel" as an example, the more uniformly candidate words are distributed across multiple texts in this schedule category, the more commonly the candidate words appear in the texts of this schedule category, and therefore, the more likely the candidate words are to be key words within this schedule category. Thus, first information entropy can effectively measure the probability that candidate words can serve as keywords for a specific schedule category.
[0306] The calculation process of the first information entropy will be explained below. Before introducing the first information entropy, the calculation logic of information entropy will be briefly introduced with reference to the following formula.
[0307] In one implementation, assume there exists a batch of samples, and that these samples can be divided into multiple categories, with each sample belonging to a specific category. Then, the information entropy corresponding to this batch of samples... The calculation formula can satisfy the following formula six:
[0308] Formula Six
[0309] In Formula Six, It refers to the first in all samples The proportion of class samples to the total number of samples. It can be used to measure the degree of uncertainty corresponding to each type of sample. To simplify the calculation, refer to Formula 6; for example, the formula can be... Approximate calculation formula Through formula Calculate the uncertainty of each type of sample, and sum the uncertainty of each type of sample to obtain the information entropy of this batch of samples.
[0310] The calculation of information entropy will be illustrated below with a specific example. (Reference) Figure 10 Suppose there is a sample set containing 100 target texts, and suppose there are three preset schedule categories: train travel, flight travel, and hotel accommodation. Each of the 100 target texts has its own corresponding predicted schedule category.
[0311] Suppose that the distribution of the three preset schedule categories in these 100 target texts falls into two categories, and the information entropy of the sample set will differ accordingly in these two categories. (Reference) Figure 10In (a), assuming that out of 100 target texts, 70 are related to train travel, 20 to flight travel, and 10 to hotel accommodation, then the target texts for train travel account for 0.7% of the total target texts, the target texts for flight travel account for 0.2% of the total target texts, and the target texts for hotel accommodation account for 0.2% of the total target texts. Referring to the formula described above, the calculation process for the information entropy of the sample set can be determined as follows: The value is 0.46.
[0312] refer to Figure 10 In (b), assuming that out of 100 target texts, 34 are related to train travel, 33 to flight travel, and 33 to hotel accommodation, then the target texts for train travel account for 0.34% of the total target texts, the target texts for flight travel account for 0.33%, and the target texts for hotel accommodation account for 0.33%. Referring to the formula described above, the calculation process for the information entropy of the sample set can be determined as follows: The value is approximately 0.67.
[0313] Based on the two examples above, it can be understood that the more uniform the number of samples in each category across all samples, the greater the information entropy. Conversely, the greater the difference in the number of samples in each category across all samples, the smaller the information entropy.
[0314] By analogy with the technical solution of this embodiment, when a candidate word is more evenly distributed in multiple target texts contained in a specific schedule category, it means that the candidate word has a more significant representativeness in the text of this specific schedule category, that is, the candidate word can be regarded as the keyword under this specific schedule category.
[0315] In other words, information entropy can be used to determine whether a word appears in most of the text in a particular schedule category. If a word appears in most of the text in a particular schedule category, it indicates that the word is a relatively representative word in that schedule category.
[0316] As an example, for the train travel schedule category, in a real-world scenario, the word "train ticket" is likely to be present in all texts within this category. In other words, the word "train ticket" will appear almost everywhere in the texts of the train travel schedule category, indicating that the word "train ticket" is relatively evenly distributed in the texts of the train travel schedule category. This suggests that "train ticket" is representative of the train travel schedule category.
[0317] Building upon the aforementioned implementation of information entropy, the calculation of the first information entropy proposed in this embodiment will now be described. In this embodiment, the first information entropy corresponding to a preset schedule category can be calculated for a candidate word. Since there are multiple preset schedule categories, for ease of explanation, the first schedule category will be used as the focus of the following description. It can be understood that the first schedule category is any one of the multiple preset schedule categories.
[0318] In one implementation, the first frequency percentage of each candidate word in the target texts of the first schedule category can be determined based on the third occurrence count of each candidate word in multiple target texts of the first schedule category, and the total number of occurrences of the candidate word in the multiple target texts of the first schedule category. Then, based on the obtained first frequency percentages of each candidate word in the multiple target texts of the first schedule category, the first information entropy of the candidate word corresponding to the first schedule category can be determined. The calculation of the first frequency percentage and the first information entropy are explained below with specific formulas.
[0319] In one implementation, the first term frequency percentage of each of the multiple target texts corresponding to the first schedule category is... The calculation formula can satisfy the following formula seven:
[0320] Formula 7
[0321] In Formula 7, Representing the candidate words In the first schedule category The The number of times a candidate word appears in the text is the number of times it appears in the text. The third number to appear in the text. Representative candidate words First schedule category The number of times a candidate word appears in all texts, i.e., the total number of times a candidate word appears in multiple target texts in the first schedule category.
[0322] As can be determined by referring to Formula 7, for example, the ratio of the number of times each candidate word appears third in multiple target texts of the first schedule category to the total number of times the candidate word appears in multiple target texts of the first schedule category can be determined as the first word frequency percentage of each of the multiple target texts of the first schedule category.
[0323] After obtaining the first word frequency percentage of each of the multiple target texts corresponding to the first schedule category for candidate words, Then, based on the first word frequency ratio of each of the multiple target texts in the first schedule category, the first information entropy of the candidate words corresponding to the first schedule category can be calculated.
[0324] In one implementation, candidate words correspond to the first information entropy of the first schedule category. The calculation formula can satisfy the following formula eight:
[0325] Formula 8
[0326] Among them, formula Used for targeting the first word frequency percentage Process to obtain the first The candidate word corresponds to the first The uncertainty level is then determined. Next, the uncertainty levels corresponding to each of the multiple target texts in the first schedule category are summed to obtain the first information entropy of the candidate words corresponding to the first schedule category.
[0327] The above, in conjunction with Formulas 7 and 8, introduces possible implementations of the first word frequency ratio and the first information entropy, respectively. However, it should be understood that the implementations of the above formulas are merely illustrative examples.
[0328] In practice, the specific implementation of calculating the first word frequency percentage can be arbitrarily extended according to actual needs. As long as the processing logic is that the first word frequency percentage is directly proportional to the number of times the candidate word appears in each of the multiple target texts of the first type, and inversely proportional to the total number of times the candidate word appears in the multiple target texts of the first type, it can achieve the effect of measuring the relevance between the text and the predicted schedule category.
[0329] Furthermore, in actual implementation, the specific implementation for calculating the first information entropy can be arbitrarily extended according to actual needs. The processing logic simply needs to be inversely proportional to the overall difference in the proportion of multiple first word frequencies, so that the more evenly the candidate words are distributed across multiple target texts, the more representative the candidate words are.
[0330] S806. Based on the number of target texts whose predicted schedule category is the first schedule category and the total number of multiple target texts, determine the proportion of the first category corresponding to the first schedule category; based on the number of target texts containing candidate words and whose predicted schedule category is the first schedule category, and the total number of target texts containing candidate words, determine the proportion of the second category corresponding to the first schedule category for candidate words.
[0331] S807. Based on the proportion of the first category corresponding to each of the multiple preset schedule categories and the proportion of the second category corresponding to each of the multiple preset schedule categories, determine the first information gain corresponding to the candidate words. The first information gain is proportional to the degree of difference between the proportion of the first category and the proportion of the second category.
[0332] The following is described together with S806 and S807. It is introduced above that some indexes can be set to measure the candidate words in this embodiment to realize the screening of the candidate words. In this embodiment, there can also be an index named first information gain. Exemplarily, a first information gain can be calculated for a candidate word, and when a candidate word can be used as an effective distinguishing feature in the target texts of various preset schedule categories, the first information gain of the candidate word is relatively large. Conversely, when a candidate word cannot be used as an effective distinguishing feature in the target texts of various preset schedule categories, the first information gain of the candidate word is relatively small. That is, the first information gain in this embodiment can measure whether the candidate word can effectively distinguish the texts of various preset schedule categories.
[0333] As an example, for example, for the word "reservation", in the actual scene, the train, the plane and the hotel and other matters can be reserved, so the word "reservation" can appear in the texts of many schedule categories. For example, the word can be contained in the texts of the schedule categories corresponding to the above matters, such as train travel, flight travel and hotel accommodation. Therefore, it can be understood that the word "reservation" cannot well distinguish the multiple schedule categories, and the first information gain corresponding to the word is relatively small.
[0334] For example, for the word "xxx train station", in the actual scene, it is highly probable to appear only in the texts of the schedule category of train travel, and for other schedule categories, such as the schedule categories of flight travel or hotel accommodation, the word "xxx train station" can not appear or the probability of appearing is small. In this case, the word "xxx train station" has a high category distinguishing ability, and the first information gain corresponding to the word is also relatively large.
[0335] The following describes a possible calculation method of the first information gain. In one implementation, the calculation formula of the first information gain can satisfy the following formula nine:
[0336] Formula nine
[0337] In formula nine, can be understood as the general term of all schedule categories, refers to the number of preset schedule categories, refers to the number of target texts contained in the th preset schedule category occupies the proportion of the total number of target texts, that is, is the first category proportion. refers to the number of target texts contained in the candidate words And belongs to the first Preset schedule categories The number of target texts, accounting for the percentage of texts containing the first candidate words The proportion of the total number of target texts, i.e. This represents the percentage of the second category.
[0338] In Formula Nine, This refers to the distribution of target text for each preset schedule category among all target texts under the original conditions (without considering specific candidate words). This refers to the first When the candidate words are used as features (i.e., it is necessary to consider those containing the first word), (Candidate words), the distribution of target text for each preset schedule category in all target text. In other words, This refers to the fact that each preset schedule category contains the first... The target text containing the candidate words is in the first... The distribution of candidate words across the entire target text.
[0339] Specifically, for those containing the first candidate words If, among all the target texts, the number of target texts belonging to a certain preset schedule category is large, while the number of target texts belonging to other preset schedule categories is small, then... The smaller the value, the more it represents the first... The candidate words have strong category discrimination ability (because they appear in certain specific categories). Conversely, if for words containing the first... candidate words Of all the target texts, the number of target texts belonging to all preset schedule categories is close, that is, containing the first... candidate words If the target text is evenly distributed across each preset schedule category, then... The larger the value, the more it represents the first... The candidate words have relatively weak category discrimination ability (because they appear evenly across categories). Therefore, it is understandable that candidate words with higher category discrimination ability correspond to... The smaller the value, the better.
[0340] and The degree of difference can be used to represent, without the inclusion of the first Using candidate words as features, the distribution of target texts across multiple preset schedule categories in all target texts is statistically analyzed. Compared to adding the first candidate word, this analysis shows the distribution of target texts across all target texts. In the case of the candidate vocabulary as a feature, the statistical variation of the distribution of the target text of the plurality of preset schedule categories in all target texts is obtained, that is, the first information gain corresponding to the candidate vocabulary. Specifically, The greater the difference between , the greater the first information gain corresponding to the candidate vocabulary.
[0341] The above-mentioned "distribution of target text of a plurality of preset schedule categories in all target texts" is further explained in conjunction with a specific example. Assuming that there are currently three preset schedule categories, namely preset schedule category a, preset schedule category b, and preset schedule category c, and assuming that there are currently 100 target texts, then "the distribution of target text of a plurality of preset schedule categories in all target texts" refers to determining the text distribution of preset schedule categories a, b, and c according to the proportion of target text included in each of the preset schedule categories a, b, and c in all target texts.
[0342] Further, in order to avoid the difference in the scale of the difference, for example, the first information gain can be adjusted by using the design idea of normalization . Referring to formula nine, the difference between can be reduced and to reduce the scale of the difference.
[0343] Referring to formula nine, for example, the sum of the uncertainty of the first category proportion corresponding to each of the plurality of preset schedule categories and the difference between the sum of the uncertainty of the second category proportion corresponding to each of the plurality of preset schedule categories and the sum of the uncertainty of the first category proportion can be determined as the first information gain corresponding to the candidate vocabulary. Further, the first information gain corresponding to the candidate vocabulary can be obtained by dividing the difference by the sum of the uncertainty of the first category proportion.
[0344] However, it can be understood that in actual implementation, the implementation manner of calculating the first information gain can be arbitrarily extended according to actual needs. As long as the processing logic is proportional to the difference between the first information gain and the sum of the uncertainty of the first category proportion and the sum of the uncertainty of the second category proportion.
[0345] In order to further understand the above-mentioned content, the calculation of the first information gain will be described in conjunction with a specific example.
[0346] For example, referring to Figure 11, assuming that there is a sample set currently, the set contains 10 texts, which are text 1~text 10 shown in the figure, and assuming that there are three preset schedule categories C1, C2 and C3. Among them, it is assumed that text 1, text 2 and text 3 belong to category C1, text 4, text 5 and text 6 belong to category C2, and text 7, text 8, text 9 and text 10 belong to category C3.
[0347] Then it can be determined that the first category proportion of category C1 is , the first category proportion of category C2 is , and the first category proportion of category C3 is .
[0348] And assuming that among the 10 texts, there are three different cases of texts containing word 1, and the information gain of the sample set is also different under the corresponding three cases.
[0349] Referring to (a) in Figure 11 , it is assumed that the texts containing word 1 among the 10 texts are text 2, text 4, text 8, text 9 and text 10. Then the second category proportion of category C1 is , the second category proportion of category C2 is , and the second category proportion of category C3 is .
[0350] Referring to the formula introduced above, it can be determined that the calculation process of the information gain of the sample set is , and the value is about 0.15.
[0351] Referring to (b) in Figure 11 , it is assumed that the texts containing word 1 among the 10 texts are text 1, text 2, text 8, text 9 and text 10. Then the second category proportion of category C1 is , the second category proportion of category C2 is , and the second category proportion of category C3 is .
[0352] Referring to the formula introduced above, it can be determined that the calculation process of the information gain of the sample set is , and the value is about 0.27.
[0353] Referring to (c) in Figure 11 , it is assumed that the texts containing word 1 among the 10 texts are text 8, text 9 and text 10. Then the second category proportion of category C1 is , the second category proportion of category C2 is , and the second category proportion of category C3 is .
[0354] According to the above formula, the calculation process of the information gain of the sample set can be determined as , which is about 1.
[0355] Based on the above three examples, it can be understood that in the case of the feature of vocabulary 1 (i.e., the inclusion of vocabulary 1 needs to be considered), the more uniform the distribution of the text of each preset schedule category in the entire text, the smaller the information gain corresponding to the vocabulary. That is, the more uniform the distribution of the target text containing vocabulary 1 under each preset schedule category, for example, concentrated distribution under each preset schedule category, the smaller the information gain corresponding to vocabulary 1.
[0356] On the contrary, the greater the difference in the distribution of each preset schedule category in the entire text, the greater the information gain corresponding to the vocabulary. That is, the greater the difference in the distribution of the target text containing vocabulary 1 under each preset schedule category, for example, concentrated distribution under one or several preset schedule categories, the greater the information gain corresponding to vocabulary 1.
[0357] S808, according to the first information entropy and the first information gain corresponding to the candidate vocabulary belonging to the preset schedule category of the candidate vocabulary, determine the second score of the candidate vocabulary, the second score is proportional to the first information entropy and the first information gain, and the preset schedule category to which the candidate vocabulary belongs is the preset schedule category with the maximum first information entropy.
[0358] S809, according to the second score corresponding to each of the plurality of candidate vocabularies, selecting a supplementary keyword from the plurality of candidate vocabularies.
[0359] It can be determined from the above introduction that the first information entropy corresponding to each preset schedule category can be calculated for a candidate vocabulary, and the first information gain corresponding to each candidate vocabulary can also be calculated. In this embodiment, the score corresponding to each candidate vocabulary can be calculated based on the first information entropy and the first information gain, and then the expanded supplementary keyword is selected from the candidate vocabulary based on the score.
[0360] However, based on the above introduction, it can be determined that each candidate vocabulary actually corresponds to a plurality of first information entropies, because the first information entropy corresponding to each preset schedule category is calculated for a candidate vocabulary in the above calculation process. In order to effectively calculate the score for the candidate vocabulary, the preset schedule category to which the candidate vocabulary belongs can be determined in this embodiment, and then the score is calculated according to the first information entropy corresponding to the preset schedule category to which the candidate vocabulary belongs.
[0361] It can be understood that, the greater the first information entropy of the candidate vocabulary in a preset schedule category, the more uniform the distribution of the candidate vocabulary in the text of the preset schedule category, and the more common the occurrence. This means that the candidate vocabulary has a greater probability of belonging to the preset schedule category. Therefore, the preset schedule category with the maximum first information entropy of the candidate vocabulary can be selected as the preset schedule category to which the candidate vocabulary belongs.
[0362] As shown in Figure 12 , for example, it is assumed that there are currently three preset schedule categories of vocabulary 1 and C1, C2, and C3. And, it is assumed that the first information entropy of vocabulary 1 in category C1 is 0.64, the first information entropy of vocabulary 1 in category C2 is 0.41, and the first information entropy of vocabulary 1 in category C3 is 0.52.
[0363] Based on the above-described method to determine the schedule category to which vocabulary 1 belongs, it can be determined that category C1 is the preset schedule category to which vocabulary 1 belongs. Figure 12
[0364] It can also be understood that, after obtaining the first information entropy and the first information gain corresponding to the candidate vocabulary, the candidate vocabulary can be scored and sorted according to the first information entropy and the first information gain to determine the supplementary keyword. The second score is used to indicate the score of the first information entropy and the first information gain corresponding to the candidate vocabulary, which is used for subsequent sorting and screening of the candidate vocabulary. The score of the first information entropy and the first information gain corresponding to the candidate vocabulary can also be set arbitrarily according to actual needs, and the present embodiment does not limit this.
[0365] In one implementation, the calculation formula of the second score of the candidate vocabulary can satisfy the following formula ten:
[0366] Formula ten
[0367] In formula ten, is the category belonging of the i-th candidate vocabulary, that is, the schedule category to which the i-th candidate vocabulary belongs is the first information gain of the i-th candidate vocabulary. is the preset schedule category with the maximum first information entropy corresponding to the candidate vocabulary. is the first information gain of the i-th candidate vocabulary.
[0368] It can be determined according to formula ten that, for example, the product of the first information entropy corresponding to the candidate vocabulary and the first information gain of the candidate vocabulary can be determined as the second score corresponding to the candidate vocabulary.
[0369] However, it can be understood that in actual implementation, the implementation manner of calculating the second score corresponding to the candidate vocabulary can be extended arbitrarily according to actual requirements. As long as the processing logic is proportional to the second score, the first information entropy and the first information gain, the effect that the greater the first information entropy and the first information gain corresponding to the candidate vocabulary, the higher the score corresponding to the candidate vocabulary can be achieved.
[0370] It can be understood that after obtaining the second score of the candidate vocabulary, the supplementary keywords can be selected from the plurality of candidate vocabularies according to the second scores corresponding to the plurality of candidate vocabularies, respectively.
[0371] In this embodiment, in one implementation, the candidate vocabularies under each preset schedule category can be sorted respectively. For example, the second scores of the candidate vocabularies in the preset schedule categories can be sorted in descending order to measure the size of the second scores of the candidate vocabularies, so that the first candidate vocabularies with the highest second scores in each preset schedule category are selected as the supplementary keywords.
[0372] Specifically, in order to ensure the uniformity of classification, after sorting the second scores of the candidate vocabularies included in each preset schedule category, the first candidate vocabularies in each preset schedule category are selected as the supplementary keywords of each preset schedule category.
[0373] As an example, referring to Figure 13 , it is assumed that there are 10 candidate vocabularies, which are vocabulary 1-10, and there are two preset schedule categories C1 and C2. Among them, vocabulary 1-6 belongs to C1 category, and vocabulary 7-10 belongs to C2 category.
[0374] Referring to Figure 13 , the second scores corresponding to the vocabulary 1-10 are respectively 0.98, 0.33, 0.64, 0.82, 0.53, 0.68, 0.86, 0.55, 0.74, and 0.42.
[0375] It is assumed that 6 supplementary keywords need to be selected from the 10 candidate vocabularies for subsequent operations. The 6 supplementary keywords can be selected from the candidate vocabularies of the two categories C1 and C2, respectively, to form 3 from each category.
[0376] Referring to Figure 13 For category C1, the sequence 1301 is obtained by sorting the second scores of the word 1-6 in descending order, and the first three candidate words with the largest second scores, i.e., the word 1, the word 4 and the word 6, can be selected as the supplementary keywords of the category C1. Similarly, for category C2, the sequence 1302 is obtained by sorting the second scores of the word 7-17 in descending order, and the first three candidate words with the largest second scores, i.e., the word 7, the word 9 and the word 8, can be selected as the supplementary keywords of the category C2.
[0377] In another implementation, the second scores of all candidate words can be sorted, for example, the second scores of all candidate words can be sorted in descending order to measure the size of the second scores of the candidate words, and a certain number of candidate words with the highest second scores can be selected as the supplementary keywords. Here, the number of candidate words can depend on the number of preset schedule categories and the number of preset supplementary keywords per category. By this method, in the selected round of candidate keywords, the schedule categories to which the candidate keywords belong can have a majority of a certain category.
[0378] As an example, refer to Figure 14 Suppose there are 10 candidate words, i.e., the word 1-10, and there are two preset schedule categories, i.e., C1 and C2. Among them, the word 1-6 belongs to the category C1, and the word 7-10 belongs to the category C2.
[0379] Refer to Figure 14 The word 1-10 corresponds to the second score, respectively. Among them, the second score of the word 1 is 0.98, the second score of the word 2 is 0.33, the second score of the word 3 is 0.64, the second score of the word 4 is 0.82, the second score of the word 5 is 0.53, the second score of the word 6 is 0.68, the second score of the word 7 is 0.86, the second score of the word 8 is 0.55, the second score of the word 9 is 0.74, and the second score of the word 10 is 0.42.
[0380] Suppose 6 supplementary keywords are needed to be selected from the 10 candidate words for subsequent operations. The 6 supplementary keywords can be the first 6 candidate words with the largest second scores.
[0381] Refer to Figure 14According to the second scores of the ten candidate words, the candidate words are ranked to obtain a sequence 1401. The first six candidate words with the largest second scores, i.e., word 1, word 7, word 4, word 9, word 6 and word 3, are selected as the supplementary keywords. Among the six candidate words, word 1, word 4, word 6 and word 3 belong to the C1 category, and word 7 and word 9 belong to the C2 category. It can be understood that the candidate keywords selected by this method are mostly from the C1 category.
[0382] Generally, different keywords can be selected by the two methods. In this embodiment, both of the two methods are implemented, and then the union of the candidate words is taken, and all the selected candidate words are taken as the supplementary keywords.
[0383] In S810, the candidate words with the verb part-of-speech are selected from the candidate words, and a plurality of verb words are obtained.
[0384] As an extensible implementation manner, after the supplementary keywords are obtained, the verb words in the candidate words can be further processed to more effectively enrich the expansion of the supplementary keywords.
[0385] It can be understood that for a text, the noun words and the verb words in the text can both have relatively significant representativeness in the text. However, generally, for a text, the word frequency of the verb words in the text is less than the word frequency of the noun words in the text. Therefore, when the word frequencies of the noun words and the verb words in a text are calculated, the word frequency of the verb words in the text is always relatively low, and the word frequency of the noun words in the text is always relatively high, which can result in that the verb words in the text cannot be selected in the subsequent processing.
[0386] Therefore, the candidate words in the text can be selected again to select the verb words that can reflect the preset schedule categories.
[0387] As an example, there is a piece of text "Um 23:46 Uhr erhielt Air-Canada-Flug 759 die Erlaubnis, auf der Landebahn 28R des SFO zu landen.", in order to facilitate understanding, the Chinese translation is provided as follows: "At 11:46 pm, Air Canada Flight 759 was allowed to land on the 28R runway of SFO (San Francisco International Airport)". In this text, the word "landen" has obvious intention tendency, and its translation is "landing". In actual situation, this word may be involved in the text of flight travel category, and this verb word is probably not used universally in other types of text. Therefore, the verb word "landen" can be used as a keyword of flight travel category. However, according to the above logical introduction, it can be determined that the verb word "landen" may be missed, that is, it will not be screened out as a supplementary keyword.
[0388] In this embodiment, the words in the plurality of target texts can be labeled first. Then, the verb words are screened out from all the words, and finally the supplementary keywords are selected from the plurality of verb words.
[0389] In one implementation, the words of the text can be labeled by means of a part-of-speech tagger. In this embodiment, the words in the plurality of target texts are labeled by using the part-of-speech tagger of Spacy. As an example, several words in the above text are labeled, and the result is: erhielt: Verb, Uhr: Noun, der: Det, landebahn: Noun, landen: Verb. Among them, the Chinese meaning of the word erhielt can refer to "receive", Verb is used to indicate that the word erhielt is a verb, the Chinese meaning of the word Uhr can refer to "clock", Noun is used to indicate that the word Uhr is a noun, the Chinese meaning of the word der can refer to "of", Det is used to indicate that the word der is a preposition, the Chinese meaning of the word landebahn can refer to "runway", Noun is used to indicate that the word landebahn is a noun, and the Chinese meaning of the word landen can refer to "landing", Verb is used to indicate that the word landen is a verb.
[0390] S811. According to the plurality of target texts and the plurality of verb words, the supplementary keywords are selected from the plurality of verb words.
[0391] It can be understood that after obtaining the plurality of verb vocabularies, the supplementary keywords need to be selected from the plurality of verb vocabularies. This process is the same as the process of selecting the supplementary keywords from the plurality of target texts described above, and the specific processing process can refer to the description of the above embodiments, which will not be repeated here. It should be understood that the supplementary keywords selected in the current step and the supplementary keywords selected in the step S809 described above can finally be used as supplementary keywords for subsequent processing.
[0392] It can be determined from the above embodiments that for processing a plurality of target texts, supplementary keywords highly related to the preset schedule category can be extracted. These supplementary keywords can effectively reflect the theme of the preset schedule category, providing strong support for the first model, enabling it to more accurately and reliably match the text with the preset schedule category, and further prompting the first model to output more accurate and reliable prediction probabilities.
[0393] After obtaining the filtered target text and the extended keywords based on the process described above, the first model can be trained again in the embodiment based on the target text and the extended keywords. The following will be described in combination with Figure 4 The first model training process based on the target text and the extended keywords is described in detail. Figure 4 The first model training process based on the target text and the extended keywords is described in detail.
[0394] S1001, add a plurality of target texts to the first training set to obtain a second training set, and add the supplementary keywords to the first keyword set to obtain a second keyword set.
[0395] In order to distinguish the data in different rounds of training process, the training set to which the target text is added is called the second training set, and the keyword set to which the supplementary keywords are added is called the second keyword set in the embodiment.
[0396] In one implementation, after obtaining the target text and the supplementary keywords, refer to Figure 4 , for example, it can be judged whether the training of the first model is completed. In the case that the first model has not completed the training, for example, the operation of the 5th step in Figure 4 can be performed, so as to add the target text and the supplementary keywords to the corresponding training set and the keyword set.
[0397] S1002, training the first version of the first model according to the second training set and the second keyword set to obtain the second version of the first model.
[0398] Refer to Figure 4In the step of the winning bid No. 1, the first model of the first version can be trained according to the second training set and the second keyword set, so as to obtain the first model of the second version. The specific implementation of the model training is similar to the above description, and details are not repeated here.
[0399] S1003, after obtaining the first model of the second version, the operation of expanding the training set and the keyword set is repeatedly performed, and the first model is repeatedly trained according to the expanded training set and the expanded keyword set until the iteration end condition is met, so as to obtain the first model of the target version.
[0400] After obtaining the first model of the second version, the operation of expanding the training set and the keyword set introduced in the above embodiment can be repeatedly performed, and the first model can be repeatedly trained according to the expanded training set and the expanded keyword set until the iteration end condition is met, so as to obtain the first model of the target version.
[0401] For example, reference can be made to Figure 4 for understanding. After obtaining the first model trained in the first step, the second step, the third step and the fourth step in the figure are continued to be executed to expand the training set and the keyword set. And in the case where it is determined that the first model has not ended training, the fifth step, the first step and the second step are continued to be executed until the first model meets the condition of stopping iteration.
[0402] In one implementation, the condition of ending the model iteration can be a preset number of cycles. When the number of model iterations reaches the preset number of cycles, the iteration of the model can be stopped, and the first model of the target version is obtained. In another implementation, the model iteration is stopped until the model no longer improves, and the first model of the target version is obtained.
[0403] In this way, through multiple rounds of expansion of keywords and expansion of target text for training of the model, the first model can learn more related knowledge to output a prediction probability with high accuracy and reliability, thereby improving the performance of the first model.
[0404] The above embodiment introduces a series of processing procedures for expanding keywords. In one implementation, in order to further expand the coverage of the keywords and discover more detailed keywords, the semantic expansion method can also be used to mine the keywords in the present application. For example, the keyword set and the training set obtained by expanding before the last round of model training can be used as data basis to perform secondary recall processing, so as to obtain further expanded keywords.
[0405] The first model training process based on secondary recall will be specifically introduced below. Figure 4 and Figure 15 Figure 4 A schematic diagram of first model training provided by an embodiment of the present application is shown in FIG. 1. Figure 15 A schematic diagram of first model training based on secondary recall provided by an embodiment of the present application is shown in FIG. 2. The first model training process based on secondary recall may, for example, include the following steps:
[0406] S1501, determining, according to the first model of the target version, a predicted schedule category of each piece of reserve text contained in the corpus.
[0407] As can be determined from the above description, the first model of the target version is a first model obtained through the above process. In this embodiment, the pieces of reserve text contained in the corpus can be input into the first model of the target version, and the model will output a predicted probability of each preset schedule category corresponding to each piece of reserve text. Then, for example, the preset schedule category with the largest predicted probability can be determined as the predicted schedule category corresponding to the reserve text.
[0408] S1502, selecting, according to the predicted schedule category of each piece of reserve text, the predicted probability corresponding to each predicted schedule category, and the third keyword set, a plurality of expansion texts from the plurality of reserve texts, the third keyword set being a keyword set expanded before the last round of model training.
[0409] The implementation of selecting the plurality of expansion texts from the plurality of reserve texts is similar to the implementation of selecting the target text from the plurality of reserve texts described in the above embodiments, and will not be described here.
[0410] S1503, for any expansion text, determining a plurality of expansion keywords from a plurality of keywords contained in the expansion text according to a first similarity of each keyword to the expansion text.
[0411] In this embodiment, after obtaining the plurality of expansion texts, further screening can be performed in the expansion texts, so as to determine a plurality of expansion keywords from the plurality of keywords contained in the expansion texts.
[0412] For example, the expansion texts can be processed by a KeyBert model to obtain the plurality of expansion keywords. KeyBert is an unsupervised keyword extraction model. For an expansion text, the KeyBert model can extract and output a preset number of expansion keywords corresponding to the expansion text.
[0413] First, let's illustrate the processing effect of the KeyBert model with two examples. For instance, suppose there is a text "Patienten, die monatelang auf einen Arzttermin warteten, kommen nicht hin –nächster Termin wieder Monate später.", which translates to "Patients who have been waiting for their doctor's appointment for months have not come—their next appointment is several months away."
[0414] Inputting text into the KeyBert model and setting the preset number to 5 will return the following keyword list for the text: ["Arzttermin", "Patienten", "Monate", "warteten", "nicht"]. The Chinese meanings of "Arzttermin" (doctor's appointment), "Patienten" (patient), "Monate" (several months), "warteten" (waiting), and "nicht" (no) are all related to the concept of "not having".
[0415] When multiple extended texts are input into the KeyBert model, the model can output the extended vocabulary extracted from the multiple extended texts and the number of times each extended vocabulary appears in the candidate extended vocabulary list. The candidate extended vocabulary list refers to a preset number of extended vocabulary words extracted by the model for each extended text.
[0416] As an example, there are two German texts, "Die finnische Fluglinie Finnair streicht am Sonntag und Montag wegen eines Streiks des Kabinenpersonals rund hundert Flüge." and "dass der erste Flugtag, der von Flughafen-Mehrheitseigentümer Franz Peter Orasch versprochene Fluglinie Liliair, der für 23. April angekündigt war.", whose Chinese translations can refer to "Due to the strike of the cabin crew, Finnair will cancel about one hundred flights on Sunday and Monday." and "The first flight day of Liliair, which was promised by Franz Peter Orasch, the majority owner of the airport, has been announced for April 23rd."
[0417] The two texts are input into the KeyBert model, and the preset number is set to 5, that is, the model needs to output 5 key words for each text. For example, the 5 key words selected by the model from the first text are [“finnische”, “Fluglinie”, “Finnair”, “Streiks”, “Kabinenpersonals”], among which the Chinese meaning of the word finnische can be referred to “Finnish”, the Chinese meaning of the word Fluglinie can be referred to “airline”, the Chinese meaning of the word Finnair can be referred to “Finnair”, the Chinese meaning of the word Streiks can be referred to “strike”, and the Chinese meaning of the word Kabinenpersonals can be referred to “flight crew”. The 5 key words selected by the model from the second text are [“Mehrheitseigentümer”, “Franz”, “Fluglinie”, “Liliair”, “April”], among which the Chinese meaning of the word Mehrheitseigentümer can be referred to “majority shareholder”, the Chinese meaning of the word Franz can be referred to “Franz”, the Chinese meaning of the word Fluglinie can be referred to “airline”, the Chinese meaning of the word Liliair can be referred to “Liliair (airline name)”, and the Chinese meaning of the word April can be referred to “April”. The 10 key words are used as candidate key words. Then, the model records the number of occurrences of these candidate key words and outputs the result: {“finnische”: 1, “Fluglinie”: 2, “Finnair”: 1, “Streiks”: 1, “Kabinenpersonals”: 1, “Liliair”: 1, “April”: 1, “Franz”: 1, “Mehrheitseigentümer”: 1}.
[0418] The principle of the KeyBert model is briefly introduced as follows:
[0419] For example, the extended text can be converted into a vector representation to facilitate subsequent processing of the extended text by the model. In this embodiment, a semantic representation model is used to convert the extended text and each word in the text into a vector representation, thereby obtaining a text representation vector corresponding to the extended text and a word representation vector corresponding to each word in the extended text. For example, a paraphrase_multilingual_minillm (multi-language mini MiniLM paraphrase model) model can be used to convert the extended text and the words into a text representation vector and a word representation vector.
[0420] Afterwards, the expansion words can be selected from the words in the expansion text according to the text representation vector and the word representation vector. In this example, the MMR (Maximal Marginal Relevance) method is used to select the expansion words. The implementation steps of the MMR method include:
[0421] For any expansion text, the word with the highest similarity can be selected from the words in the expansion text according to the similarity of each word in the expansion text to the expansion text, and the word is added to the word set W Afterwards, the remaining words in the expansion text, except for the word set W , are selected one by one as expansion words according to specific rules. The process introduced above will be described in detail below in combination with specific formulas.
[0422] The calculation method of the similarity will be introduced below in combination with Formula 11. It can be understood that the similarity can be calculated for words and texts in this embodiment, and the similarity can also be calculated for words and words. Regardless of which two types of data are used to calculate the similarity, the implementation method is similar, and the similarity is calculated for vectors. Therefore, the calculation logic of the similarity will be introduced first below without distinguishing between words and texts.
[0423] In one implementation, the calculation formula of the similarity can satisfy Formula 11 as follows:
[0424] Formula 11
[0425] In Formula 11, and are any vector, and the vector here can be the vector corresponding to the word or text described above. The first similarity has a value range of [-1, 1].
[0426] It can be understood that the greater the first similarity, the higher the correlation between the word and the certain word or the word and the certain text. Therefore, the word with the highest similarity to the expansion text can be selected first as the expansion word, and the word is added to the word set W . The remaining expansion words are further filtered according to the word set W and the expansion text.
[0427] Specifically, the remaining words in the expansion text can be scored according to the similarity of the remaining words to the expansion text and the similarity of the remaining words to the word set W , and the remaining word with the highest score is selected as the second expansion word of the expansion text. For example, the selection of the second expansion word can be understood with reference to Formula 12:
[0428] Formula twelve
[0429] In formula twelve, is the first extended text, is the extended text in which the first W vocabulary in addition to the vocabulary set is contained. is the similarity between the first vocabulary in the extended text and the extended text . is the similarity between the first vocabulary in the extended text and the vocabulary set W . When the vocabulary set W contains only one extended vocabulary, the similarity between the first vocabulary and the extended vocabulary is taken as the similarity between the first vocabulary and the vocabulary set W . When the vocabulary set W contains multiple extended vocabularies, first calculate the respective similarities of the first vocabulary corresponding to the multiple extended vocabularies in the vocabulary set W , and then take the maximum similarity as the similarity between the first vocabulary and the vocabulary set W .
[0430] is an additional specified parameter, whose value range is the interval [0, 1], which can be understood as a parameter for adjusting the proportion of similarity to the text and difference to the vocabulary in the process of screening extended vocabularies.
[0431] Specifically, as an example, for example, assume that there are three vocabularies, vocabulary a, vocabulary b, and vocabulary c, and assume that there is text 1 as an extended text. Among them, vocabulary a is the vocabulary with the highest similarity to text 1, that is, the first extended vocabulary introduced above.
[0432] In addition, assume that the similarity between vocabulary b and text 1 is 0.8, and the similarity between vocabulary b and vocabulary a is 0.6. The similarity between vocabulary c and text 1 is 0.7, and the similarity between vocabulary b and vocabulary a is 0.2.
[0433] And, assume that the value of is 0.1. Then, according to the formula introduced above, it can be determined that the value of corresponding to vocabulary b is 0.66, and the value of The value is 0.61. That is, the value of word b. Value greater than word c If the value is positive, then word b can be used as the second extended word of text 1.
[0434] Furthermore, let's assume... The value is 0.2. Therefore, referring to the formula described above, we can determine the value corresponding to word b. The value is 0.52, corresponding to word c. The value is 0.52. That is, the value of word b. The value equals the value of word c. At this point, you can either discard or retain vocabulary b and vocabulary c.
[0435] Furthermore, let's assume... The value is 0.6. Therefore, referring to the formula described above, we can determine the value corresponding to word b. The value is -0.04, corresponding to word c. The value for 2 is 0.16. That is, the value for word b... Value less than word c If the value is positive, then word c can be used as the second extended word of text 1.
[0436] Based on the three examples above, it can be understood that, for different... parameter, The function takes a word and its extended text, as well as its set of words. W Different similarity metrics exist, and you can choose one based on your actual needs. The value of the parameter. In this embodiment, Set it to 0.5. Then, referring to Formula Twelve, we can determine that... The calculation results can be used as a criterion for selecting expanded vocabulary; for example, the remaining words in the expanded text can be determined separately. The calculation results are then used to determine the remaining vocabulary with the largest result as the second expanded vocabulary.
[0437] After filtering and obtaining the second extended vocabulary of the expanded text, the second extended vocabulary can be added to the vocabulary set. W and in excluding the vocabulary set W Based on this, continue to select a third extended word from the remaining words in the expanded text, and so on, until the selected extended words reach the preset number, then stop the keyword selection for the text, thus obtaining the preset number of extended words.
[0438] In this way, the extended vocabulary is filtered according to the above criteria, so that the first model can filter out relatively representative but different keywords for the preset schedule category, avoiding the situation that all the filtered keywords are similar, so as to increase the diversity of the keywords.
[0439] S1504, for any one of the plurality of extended vocabularies, according to the second similarity corresponding to each of the plurality of keywords belonging to the second schedule category contained in the third keyword set, determine the third similarity of the extended vocabulary corresponding to the second schedule category, the second schedule category is any one of the plurality of preset schedule categories.
[0440] It can be understood that after obtaining the plurality of extended vocabularies based on the extended text, it is actually not clear which preset schedule category each extended vocabulary belongs to. Therefore, in the embodiment, the preset schedule category to which the extended vocabulary belongs can be determined according to the similarity between the extended vocabulary and the keyword in the specific schedule category. It can be understood that the processing mode of the plurality of extended vocabularies is similar, so the following will be introduced by taking any one of the extended vocabularies as an example.
[0441] For the convenience of introduction, the following takes the second schedule category as the object to introduce the similarity calculation of the extended vocabulary corresponding to the plurality of keywords in the second schedule category, wherein the second schedule category can be understood as any one of the plurality of preset schedule categories.
[0442] In one implementation, the similarity between the extended vocabulary and the plurality of keywords belonging to the second schedule category can be calculated to obtain a plurality of second similarities, and then the third similarity of the extended vocabulary corresponding to the second schedule category is determined according to the plurality of second similarities of the extended vocabulary corresponding to the second schedule category, so as to determine the preset schedule category to which the extended vocabulary belongs. It should be understood that the plurality of keywords belonging to the second schedule category mentioned in the embodiment is contained in the third keyword set.
[0443] Exemplarily, after obtaining the second similarity corresponding to each of the plurality of keywords to which the extended vocabulary corresponds to the second schedule category, the third similarity of the extended vocabulary corresponding to the second schedule category can be obtained by calculating the average of the second similarities.
[0444] As an example, the calculation formula of the third similarity can satisfy the following formula thirteen:
[0445] Formula thirteen
[0446] In formula thirteen, is the second schedule category the number of keywords in the second schedule category, is the second schedule category, is the first an extension vocabulary, a third keyword in the third keyword set belonging to the second schedule category. a third keyword in the third keyword set belonging to the second schedule category. a third keyword in the third keyword set belonging to the second schedule category. a second similarity between the extension vocabulary and a third keyword in the third keyword set belonging to the second schedule category.
[0447] It can be determined according to Formula XIII that, for example, an average value of the second similarities respectively corresponding to the multiple keywords in the second schedule category to which the extension vocabulary corresponds can be taken as the third similarity of the extension vocabulary corresponding to the second schedule category.
[0448] However, it can be understood that, in actual implementation, the implementation manner of calculating the third similarity can also be extended arbitrarily according to actual requirements.
[0449] S1505, determining, according to the third similarities respectively corresponding to the multiple preset schedule categories to which the extension vocabulary corresponds, a preset schedule category with the maximum third similarity and / or a preset schedule category with the third similarity greater than a second threshold, as the preset schedule category to which the extension vocabulary belongs.
[0450] It can be understood that the third similarity can measure the similarity between the extension vocabulary and the keywords in the preset schedule category. The higher the similarity between the extension vocabulary and the keywords in the preset schedule category, the greater the relevance of the extension vocabulary to the preset schedule category, which means that the greater the probability of the extension vocabulary belonging to the preset schedule category. Conversely, the lower the similarity between the extension vocabulary and the keywords in the preset schedule category, the smaller the relevance of the extension vocabulary to the preset schedule category, which means that the smaller the probability of the extension vocabulary belonging to the preset schedule category.
[0451] Therefore, after obtaining the third similarities respectively corresponding to the multiple preset schedule categories to which the extension vocabulary corresponds, the preset schedule category to which the extension vocabulary belongs can be determined according to the sizes of the third similarities respectively corresponding to the multiple preset schedule categories to which the extension vocabulary corresponds.
[0452] Specifically, the extension vocabulary is compared with each preset schedule category, if the similarity between the extension vocabulary and a certain preset schedule category is the highest, and the similarities with other categories are lower, the extension vocabulary is counted into the candidate of the preset schedule category, and conversely, if the similarity between the extension vocabulary and a certain preset schedule category is the lowest, and the similarities with other categories are higher, the extension vocabulary is not counted into the candidate of the preset schedule category.
[0453] In an implementation, for example, the preset schedule category with the maximum third similarity can be taken as the preset schedule category corresponding to the extension vocabulary. In this way, the accuracy of the determined preset schedule category corresponding to the extension vocabulary can be improved.
[0454] In another implementation, the third similarity greater preset schedule category can be taken as the preset schedule category corresponding to the extended vocabulary. For example, a second threshold can be set, and the preset schedule category to which the extended vocabulary belongs can be determined based on the second threshold. For example, the second threshold can be a preset value. According to the second threshold, the preset schedule category with the third similarity greater than or equal to the second threshold can be taken as the preset schedule category to which the extended vocabulary belongs. In this way, one extended vocabulary can belong to one or more preset schedule categories, so that the coverage of the preset schedule category corresponding to the extended vocabulary is more comprehensive.
[0455] In addition, in one implementation, after determining the preset schedule category corresponding to each extended vocabulary, the extended vocabulary with the third similarity of the preset schedule category lower than the second threshold can be discarded, and the extended vocabulary is no longer counted in the preset schedule category, so as to further improve the accuracy of the preset schedule category determined for the extended vocabulary. In this embodiment, the second threshold can be set to 0.2, for example.
[0456] For example, for the keyword "cabin", in actual situations, it has a higher similarity with the flight class vocabulary and a lower similarity with the train class vocabulary, so the keyword "cabin" will be counted in the flight travel category and will be excluded in the train travel category.
[0457] For another example, for the keyword "direction", it belongs to a general word and can be closest to the train class vocabulary, but the keyword "direction" can have no strong correlation with the train class vocabulary, and if the third similarity is lower than the second threshold, the keyword "direction" will not be counted in the train travel category.
[0458] For another example, for the keyword "night train", it has a high similarity with the train class vocabulary, so the keyword "night train" can be counted in the train travel category.
[0459] S1506, determining a third score of the extended vocabulary according to the fourth similarity of the extended vocabulary corresponding to the preset schedule category to which the extended vocabulary belongs and the fourth number of times of occurrence of the extended vocabulary in the plurality of extended vocabularies, the third score being proportional to the fourth similarity and the fourth number of times.
[0460] It can be determined from the above introduction that the preset schedule category to which the extended vocabulary belongs is determined, and the extended vocabulary is preliminarily screened. Then, the extended vocabulary can be further screened, for example, the extended vocabulary can be scored according to the fourth similarity between the extended vocabulary and the preset schedule category to which the extended vocabulary belongs and the occurrence frequency of the extended vocabulary, and then the extended vocabulary is screened according to the score of the extended vocabulary, so as to obtain the required keyword. First, the fourth similarity and the occurrence frequency of the extended vocabulary are explained.
[0461] The calculation method of the fourth similarity between the extended vocabulary and the preset schedule category to which the extended vocabulary belongs is similar to the third similarity calculation method introduced in the above embodiment, which will not be repeated here. It can be understood that the greater the fourth similarity, the greater the relevance of the extended vocabulary to the preset schedule category to which the extended vocabulary belongs.
[0462] In addition, the number of times the extended vocabulary appears in the plurality of extended vocabularies is referred to as the fourth number of times in the embodiment. For example, it is assumed that there are an extended text 1 and an extended text 2, and it is assumed that the extended vocabulary a and the extended vocabulary b are screened for the extended text 1, and it is assumed that the extended vocabulary a and the extended vocabulary c are screened for the extended text 1. Then it can be determined that the fourth number of times of the extended vocabulary a appearing in the plurality of extended vocabularies is 2 times, and the extended vocabulary b and the extended vocabulary c are 1 time respectively. That is, the fourth number of times in the embodiment refers to the number of times an extended vocabulary appears in the extended vocabulary processing results common to a plurality of extended texts.
[0463] It can be understood that the more the candidate number of times (i.e. the fourth number of times) of the extended vocabulary, the more the number of times the extended vocabulary appears in the extended text, that is, the extended vocabulary is a more common concept in the preset schedule category. Therefore, in one implementation, the third score of the extended vocabulary can be determined according to the similarity between the extended vocabulary and the preset schedule category to which the extended vocabulary belongs and the word frequency of the extended vocabulary, so as to more comprehensively measure the relevance of the extended vocabulary to the preset schedule category. And the third score of the extended vocabulary is used to screen the extended vocabulary.
[0464] As an example, the calculation method of the third score can satisfy the following formula fourteen:
[0465] Formula fourteen
[0466] In formula fourteen, is the first extended vocabulary, is the first extended vocabulary, is the first extended vocabulary, is the first extended vocabulary, is the first extended vocabulary, is the first extended vocabulary, is the first extended vocabulary, is the first extended vocabulary, The fourth similarity among the preset schedule categories. For the first Expanded vocabulary The fourth time.
[0467] According to Formula 14, for example, the product of the fourth similarity of the extended vocabulary to its corresponding preset schedule category and the fourth number of times the extended vocabulary appears in multiple extended vocabulary items can be determined as the third score of the extended vocabulary.
[0468] However, it's understandable that the method for calculating the third score can be arbitrarily extended according to actual needs, as long as the processing logic is proportional to both the third score and the fourth similarity score, as well as the fourth frequency.
[0469] The following example illustrates the role of the third score. For instance, consider the extended term "Flixtrain," a train operating brand under the Flix company, whose Chinese translation can be found as "Flix Train." In practice, this extended term has a high relevance to train-related terms; that is, its semantics and frequency are both relatively high. Consequently, the third score for this extended term in the train travel category will be relatively high. This means that "Flixtrain" can be used as a supplementary keyword for the train travel category.
[0470] For example, there is an extended term "SBB (Schweizerische Bundesbahnen, Swiss Federal Railways). In practice, this extended term is not highly relevant to train-related terms, but it appears very frequently in texts of this type. Consequently, this extended term has a relatively high third score in the train travel category, which means that "SBB" can also be used as a supplementary keyword for the train travel category.
[0471] Thus, evaluating extended vocabulary from both semantic and frequency perspectives provides a more comprehensive measure of its relevance to the predefined schedule category. Specifically, if an extended word is semantically close to multiple keywords within its predefined schedule category, its third-order score will be higher, making it a suitable supplementary keyword for that category. Conversely, if an extended word is semantically dissimilar to multiple keywords within its predefined schedule category, but its third-order frequency is high within that category of text, its third-order score will also be higher, making it a suitable supplementary keyword for that category as well.
[0472] In addition, the supplementary keywords can be further determined by combining the scene and manual judgment, and the extended words irrelevant to the preset schedule category are removed to take the words more relevant to the preset schedule category as the supplementary keywords. The supplementary keywords can be manually screened after each round of word extension, or the supplementary keywords can be manually screened only after the last round of word extension. The specific implementation can be selected according to actual needs, and the embodiment is not limited in this regard.
[0473] S1507, determining the supplementary keywords from the multiple extended words according to the third scores of the multiple extended words.
[0474] It can be understood that after obtaining the third scores of the multiple extended words, the third scores of the multiple extended words can be compared to determine the supplementary keywords from the multiple extended words. In one implementation, for example, the extended word with a larger third score can be taken as the supplementary keyword, and the extended word with a smaller third score can not be taken as the supplementary keyword.
[0475] For example, a threshold value can be set, and the supplementary keywords can be determined based on the threshold value. For example, the threshold value can be a preset value. According to the preset threshold value, the extended word with a third score greater than or equal to the preset threshold value can be taken as the supplementary keyword, and the extended word with a third score less than the preset threshold value can be discarded and not taken as the supplementary keyword. In the embodiment, the preset threshold value can be set to 0.5.
[0476] S1508, adding the supplementary keywords to the third keyword set to obtain a fourth keyword set, and adding the multiple extended texts to the third training set to obtain a fourth training set, the third training set being the training set obtained by the last round of model training.
[0477] S1509, training the first model of the target version according to the fourth keyword set and the fourth training set to obtain the final version of the first model.
[0478] It can be determined from the above description that the third keyword set is the keyword set obtained by the last round of model training. It can be understood that the supplementary keywords obtained above are added to the third keyword set to obtain the fourth keyword set. In addition, the multiple extended texts are added to the third training set to obtain the fourth training set.
[0479] It can be understood that after obtaining the fourth keyword set and the fourth training set, the fourth keyword set and the fourth training set can be input into the first model of the target version to continue optimizing the first model to obtain the final version of the first model. For reference Figure 4The flow of the embodiment is the operation of the 6th step in the figure. The target text output by the first model and the supplementary keywords are used for secondary recall to obtain a fourth training set and a fourth keyword set, so as to train the target version of the first model and obtain the final version of the first model.
[0480] Through the above analysis, it can be understood that according to the semantic similarity of the vocabulary and the text, the application can screen out differentiated vocabulary as keywords, increase the diversity of the keywords, further expand the coverage area of the keywords contained in the preset schedule category, and obtain more comprehensive keywords.
[0481] In the embodiment, one corresponding first model can be trained for one language. It should be noted that after obtaining the first model of one language, when implementing keyword mining of another language, only the first training set, the first keyword set and the corpus of the target language need to be collected and input into the first model according to the above process to realize keyword mining of multiple preset schedule categories in the target language.
[0482] It can be understood that when collecting the first keyword set of the target language, if the first model of other languages has been obtained, it can be checked whether the seed words of the previous language appear in the first training set of the target language. If the seed words of the previous language appear in the first training set of the target language, the translated seed words of the previous language can be directly used as the seed words of the target language to improve the efficiency of collecting the seed words of the target language.
[0483] As an example, for example, the first model corresponding to German has been obtained, and the first model corresponding to Italian needs to be trained. Then the first training set, the first keyword set and the corpus of Italian are collected, and then these data are input into the first model according to the above process to guide the first model to train.
[0484] When collecting the first keyword set of Italian, the seed words of German can be translated into Italian, and then it is checked whether the data in the first training set of Italian contains the seed words translated from German into Italian. If the first training set data of Italian contains the seed words translated from German into Italian, these seed words can be directly used as the seed words of Italian, and there is no need to repeatedly select these seed words from the first training set data of Italian.
[0485] Based on the above analysis, it can be determined that the function of the first model is to output the prediction probability of the multiple preset schedule categories corresponding to the text from the text, so as to determine the preset schedule category to which the text belongs. Then the application process of the first model will be described in combination with specific embodiments.
[0486] The application process of the first model will be described in combination with specific embodiments. Figure 16The application of the first model is specifically introduced. Figure 16 The application of the first model is specifically introduced.
[0487] S1601, in response to a first operation for submitting schedule indication data, obtaining a to-be-processed text corresponding to the schedule indication data.
[0488] S1602, adding schedule information corresponding to the to-be-processed text in the first application according to the to-be-processed text.
[0489] S1603, wherein the first application is configured to process the to-be-processed text according to the first model to obtain a schedule type output by the first model, and the schedule type is used to add the schedule information in the first application.
[0490] S1601, S1602 and S1603 are described together. In this embodiment, the schedule indication data can be a short message, an email received by the user, and a screenshot of the user in the software application interface, etc. The text extracted or recognized from the schedule indication data is defined as the to-be-processed text. After obtaining the to-be-processed text, the schedule information can be created according to the to-be-processed text. The application software for creating the schedule information is defined as the first application. The first application can process the to-be-processed text according to the first model to obtain a schedule type output by the first model. The schedule type is used to add the schedule information in the first application.
[0491] Based on the above introduction, it can be determined that when a text passes through the first model, the first model can output the prediction probability of the multiple preset schedule categories corresponding to the text. According to the prediction probability of the multiple preset schedule categories corresponding to the text, the preset schedule category with the maximum prediction probability can be determined as the preset schedule category to which the text belongs.
[0492] In this embodiment, the first model is the final version of the first model trained based on the above-described embodiments, so the first model can output the prediction probability of the multiple preset schedule categories for the to-be-processed text, and then the preset schedule category to which the to-be-processed text belongs can be determined.
[0493] In one implementation manner, the user can perform an operation in the first application, for example. In response to the operation of the user creating a schedule in the first application, the first application obtains schedule indication data. Then, the first application obtains the to-be-processed text corresponding to the schedule indication data by processing the schedule indication data, and analyzes and processes the to-be-processed text in the first application, so as to obtain the preset schedule category to which the to-be-processed text belongs, and create the schedule information corresponding to the to-be-processed text in the first application.
[0494] The above process can be referred toFigure 16 The understanding is as follows. Figure 16 As shown, in response to the operation of submitting the schedule indication data in the first application, the first application acquires the short message, the mail received by the user, and the screenshot of the user in the software application interface, and the like, and processes the schedule indication data through text extraction or OCR recognition, and the like, and then extracts the to-be-processed text corresponding to the schedule indication data. After obtaining the to-be-processed text, the to-be-processed text is subjected to a preprocessing operation and a vector conversion operation to obtain a vector corresponding to the to-be-processed text, and is input into the first model 401 trained through the above embodiment. The first model 401 can output the prediction probability of each of the plurality of preset schedule types corresponding to the to-be-processed text, and the prediction schedule type to which the text belongs can be determined according to the prediction probability of each of the plurality of preset schedule types, so as to create the schedule information corresponding to the to-be-processed text.
[0495] It can be understood through the training process introduced in the above embodiment that more comprehensive keywords can be obtained for the first model, and the first model learns the related knowledge of the extended keywords in the training process, so that the first model can implement corresponding schedule category recognition based on the extended keywords in the subsequent application process, and thus the first model can more accurately identify the schedule category corresponding to the input text, and accordingly the accuracy and comprehensiveness of the first application in processing the related operation of schedule recognition can be effectively improved.
[0496] In summary, the technical solution of the present application can select more accurate and comprehensive keywords in different languages, promote the first model to output the prediction probability of the preset schedule category, and create more accurate schedule information, thereby improving the overall performance of the first application.
[0497] It should be noted that the module names involved in the embodiments of the present application can be defined as other names, as long as the functions of the modules can be implemented, and the names of the modules are not limited.
[0498] It should be noted that the user information (including but not limited to user device information, user personal information, and the like) and data (including but not limited to data for analysis, stored data, displayed data, and the like) involved in the embodiments of the present application are all information and data authorized by the user or authorized by all parties, and the collection, use, and processing of the related data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and provide corresponding operation entrances for the user to select authorization or refusal.
[0499] The model training method and the schedule processing method of the embodiments of the present application have been described above, and the device for executing the above method provided by the embodiments of the present application is described below. Those skilled in the art can understand that the method and the device can be combined and referenced with each other, and the related device provided by the embodiments of the present application can execute the steps in the above model training method and schedule processing method.
[0500] The model training method and the schedule processing method provided by the embodiments of the present application can be applied in an electronic device with a schedule processing function. The electronic device includes a terminal device, and the specific device form of the terminal device can refer to the above related description, which will not be described here.
[0501] In an implementation manner, the embodiments of the present application provide an electronic device, Figure 17 The hardware structure schematic diagram of the electronic device provided by the embodiments of the present application is shown in the figure.
[0502] As Figure 17 shown, the electronic device 1700 includes: a processor 1701 and a memory 1702; the memory 1702 stores computer execution instructions; the processor 1701 executes the computer execution instructions stored in the memory 1702, so that the electronic device 1700 executes the above method.
[0503] When the memory 1702 is independently arranged, the electronic device further includes a bus 1703 for connecting the memory 1702 and the processor 1701.
[0504] The embodiments of the present application provide a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solutions in the above embodiments. The implementation principles and technical effects are similar to those of the above related embodiments, which will not be described here.
[0505] The embodiments of the present application also provide a computer readable storage medium. The computer readable storage medium stores a computer program. The computer program is executed by the processor to implement the above method. The method described in the above embodiments can be implemented by software, hardware, firmware or any combination thereof, in whole or in part. If implemented in software, the functions can be stored as one or more instructions or codes on a computer readable medium or transmitted on a computer readable medium. The computer readable medium can include computer storage medium and communication medium, and can also include any medium that can transfer computer programs from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0506] In a possible implementation, the computer readable medium can include a RAM, a ROM, a compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that is suitable for storing desired program code in the form of instructions or data structures and that can be accessed by a computer. Also, any connection is properly termed a computer readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk, and Blu-ray® disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer readable media.
[0507] The embodiment of the present application provides a computer program product, which comprises a computer program, and when the computer program is executed, the computer executes the above method.
[0508] The embodiment of the present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiment of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device implemented in the flowcharts and / or block diagrams. Figure 1 The device that implements the function specified in one flow or multiple flows and / or blocks Figure 1 The device that implements the function specified in one flow or multiple flows and / or blocks
[0509] The above detailed description of the specific implementation is further detailed for the purpose of the present application, technical solutions, and beneficial effects, and it should be understood that the above is only a specific implementation of the present application, and is not used to limit the protection scope of the present application, and any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.
Claims
1. A model training method, characterized in that, The method comprises: training an initial first model according to a first training set and a first keyword set to obtain a first version of the first model, wherein the first training set comprises a plurality of training texts each of which is marked with a corresponding true schedule category, and the first model is used to output a predicted schedule category for the training texts; determining a predicted schedule category of each of a plurality of reserve texts contained in a corpus according to the first version of the first model, wherein the predicted schedule category corresponds to a predicted probability indicating a probability that the reserve text meets the predicted schedule category of the reserve text; selecting a plurality of target texts from the plurality of reserve texts according to the predicted schedule category of each of the plurality of reserve texts, the predicted probability corresponding to each of the predicted schedule categories, and the first keyword set; selecting a supplementary keyword from a plurality of vocabularies contained in the plurality of target texts according to the plurality of target texts and the plurality of vocabularies; adding the plurality of target texts to the first training set to obtain a second training set, and adding the supplementary keyword to the first keyword set to obtain a second keyword set; training the first version of the first model according to the second training set and the second keyword set to obtain a second version of the first model; the selecting the plurality of target texts from the plurality of reserve texts according to the predicted schedule category of each of the plurality of reserve texts, the predicted probability corresponding to each of the predicted schedule categories, and the first keyword set comprises: selecting a plurality of intermediate texts from the plurality of reserve texts, wherein the predicted probability corresponding to the predicted schedule category of each of the intermediate texts is greater than a first threshold value; determining a first score corresponding to each of the plurality of intermediate texts according to the predicted schedule category of each of the plurality of intermediate texts, the predicted probability corresponding to each of the predicted schedule categories, and the first keyword set; selecting the plurality of target texts from the plurality of intermediate texts according to the first score corresponding to each of the plurality of intermediate texts; the determining the first score corresponding to each of the plurality of intermediate texts according to the predicted schedule category of each of the plurality of intermediate texts, the predicted probability corresponding to each of the predicted schedule categories, and the first keyword set comprises: for any one of the intermediate texts, determining a keyword density corresponding to the intermediate text according to a first number of feature keywords contained in the intermediate text and a second number of vocabularies contained in the intermediate text, wherein the feature keywords are keywords in the first keyword set that belong to the predicted schedule category of the intermediate text, the keyword density is directly proportional to the first number and inversely proportional to the second number; determining the first score of the intermediate text according to the keyword density corresponding to the intermediate text and the predicted probability corresponding to the predicted schedule category of the intermediate text, wherein the first score is directly proportional to both the keyword density and the predicted probability.
2. The method of claim 1, wherein, the determining the predicted schedule category of each of the plurality of reserve texts contained in the corpus according to the first version of the first model comprises: For any one of the reserve texts in the corpus, a text vector of the reserve text is determined according to the first keyword set; The text vector of the reserve text is input into the first model of the first version to obtain a prediction probability corresponding to each of a plurality of preset schedule categories output by the first model, the prediction probability indicating a probability that the reserve text conforms to the preset schedule category; A preset schedule category with the maximum prediction probability is determined as a predicted schedule category corresponding to the reserve text.
3. The method of claim 2, wherein, The selecting of the supplementary keywords from the plurality of candidate keywords according to the plurality of target texts and the plurality of candidate keywords comprises: For any one of the plurality of keywords, a first parameter corresponding to the keyword for each of the plurality of target texts is calculated, the first parameter indicating an importance of the keyword in the target text; A target variance corresponding to the keyword is calculated according to the first parameter corresponding to the keyword for each of the plurality of target texts; A part of the plurality of keywords is filtered as candidate keywords according to the target variance corresponding to each of the plurality of keywords; The supplementary keywords are selected from the plurality of candidate keywords according to the plurality of target texts and the plurality of candidate keywords.
4. The method of claim 3, wherein, The selecting of the supplementary keywords from the plurality of candidate keywords according to the plurality of target texts and the plurality of candidate keywords comprises: For any one of the plurality of candidate keywords, a first word frequency proportion corresponding to the candidate keyword for each of the first type of target texts is determined according to a third number of occurrences of the candidate keyword in each of the first type of target texts and a total number of occurrences of the candidate keyword in the first type of target texts, the first type of target text being of a first schedule category, the first schedule category being any one of a plurality of preset schedule categories; A first information entropy corresponding to the candidate keyword for the first schedule category is determined according to the first word frequency proportion corresponding to the candidate keyword for each of the first type of target texts, the first information entropy being inversely proportional to a difference degree of a plurality of first word frequency proportions as a whole; A first category proportion corresponding to the first schedule category is determined according to a number of target texts of the first schedule category and a total number of target texts, and a second category proportion corresponding to the candidate keyword for the first schedule category is determined according to a number of target texts containing the candidate keyword and being of the first schedule category and a total number of target texts containing the candidate keyword; A first information gain corresponding to the candidate keyword is determined according to the first category proportion corresponding to each of the plurality of preset schedule categories and the second category proportion corresponding to the candidate keyword for each of the plurality of preset schedule categories, the first information gain being proportional to a difference degree of the first category proportion and the second category proportion. determine a second score of the candidate vocabulary according to the first information entropy and the first information gain, the second score being proportional to both the first information entropy and the first information gain, the preset schedule category to which the candidate vocabulary belongs being the preset schedule category with the maximum first information entropy; select the supplementary keyword from the candidate vocabularies according to the second scores corresponding to the candidate vocabularies.
5. The method of claim 4, wherein, The method further comprises: filtering the candidate vocabularies to obtain a plurality of verb vocabularies, the candidate vocabularies being the candidate vocabularies with a part of speech being a verb; selecting a supplementary keyword from the verb vocabularies according to the target texts and the verb vocabularies.
6. The method according to any one of claims 1 to 5, characterized in that, After obtaining the second version of the first model, the method further comprises: repeating the operations of expanding the training set and the keyword set, and repeatedly training the first model according to the expanded training set and the expanded keyword set until an iteration end condition is met, to obtain a target version of the first model.
7. The method of claim 6, wherein, The method further comprises: determining a predicted schedule category of each of a plurality of reserve texts included in a corpus according to the target version of the first model; selecting a plurality of extended texts from the reserve texts according to the predicted schedule categories of the reserve texts, the predicted probabilities corresponding to the predicted schedule categories, and a third keyword set, the third keyword set being the keyword set obtained before the last round of model training; for any one of the extended texts, determining a plurality of extended vocabularies from a plurality of vocabularies included in the extended text according to first similarities between the vocabularies and the extended text; training the target version of the first model according to the extended vocabularies, the extended texts, and the third keyword set, to obtain a final version of the first model.
8. The method of claim 7, wherein, The training of the target version of the first model according to the extended vocabularies, the extended texts, and the third keyword set, to obtain a final version of the first model, comprises: for any one of the extended vocabularies, determining a third similarity of the extended vocabulary corresponding to a second schedule category according to second similarities between the extended vocabulary and a plurality of keywords belonging to the second schedule category and included in the third keyword set, the second schedule category being any one of a plurality of preset schedule categories; determining a preset schedule category with a maximum third similarity and / or a preset schedule category with a third similarity greater than a second threshold value, as the preset schedule category to which the extended vocabulary belongs, according to the third similarities of the extended vocabulary corresponding to the plurality of preset schedule categories; determining a third score of the extended vocabulary according to a fourth similarity of the extended vocabulary corresponding to the preset schedule category to which the extended vocabulary belongs and a fourth number of times that the extended vocabulary appears in the extended vocabularies, the third score being proportional to both the fourth similarity and the fourth number of times. determining a supplementary keyword from the plurality of extended vocabularies according to third scores of the plurality of extended vocabularies respectively; adding the supplementary keyword to the third keyword set to obtain a fourth keyword set, and adding the plurality of extended texts to the third training set to obtain a fourth training set, the third training set being the training set obtained by expansion before the last round of model training; training the first model of the target version according to the fourth keyword set and the fourth training set to obtain a final version of the first model.
9. A schedule processing method characterized by comprising: comprising: obtaining a to-be-processed text corresponding to schedule indication data in response to a first operation for submitting the schedule indication data; adding schedule information corresponding to the to-be-processed text in a first application according to the to-be-processed text; wherein the first application is configured to process the to-be-processed text according to a first model to obtain a schedule type output by the first model, the schedule type being used to add the schedule information in the first application, and the first model being trained according to the method of any one of claims 1-8.
10. The method of claim 9, wherein, The first model is a final version of the first model.
11. An electronic device, comprising: The electronic device includes one or more processors and a memory; the memory is coupled to the one or more processors; the memory is configured to store computer program code, the computer program code includes computer instructions, and the one or more processors invoke the computer instructions to cause the electronic device to perform the method of any one of claims 1-10.
12. A chip system, characterized by The chip system is applied to an electronic device, and the chip system includes one or more processors configured to invoke computer instructions to cause the electronic device to perform the method of any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer readable storage medium includes computer instructions, and when the computer instructions run on an electronic device, the electronic device executes the method of any one of claims 1-10.
14. A computer program product, characterised in that, The computer program product includes computer program code, and when the computer program code runs on an electronic device, the electronic device executes the method of any one of claims 1-10.
Citation Information
Patent Citations
Sample data distribution optimization method and device and storage medium
CN116150376A
Automated building of expanded datasets for training of autonomous agents
US20190370604A1