Model training method, schedule processing method and electronic equipment
By conducting high-quality text and keyword training on the initial model, accurate schedule category prediction probability is output, and comprehensive keywords are obtained through text and keyword mining, the problem of inaccurate keyword selection in the existing technology is solved, and the problem of inaccurate keyword selection in the existing technology is improved Accuracy of the creation of schedule information.
Patent Information
- Application Number
- CN202411359404.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-09-26
Smart Images

Figure CN119444156A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a model training method, a schedule processing method and an electronic device. Background Art
[0002] In current terminal devices, it is supported to add user schedule information in the calendar application. For example, schedule information can be added based on data such as text messages, emails, or screenshots, thereby improving the efficiency of schedule creation.
[0003] In the existing technology, the relevant algorithm can extract text from SMS, email or screenshots, and then determine the schedule type indicated by the extracted text based on keyword features. This method can determine the schedule type indicated by the text based on the different categories of keywords matched to the text, and then based on the identified schedule type, for example, the title of the schedule information added to the calendar can be determined.
[0004] However, current keyword selection is usually not accurate or comprehensive enough, which may result in the problem of low accuracy in the creation of schedule information. Summary of the invention
[0005] The embodiment of the present application provides a model training method, a schedule processing method and an electronic device, which are applied to the field of terminal technology to improve the accuracy and comprehensiveness of keyword selection, thereby improving the accuracy of schedule information creation.
[0006] In a first aspect, an embodiment of the present application proposes a model training method. The method includes: training an initial first model according to a first training set and a first keyword set to obtain a first version of a first model, wherein the first training set includes a plurality of training texts, and the plurality of training texts are respectively marked with corresponding real schedule categories, and the first model is used to output a predicted schedule category for the training text.
[0007] In a possible implementation, a first training set and a first keyword set may be manually collected. Afterwards, the initial first model is trained based on the first training set and the first keyword set. The first model is used to process the text, and can output the predicted probabilities of multiple 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 predicted probabilities of multiple preset schedule categories corresponding to the training text. And, the first model processes multiple training texts separately to output the predicted probabilities of each preset schedule category corresponding to the multiple training texts.
[0008] In this way, after being trained with high-quality texts and keywords, the first model can output relatively accurate prediction probabilities for each of a plurality of preset schedule categories for the text, thus providing a relatively accurate data basis for subsequent processing.
[0009] Then, in order to mine more comprehensive keywords for each preset schedule category, the text that is not marked with the preset schedule category can be processed to obtain more accurate and comprehensive keywords belonging to each preset schedule category. This processing process can include two parts: text mining and keyword mining. First, suitable text can be mined in the corpus, and then suitable keywords can be selected from the mined text. The processing flow of text mining includes: According to the first model of the first version, the predicted schedule categories of the plurality of reserve texts included in the corpus are determined, and the predicted schedule categories correspond to predicted probabilities. According to the predicted schedule categories of the plurality of reserve texts, the predicted probabilities corresponding to the predicted schedule categories, and the first keyword set, a plurality of target texts are selected from the plurality of reserve texts.
[0010] According to the first model of the first version, the predicted schedule categories of the plurality of reserve texts included in the corpus are determined, including: For any reserved text in the corpus, a text vector of the reserved text is determined according to the first keyword set.
[0011] In a possible implementation, the word 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 word frequency-inverse document frequency of the text corresponding to all the keywords in the first keyword set can be obtained. According to the word frequency-inverse document frequency of the text corresponding to the first keyword set, the text vector corresponding to the text can be determined.
[0012] It can be understood that the word frequency-inverse document frequency, which is composed of the word frequency of the keyword in the text and the inverse document frequency in all texts, can effectively reflect the correlation between the keyword and the text. By inputting the word frequency-inverse document frequency corresponding to the text into the model, the probability of the text belonging to multiple preset schedule categories can be predicted based on this correlation.
[0013] Then, the text vector of the reserve text is input into the first model of the first version to obtain the predicted probabilities corresponding to the plurality of preset schedule categories output by the first model, wherein the predicted probabilities are used to indicate the probability that the reserve text meets the preset schedule category.
[0014] And, determining the preset schedule category with the greatest prediction probability as the predicted schedule category corresponding to the reserve text.
[0015] 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 reserve text in the corpus, which can ensure the accuracy of the predicted schedule category assigned to the reserve text.
[0016] After obtaining the predicted schedule categories corresponding to the plurality of reserve texts in the corpus, multiple target texts are selected from the plurality of reserve texts according to the predicted schedule categories of the plurality of reserve texts, the predicted probabilities corresponding to the predicted schedule categories, and the first keyword set. The processing flow includes: Among the multiple reserve texts, multiple intermediate texts whose predicted probabilities corresponding to the predicted schedule categories are greater than a first threshold are selected.
[0017] In this way, the reserve texts whose prediction probabilities corresponding to the predicted schedule categories are greater than the first threshold are determined as intermediate texts for text mining processing. These intermediate texts show obvious tendencies, that is, they are highly correlated with their corresponding predicted schedule categories. This feature ensures that they can serve as a reliable data basis in the subsequent processing process, thereby supporting the first model to mine and analyze text information more accurately.
[0018] Then, according to the predicted schedule categories of the plurality of intermediate texts, the predicted probabilities corresponding to the predicted schedule categories, and the first keyword set, the first scores corresponding to the plurality of intermediate texts are determined. The processing flow includes: For any intermediate text, the keyword density corresponding to the intermediate text is determined based on the first number of characteristic keywords contained in the intermediate text and the second number of words contained in the intermediate text. The characteristic 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.
[0019] In a possible implementation, the ratio of a first number of characteristic keywords included in the intermediate text to a second number of words included in the intermediate text may be determined as the keyword density corresponding to the intermediate text.
[0020] 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 is proportional to the keyword density and the predicted probability.
[0021] In a 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 may be determined as the first score of the intermediate text.
[0022] Finally, multiple target texts may be selected from the multiple intermediate texts according to the first scores corresponding to the multiple intermediate texts.
[0023] In a possible implementation, according to the first scores corresponding to the multiple intermediate texts, the first intermediate text with the highest first score may be selected from the multiple intermediate texts as the target text.
[0024] It can be understood that keyword density can reflect the number of keywords of the predicted schedule category contained in the intermediate text, which mainly considers the breadth of the keywords appearing in the text. The prediction probability reveals the degree of correlation between the intermediate text and the predicted schedule category, which is more of an in-depth assessment of the fit between the keywords and the categories in the text. In this way, based on these two aspects to measure the relevance of keywords and intermediate texts, and select texts with greater relevance to keywords as target texts, we can screen out the texts that best reflect the theme of the preset schedule category, providing a solid and reliable data foundation for subsequent keyword mining processing.
[0025] After obtaining multiple target texts, supplementary keywords can be selected from multiple words contained in the multiple target texts according to the multiple target texts and the multiple words. The process includes: For any one of the multiple vocabularies, a first parameter corresponding to each of the multiple target texts is calculated, where the first parameter is used to indicate the importance of the vocabularies in the target text.
[0026] In a possible implementation, the importance of a word in a text can be measured based on word frequency-inverse document frequency, that is, the word frequency-inverse document frequency of the word corresponding to the target text is used as the first parameter. Specifically, for a word and multiple target texts, the word frequency-inverse document frequency of the word corresponding to the multiple target texts can be calculated. Among them, each word frequency-inverse document frequency is used to indicate the importance of the word in a target text.
[0027] Then, the variance is calculated according to the first parameters of the vocabulary corresponding to each of the plurality of target texts to obtain the target variance corresponding to the vocabulary.
[0028] And, according to the target variances corresponding to the multiple words, some words are selected from the multiple words as candidate words.
[0029] It can be understood that if the difference between the first parameters of a word corresponding to multiple target texts is larger, the target variance corresponding to the corresponding word is larger, which means that the text differentiation ability of the word in the multiple target texts is stronger. On the contrary, if the difference between the first parameters of a word corresponding to multiple target texts is smaller, the target variance corresponding to the corresponding word is smaller, which means that the text differentiation ability of the word in the multiple target texts is weaker.
[0030] Therefore, the words corresponding to the first parameters of the plurality of target texts with large differences can be used 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 variances of the words, and the top 200 words with the highest target variances (or any other values) can be selected as candidate words.
[0031] In this way, words that are more relevant to the text and have stronger text-distinguishing capabilities can be selected, providing a solid and reliable data foundation for subsequent processing.
[0032] After obtaining multiple candidate words, supplementary keywords can be selected from the multiple candidate words according to the multiple target texts and the multiple candidate words. In the process of screening the multiple candidate words, the candidate words can be measured according to some indicators to achieve the purpose of screening.
[0033] In a possible implementation, there may be an indicator called first information entropy. The first information entropy can be used to measure the uniformity of the distribution of candidate words in multiple texts of a specific schedule category. There may also be an indicator called first information gain. The first information gain can be used to quantify the amount of information gain brought to the target text as a whole when the candidate words are used as features.
[0034] Using the first information entropy and the first information gain, the process of selecting supplementary keywords from multiple candidate words includes: For any candidate word among the multiple candidate words, the first word frequency proportion of the candidate word corresponding to each of the multiple target texts of the first type is determined according to the third number of times the candidate word appears in each of the multiple target texts of the first type and the total number of times the candidate word appears in the multiple 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 one of the multiple preset schedule categories.
[0035] In one possible implementation, the ratio of the third number of times a candidate word appears in each of the multiple target texts of the first type to the total number of times the candidate word appears in the multiple target texts of the first type can be determined as the first word frequency ratio of the candidate word corresponding to each of the multiple target texts of the first type.
[0036] Then, according to the first word frequency ratios of the candidate words corresponding to the first type of target texts, the first information entropy of the candidate words corresponding to the first schedule category is determined, and the first information entropy is inversely proportional to the overall difference degree of the multiple first word frequency ratios.
[0037] In a possible implementation, the uncertainty of the candidate vocabulary corresponding to the multiple target texts can be determined based on the first word frequency ratio of the candidate vocabulary corresponding to the multiple target texts. Then, the uncertainty corresponding to the multiple target texts in the first schedule category is summed up to obtain the first information entropy of the candidate vocabulary corresponding to the first schedule category.
[0038] It can be understood that the first information entropy can measure the distribution of candidate words in the target text included in the first schedule category. Therefore, according to the first information entropy of the candidate words corresponding to the first schedule category, the correlation between the candidate words and the first schedule category can be measured. Specifically, the more uniform the distribution of the candidate words in the target text included in the first schedule category, the greater the first information entropy of the corresponding candidate words corresponding to the first schedule category, which indicates that the candidate words may be a relatively common concept in the target text included in the first schedule category, and the correlation between the candidate words and the first schedule category is high. Therefore, the word has a greater probability of becoming a keyword of the preset schedule category.
[0039] Then, according to the number of target texts whose predicted schedule category is the first schedule category and the total number of multiple target texts, the first category ratio corresponding to the first schedule category is determined. And, according to 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, the second category ratio corresponding to the first schedule category of the candidate words is determined.
[0040] 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 multiple target texts can be determined as the first category ratio corresponding to the first schedule category. And, the ratio of the number of target texts containing candidate words and whose predicted schedule category is the first schedule category to the total number of target texts containing candidate words can be determined as the second category ratio of the candidate words corresponding to the first schedule category.
[0041] Then, according to 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 of the candidate vocabulary, the first information gain corresponding to the candidate vocabulary is determined, and 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.
[0042] In a possible implementation, the information entropy of the target text can be calculated based on the proportion of the first category, and the information entropy of the target text containing the candidate vocabulary can be calculated based on the proportion of the second category, and then the first information gain can be determined in combination with the normalized design idea. Specifically, the difference between the information entropy of the target text calculated based on the proportion of the first category and the information entropy of the target text containing the candidate vocabulary calculated based on the proportion of the second category is first determined. Then, the ratio of this difference to the information entropy of the target text calculated based on the proportion of the first category is determined as the first information gain corresponding to the candidate vocabulary.
[0043] The first information gain can reflect the distribution of the target texts of each preset schedule category in the entire target text when a certain candidate word is used as a feature (that is, the candidate word needs to be considered), compared with the distribution of the target texts of each preset schedule category in the entire target text in the original case (without considering a specific candidate word). The greater the first information gain corresponding to the candidate word, the greater the difference, which indicates that when a certain candidate word is used as a feature, the distribution difference of the target texts of each preset schedule category in the entire target text is greater. In other words, the greater the distribution difference of the target texts containing the candidate words in each preset schedule category in the entire target text containing the candidate words, this means that the texts containing the candidate words are more concentrated in one or several preset schedule categories. Therefore, according to the first information gain corresponding to the candidate words, the category differentiation ability of the candidate words can be determined.
[0044] Then, based on the first information entropy and the first information gain of the candidate vocabulary corresponding to the preset schedule category to which it belongs, the second score of the candidate vocabulary is determined, and the second score is proportional to the first information entropy and the first information gain. The preset schedule category to which the candidate vocabulary belongs is the preset schedule category with the largest first information entropy.
[0045] In a possible implementation, the product of the first information entropy and the first information gain of the candidate word corresponding to the preset schedule category to which the candidate word belongs may be determined as the second score of the candidate word.
[0046] A supplementary keyword is selected from the plurality of candidate words according to the second scores corresponding to the plurality of candidate words.
[0047] In a possible implementation, in order to ensure uniform classification, the candidate words under each preset schedule category may be sorted separately. After sorting the second scores corresponding to the candidate words contained in each preset schedule category, the first candidate word with the largest second score in each preset schedule category is selected as the supplementary keyword of each preset schedule category.
[0048] In another possible implementation, the second scores of all candidate words may be sorted to select a certain number of candidate words with the highest second scores as supplementary keywords. The number depends on the number of preset schedule categories and the number of preset supplementary keywords in each category.
[0049] In the present application, both methods may be implemented, and then the union of the candidate words is taken, and the selected candidate words are all used as supplementary keywords.
[0050] In this way, by calculating the first information entropy and the first information gain corresponding to the vocabulary, the relevance of the vocabulary and the preset schedule category is measured to obtain supplementary keywords that are more consistent with each preset schedule category, providing a solid data foundation for subsequent processing.
[0051] Usually, the supplementary keywords selected through the above process are nouns. However, in theory, verbs with obvious tendencies can also be used as keywords. At the same time, since the frequency of nouns in the text is often higher than that of verbs in the text, it may be impossible to select verbs as supplementary keywords. Therefore, candidate keywords can be selected again from all verbs. The process includes: Candidate words whose part of speech is verb are selected from the candidate words to obtain a plurality of verb words.
[0052] According to the plurality of target texts and the plurality of verb vocabularies, supplementary keywords are selected from the plurality of verb vocabularies. This process is the same as the process of selecting supplementary keywords from the plurality of target texts described above.
[0053] In this way, the limitation of being unable to screen out verb vocabulary is avoided, so that supplementary keywords can be selected more comprehensively.
[0054] Then, multiple target texts are added to the first training set to obtain a second training set, and supplementary keywords are added to the first keyword set to obtain a second keyword set. The first version of the first model is trained according to the second training set and the second keyword set to obtain the second version of the first model.
[0055] In this way, the first model of the first version is trained with the second training set and the second keyword set to optimize the first model based on more high-quality keywords, thereby improving the accuracy and reliability of the prediction probability corresponding to each predicted schedule category output by the first model.
[0056] After obtaining the first model of the second version, the operations of expanding the training set and expanding the keyword set are repeated, 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 to obtain the first model of the target version.
[0057] In this way, the first model is trained and optimized according to each round of training sets and keyword sets to improve the accuracy of the prediction probability output by the first model and obtain a more accurate and comprehensive keyword set.
[0058] In a possible implementation, in order to further expand the coverage of keywords and discover more detailed keywords, keyword mining can also be achieved through semantic expansion methods. For example, the keyword set and training set expanded before the last round of model training can be used as the data basis for secondary recall processing to obtain further expanded keywords. The process includes: According to the first model of the target version, the predicted schedule category of each of the plurality of reserve texts included in the corpus is determined.
[0059] A plurality of extended texts are selected from the plurality of reserve texts according to the respective predicted schedule categories of the plurality of reserve texts, the predicted probabilities corresponding to the respective predicted schedule categories, and the third keyword set.
[0060] For any extended text, a plurality of extended words are determined from the plurality of words included in the extended text according to a first similarity between each of the plurality of words included in the extended text and the extended text.
[0061] In a possible implementation, the extended text can be processed by the KeyBert model to obtain multiple extended words. In this process, for any extended text, the words with the highest similarity to the extended text can be selected according to the similarity of each word in the extended text to the extended text. Then, among the remaining words in the extended text except the word, words are selected one by one as extended words according to certain rules. In a possible implementation, the above similarity can be calculated according to the cosine similarity calculation method.
[0062] After obtaining the multiple extended words, the first model of the target version is trained according to the multiple extended words, the multiple extended texts and the third keyword set to obtain the first model of the final version. The process includes: For any one of the multiple extended words, a third similarity of the extended word corresponding to the second schedule category is determined based on the second similarities corresponding to each of the extended word and the multiple keywords included in the third keyword set and belonging to the second schedule category, and the second schedule category is any one of the multiple preset schedule categories.
[0063] In a possible implementation, similarity calculation may be performed based on the extended vocabulary and multiple keywords belonging to the second schedule category to obtain multiple second similarities of the extended vocabulary corresponding to the second schedule category. The multiple second similarities of the extended vocabulary corresponding to the second schedule category are then averaged to determine a third similarity of the extended vocabulary corresponding to the second schedule category.
[0064] Then, according to the third similarities between the extended vocabulary and the plurality of preset schedule categories, the preset schedule category with the largest third similarity and / or a third similarity greater than a second threshold is determined as the preset schedule category to which the extended vocabulary belongs.
[0065] In a possible implementation, the preset schedule category with the largest third similarity can be used as the preset schedule category corresponding to the extended vocabulary, so as to improve the accuracy of the preset schedule category determined for the extended vocabulary.
[0066] In a possible implementation, the preset schedule category with the third larger similarity can be used as the preset schedule category corresponding to the extended vocabulary. In this way, an extended vocabulary can belong to one or more preset schedule categories, so that the extended vocabulary covers the preset schedule categories more comprehensively.
[0067] In a possible implementation, the preset schedule category corresponding to each extended vocabulary may be determined first. Afterwards, the extended vocabulary whose third similarity to the preset schedule category is lower than the second threshold may be discarded and no longer counted into the preset schedule category, so as to further improve the accuracy of the preset schedule category determined for the extended vocabulary. The second threshold is a preset threshold.
[0068] 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 it belongs and a fourth number of times the extended vocabulary appears in multiple extended vocabulary. The third score is proportional to the fourth similarity and the fourth number of times.
[0069] In a possible implementation, the product of a fourth similarity between the extended vocabulary and the preset schedule category to which the extended vocabulary belongs and a fourth number of occurrences of the extended vocabulary in the plurality of extended vocabulary may be determined as the third score of the extended vocabulary.
[0070] A supplementary keyword is determined from the plurality of expanded words according to the third scores of the plurality of expanded words.
[0071] In a possible implementation, a preset threshold may be set, and expanded words with a third score greater than or equal to the preset threshold are used as supplementary keywords, while expanded words with a third score less than the preset threshold are discarded and not used as supplementary keywords.
[0072] After obtaining the supplementary keywords, the supplementary keywords included in each preset schedule category may be further judged in combination with manual scene judgment to eliminate some supplementary keywords that are not highly relevant to the preset schedule category.
[0073] Afterwards, the supplementary keywords are added to the third keyword set to obtain a fourth keyword set, and the multiple extended texts are added to the third training set to obtain a fourth training set. The third training set is the training set expanded before the last round of model training.
[0074] And, the target version of the first model is trained according to the fourth keyword set and the fourth training set to obtain the final version of the first model.
[0075] In this way, based on the semantic similarity between the vocabulary and the text, differentiated vocabulary can be selected as keywords, increasing the diversity of keywords and further expanding the coverage of keywords included in the preset schedule category to obtain more comprehensive keywords. The accurate and comprehensive keywords obtained by expansion can enable the first model to more accurately identify the schedule category corresponding to the input text.
[0076] In addition, in the present application, a corresponding first model can be trained for a language. It should be noted that after obtaining the first model of a language, when realizing keyword mining in another language, it is only necessary to re-collect the first training set, the first keyword set and the corpus of the target language, and input them into the first model according to the above process to realize keyword mining of multiple preset schedule categories in the target language. At the same time, the first model corresponding to the target language obtained through the above process can accurately and reliably identify the schedule category of the input text to create schedule information.
[0077] In a second aspect, an embodiment of the present application proposes a schedule processing method. The method includes: 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, schedule information corresponding to the to-be-processed text is added to a first application. The first application is used to process the to-be-processed text according to a first model to obtain a schedule type output by the first model, and the schedule type is used to add schedule information to the first application, and the first model is trained by the above method.
[0078] In one possible implementation, the user can, for example, perform an operation 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 to obtain the text to be processed corresponding to the schedule indication data. After obtaining the text to be processed, the first application analyzes and processes the text to be processed according to the first model, thereby obtaining a preset schedule category to which the text to be processed belongs. After obtaining the schedule category corresponding to the text to be processed, the schedule category can be added to the first application.
[0079] It can be understood that based on the model training method introduced in the first aspect, after receiving the text, the first model can output relatively accurate prediction probabilities of each of the multiple preset schedule categories corresponding to the text, and thus can determine the schedule category to which the input text belongs.
[0080] In this way, after in-depth learning and mastering the relatively comprehensive knowledge of the extended keywords obtained in the above training process, the first model can more accurately identify the schedule category corresponding to the text to be processed. 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.
[0081] In a third aspect, an embodiment of the present application provides a schedule processing device, which may be an electronic device, or a chip or chip system in an electronic device. The schedule processing device may include a display unit and a processing unit.
[0082] When the schedule processing device is an electronic device, the display unit may be a display screen. The display unit is used to perform the display step so that the electronic device implements a schedule processing method described in the first aspect or any possible implementation of the first aspect.
[0083] When the schedule processing device is an electronic device, the processing unit may be a processor. The schedule processing device may also include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit to enable the electronic device to implement a schedule processing method described in the first aspect or any possible implementation of the first aspect.
[0084] When the schedule processing device is a chip or chip system in an electronic device, the processing unit may be a processor. The processing unit executes 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. The storage unit may be a storage unit in the chip (e.g., a register, a cache, etc.), or a storage unit in the electronic device located outside the chip (e.g., a read-only memory, a random access memory, etc.).
[0085] Exemplarily, the processing unit is used to process data such as text or screenshots and create schedule information based on the schedule processing device. The display unit is used to display the created schedule information and the like.
[0086] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store code instructions, and the processor is used to run the code instructions to execute the method described in the first aspect or any possible implementation of the first aspect.
[0087] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is run on a computer, the computer executes the method described in the first aspect or any possible implementation of the first aspect.
[0088] In a sixth aspect, an embodiment of the present application provides a computer program product comprising a computer program, which, when executed on a computer, enables the computer to execute the method described in the first aspect or any possible implementation manner of the first aspect.
[0089] In a seventh aspect, the present application provides a chip or a chip system, the chip or chip system comprising at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is used to run a computer program or instruction to execute the method described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip can be an input / output interface, a pin or a circuit, etc.
[0090] In a possible implementation, the chip or chip system described above in the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (such as a read-only memory, a random access memory, etc.).
[0091] It should be understood that the third to seventh aspects of the present application correspond to the technical solutions of the first and second aspects of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] Figure 1 A schematic diagram of a schedule creation scenario provided in an embodiment of the present application; Figure 2 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application; Figure 3 A schematic diagram of the software structure of a terminal device provided in an embodiment of the present application; Figure 4 A schematic diagram of the first model training provided in an embodiment of the present application; Figure 5 A schematic diagram of calculating the TF-IDF value for a text provided in an embodiment of the present application; Figure 6 A schematic diagram of initial training of a first model provided in an embodiment of the present application; Figure 7 A flowchart of text mining provided in an embodiment of the present application; Figure 8 A flowchart of keyword mining provided in an embodiment of the present application; Fig. 9 A schematic diagram of the first parameter calculation provided in an embodiment of the present application; Fig.10 A schematic diagram of information entropy calculation provided in an embodiment of the present application; Fig.11 A schematic diagram of a first information gain calculation provided in an embodiment of the present application; Fig.12 A schematic diagram of determining a preset schedule category to which a candidate word belongs provided in an embodiment of the present application; Fig.13 A schematic diagram of an implementation method for selecting a supplementary keyword from a candidate vocabulary provided in an embodiment of the present application; Fig.14 A schematic diagram of another implementation method of selecting a supplementary keyword from a candidate vocabulary provided in an embodiment of the present application; Fig.15 A schematic diagram of the first model training based on secondary recall provided in an embodiment of the present application; Fig.16 A schematic diagram of a schedule recognition application of a first model provided in an embodiment of the present application; Fig.17 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0093] In order to clearly describe the technical solutions of the embodiments of the present application, some terms and technologies involved in the embodiments of the present application are briefly introduced below: 1. Term Frequency-Inverse Document Frequency (TF-IDF) TF-IDF is used to characterize the representativeness of a word or phrase to a document. In this embodiment, a document refers to a text. TF represents the frequency of a word or phrase appearing in the text.
[0094] IDF indicates the text distinguishing ability of a word. If a word or phrase appears frequently in a text and rarely appears in other texts, it means that the word or phrase has good text distinguishing ability and is suitable for classification.
[0095] The TF-IDF value is the product of the TF value and the IDF value. The larger the TF-IDF value, the more important a word or phrase is in the text, and the greater the distinction of the text, that is, the more representative the word or phrase is for the text.
[0096] 2. Keywords Keywords are used to match the input text to determine the category to which the input text belongs. Keywords are the core words of each category and can accurately reflect the theme and content of the category.
[0097] 3. Second recall Secondary recall can be understood as further optimization and screening of the initial recall results. The main purpose of the initial recall (rough sorting) stage is to quickly screen out a small number of candidates that may meet the user's interests from a large number of candidate sets.
[0098] After the initial recall, the secondary recall (fine sorting) stage uses more complex models and methods to further accurately sort the initially screened candidates. In this embodiment, the process of expanding keywords based on the statistical information of the vocabulary can be the initial recall, and the process of expanding keywords based on the semantic relevance of the vocabulary can be the secondary recall.
[0099] 4. Other terms In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0100] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0101] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.
[0102] 5. Electronic equipment The electronic device of the embodiment of the present application may include a handheld device, a vehicle-mounted device, etc. with a data processing function. For example, some electronic devices are: mobile phones, tablet computers, PDAs, laptop computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, vehicle-mounted devices, wearable devices, terminal devices in 5G networks or future evolved public land mobile communication networks (PLANs), and wireless terminals in smart cities. The embodiments of the present application do not limit this.
[0103] As an example but not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also powerful functions achieved through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include full-featured, large-sized, and fully or partially independent of smartphones, such as smart watches or smart glasses, as well as devices that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various types of smart bracelets and smart jewelry for vital sign monitoring.
[0104] In addition, in the embodiments of the present application, the electronic device may also be a terminal device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network that interconnects people and machines and things.
[0105] The electronic device in the embodiments of the present application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.
[0106] In an embodiment 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 hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also called main memory). 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. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0107] In order to better understand the technical solution of the present application, the relevant technologies involved in the present application are further introduced in detail below.
[0108] Schedule creation refers to the process of creating a new schedule in the calendar after the user purchases air tickets, train tickets, and booked hotels or other matters. Since manually entering schedule titles is relatively cumbersome and inconvenient, programs that automatically identify schedule categories can simplify the operation process and improve the efficiency of schedule creation.
[0109] The scenario of creating a new schedule in the calendar usually involves text input, which may come from the content of text messages or emails received by the user, or text recognized by the user through optical character recognition (OCR) technology after taking a screenshot of the software application interface.
[0110] Combine the following Figure 1 A brief description of the schedule creation scenario is given below. Figure 1A schematic diagram of a schedule creation scenario provided in an embodiment of the present application.
[0111] In one implementation, the user may operate in the calendar application of the terminal device to provide a text message, email or screenshot to the calendar application, and then the calendar application analyzes and processes the data to create a corresponding schedule in the calendar application.
[0112] refer to Figure 1 , the figure contains three scenarios and created schedules. Among them, the three scenarios can be text messages, emails received by users, and screenshots of the user on the software application interface. Then, the text of the relevant transaction can be extracted or identified based on these text messages, emails and screenshots. A schedule can be created based on the text of these transactions. 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 done or planned by the user. The type of schedule can be divided according to the category of the transaction. Therefore, in Figure 1 In the above three scenarios, three schedules can be created according to the three different types of affairs.
[0113] like Figure 1 As shown, in the first scenario 101, the user receives a text message / multimedia message indicating that the train reservation is successful. The content of the text message may be detailed information of the train ticket reservation, which may specifically include: train number, departure date, departure time, arrival time, departure station, terminal station, ticket purchaser and other information.
[0114] like Figure 1 As shown, in the second scenario 102, the user receives an email indicating that the hotel reservation is successful. The content of the email may be detailed information of the hotel reservation, which may specifically include: the name and location of the hotel, and the check-in date and check-out date of the user's reservation.
[0115] And, in the third scenario 103, the user takes a screenshot after booking a flight ticket on the flight ticket booking app, and the screenshot can be saved in the phone's photo album. Figure 1 In the third scene, a screenshot of a flight order in the mobile phone album is displayed. The screenshot may contain detailed information about the flight ticket booking, including: the name of the airline, the flight number of the aircraft, the departure date, the departure time, the arrival time, the departure station, the destination station, and other information.
[0116] The text of the transactions in these scenarios can be obtained by processing the text or screenshots of the transactions in these scenarios using technologies such as text extraction or OCR recognition. The types of transactions in different scenarios may be the same or different. The types of transactions are classified to determine the schedule titles of each transaction. The categories of transactions may include, but are not limited to, at least one of the following: train travel, high-speed rail travel, flight travel, hotel accommodation, etc. In the actual implementation process, the categories can be expanded according to actual needs. Categories may also include, for example, meetings, hospital visits, participation in activities, and movie ticket orders.
[0117] refer to Figure 1 ,After acquiring the text or screenshots of the affairs in the three scenarios, the text or screenshots are processed to obtain the text, and the classification field to which the affairs in each scenario belong is judged based on the content of the text, so as to determine the schedule title of each affair.
[0118] refer to Figure 1 The three scenarios in the figure involve three types of transactions, namely, train ticket booking transaction 101, hotel booking transaction 102, and flight ticket booking transaction 103. According to these three transactions, three schedules can be created in the calendar, namely, 105, 106, and 107, and the titles of these three schedules can be train travel, hotel accommodation, and flight travel, respectively. The creation of the content in the schedule is not involved in this application. Figure 1 The schedule shown is for example only.
[0119] Next, we will introduce how to distinguish the schedule categories to determine the schedule title. In the prior art, keyword features are usually used to distinguish the schedule categories. The selection of keywords in each category has a huge impact on the effect of the algorithm. Therefore, the selection of appropriate keywords is crucial.
[0120] In one solution, fixed templates for various categories may be preset. When text matches a preset template, it is predicted that the text belongs to the category to which the preset template belongs, ie, it is predicted that the user wants to create a schedule of this category.
[0121] As an example, let's assume that the preset template is "Book me a flight 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 subject to fixed constraints. The content of this "xxx" can be a location, etc., which is irrelevant to the judgment of the template category. When the text matches the preset template, it can be predicted that the text belongs to the flight travel category, thereby predicting that the user wants to create a flight travel schedule.
[0122] In one solution, a keyword library can be pre-set, and a weight can be set for the keywords in the preset keyword library. The weight is used to indicate the degree to which the keyword belongs to a certain category. Then the input text is matched with the keywords contained in each category, and the prediction probability of each category corresponding to the text is determined based on the weight of the keywords matched to the text. After that, based on the prediction probability of each category corresponding to the text, the category to which the text belongs can be obtained, so that the type of schedule creation can be determined.
[0123] As an example, for the flight travel transaction, it can be assumed that the keywords of this category include "flight number", "airport", "pick-up", and "landing". The weight corresponding to the keyword "flight number" is preset to 0.8, the weight corresponding to "airport" is preset to 0.4, the weight corresponding to "pick-up" is preset to 0.3, and the weight corresponding to "landing" is preset to 0.2. If the text matches the keyword "flight number", it indicates that the probability that the text belongs to the flight travel category is relatively high, which means that the text may belong to the flight travel category, that is, the schedule creation type is determined. If the text matches the keyword "pick-up", it indicates that the probability that the text belongs to the flight travel category is relatively low, which means that the text may not belong to this category but to other categories.
[0124] In both of the above solutions, based on pre-set matching information of various categories, the text is matched with the preset matching information to distinguish the category of the text and then determine the title of the schedule creation. The matching information may be a template or a keyword.
[0125] It is understandable that the method of matching text information based on a fixed preset template may achieve better results in certain scenarios, but there is a problem of scenario limitation. Also, the method of matching text based on a preset keyword library may have a problem of not being comprehensive enough in terms of matching range.
[0126] In another implementation, a small number of basic keywords may be mined to expand the keyword library, and then the keywords are matched through the expanded keyword library.
[0127] In one solution, keyword expansion is achieved by splitting and combining basic keywords. However, due to the different word formation methods of different languages, for example, most European languages have prefixes and suffixes, and some words are not composed of two complete words. The simple and direct method of expanding keywords by splitting and combining words cannot be effectively extended to other languages.
[0128] Based on the above analysis, it can be understood that when mining keywords for multilingual topics, 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 may be more or less, and the content of the text information may 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 be applicable to the text information obtained in different scenarios.
[0129] On the other hand, in the case of cross-language, the selection of keywords will be affected by the characteristics of different languages. Due to the different cultures and connotations of different countries, different languages have different characteristics. For example, there are large differences in the structure of vocabulary and sentences in different languages. Therefore, the selection and expansion of keywords are very dependent on language knowledge. Appropriate methods need to be used to select and expand keywords according to different languages to apply to text information in different languages obtained in different scenarios.
[0130] Therefore, it can be understood that in the above-mentioned related technologies, because the selection and expansion of keywords are affected by the feature information in the text and different language scenarios, the algorithm may not work well or may not be implemented, which may affect the overall performance of the schedule processing system.
[0131] In response to the above-mentioned problems, the present application proposes the following technical concept: in the process of creating a schedule based on text, the schedule category to which the text belongs can be determined through the model, and then the corresponding schedule information is created. Then in the process of training the model, for example, an initial model can be trained first based on labeled training data (labeled text and seed keywords). Then, based on the initial model, some texts that are more related to the initial keywords are mined in the corpus. Then, keywords are mined for these texts to achieve the purpose of expanding the keywords. Finally, the mined keywords and texts are used again to train the model, and then the keywords obtained after expansion are applied to the model. This process continues until the model is no longer improved or the model iteration reaches the number of cycles, and the model training is stopped, so that a model that effectively applies the extended keywords can be obtained.
[0132] The model training method and schedule processing method of the embodiment of the present application can be executed by an electronic device provided with a processor or chip, or by a chip, chip system or processor that supports the electronic device to implement the model training method and schedule processing method, or by a logic module or software that can implement all or part of the functions of the electronic device, and the present application does not impose specific restrictions on this. The model training method and schedule processing method of the embodiment of the present application are described in detail below, taking the electronic device as the execution subject as an example.
[0133] The electronic device may be, for example, a terminal device. Figure 2 and Figure 3 Provide a brief introduction to the terminal equipment.
[0134] For example, Figure 2 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application.
[0135] Figure 2 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. The terminal device may 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 speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0136] It is to 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 include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0137] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (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. Among them, different processing units may be independent devices or integrated into one or more processors. In this embodiment, the processor 110 may be used, for example, to execute various logical processing and data processing included in the model training method and schedule processing method provided in the present application.
[0138] The terminal device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0139] Display screen 194 is used to display images, videos, etc.
[0140] The software system of the terminal device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the terminal device.
[0141] For example, Figure 3 A schematic diagram of the software structure of a terminal device provided in an embodiment of the present application.
[0142] like Figure 3 As shown, the layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system may include an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, a hardware abstraction layer (HAL) and a kernel layer. It should be noted that the embodiment of the present application is illustrated by taking the Android system as an example. In other operating systems (such as Hongmeng system, IOS system, etc.), as long as the functions implemented by each functional module are similar to those of the embodiment of the present application, the solution of the present application can also be implemented.
[0143] Among them, the application layer can include a series of application packages.
[0144] like Figure 3 As shown, the application package may include camera, calendar, phone, map, phone, music, settings, mailbox, video, social and other applications. Of course, the application layer may also include other application packages, such as payment applications, shopping applications, banking applications, social applications and other third-party applications, which are not limited in this application. In one implementation, for example, the calendar application in the application layer may perform the schedule creation work described above. For example, a user may submit information such as text messages, emails, or screenshots in a calendar application, and then the calendar application adds the corresponding schedule to the calendar application based on the processing results fed back by the underlying data processing.
[0145] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0146] like Figure 3 As shown, the application framework layer may include a window manager, a content provider, a resource manager, a view system, a notification manager, and the like.
[0147] Among them, Android runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
[0148] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0149] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0150] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0151] Among them, the HAL layer is an encapsulation of the Linux kernel driver, providing an interface to the upper layer and shielding the implementation details of the low-level hardware.
[0152] The HAL layer may include Wi-Fi HAL, audio HAL, camera service (Camera HALServer) unit of the HAL layer and software code library, etc. In this embodiment, a first model may be deployed in the HAL layer, for example, wherein the first model is used to analyze the text corresponding to the information such as text messages, emails or screenshots submitted by the user, so as to obtain the corresponding processing results. Afterwards, the HAL layer may, for example, feed back the processing results output by the first model to the calendar application, so that the calendar application adds the corresponding schedule.
[0153] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0154] The following, in conjunction with the accompanying drawings, describes in detail 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-mentioned technical problems with specific embodiments. The following specific embodiments can be implemented independently or in combination with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0155] The technical solution of this application involves model training and model application. These two parts are introduced separately below.
[0156] In this embodiment, the training of the first model may include, for example, an initial training process and a subsequent post-processing process. Here, the initial training process of the first model is first described in conjunction with a specific embodiment. Figures 4 to 6 Give a detailed introduction, Figure 4 A schematic diagram of the first model training provided in an embodiment of the present application, Figure 5 A schematic diagram of calculating the TF-IDF value for a text provided in an embodiment of the present application, Figure 6 A schematic diagram of the initial training of the first model provided in an embodiment of the present application. The initial training process of the first model may include the following steps: 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 multiple training texts, and the multiple training texts are respectively marked with corresponding real schedule categories. The first model is used to output predicted schedule categories for the training texts.
[0157] The following introduces the relevant concepts and specific implementations in the above steps.
[0158] In this embodiment, the first training set includes multiple training texts, and the multiple training texts are respectively marked with corresponding real schedule categories, wherein the real schedule category can be understood as the correct schedule category corresponding to the training text. The set of training texts marked with real schedule categories can also be set with any name according to actual needs, and this embodiment does not limit this.
[0159] Exemplarily, in this embodiment, multiple preset schedule categories can be pre-set, where the preset schedule categories may include but are not limited to: train travel, flight travel, hotel accommodation, etc. This embodiment does not limit the specific division method of the schedule categories. In short, multiple preset schedule categories can be pre-divided according to actual needs.
[0160] For example, the real schedule categories corresponding to the multiple training texts introduced above may belong to the multiple preset schedule categories introduced above. For example, the real schedule category corresponding to training text 1 is train travel, the real schedule category corresponding to training text 2 is flight travel, and so on.
[0161] In one implementation, for example, multiple training texts can be selected for each preset schedule category, for example, multiple training texts belonging to the schedule category of train travel, and multiple training texts belonging to the schedule category of flight travel, etc., so as to obtain the first training set introduced above. And it can be understood that the training text introduced in this embodiment is from the real schedule creation process, then in the actual schedule creation process, the schedule category corresponding to this part of the training text is already clear, so the real schedule category corresponding to this part of the training text can be directly obtained. In this embodiment, the first training set can be obtained by manual collection. Since the collection of the first training set will consume more time and energy, a small-scale first training set can be collected for training 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 limit this.
[0162] In this embodiment, the first keyword set may include multiple keywords, each keyword corresponds to a preset schedule category in the target language, and the set of keywords included in multiple preset schedule categories in the target language is called the first keyword set. The set of keywords included in multiple preset schedule categories in the target language can also be set to any name according to actual needs, and this embodiment does not limit this. Among them, the keywords included in the first keyword set can be understood as the core vocabulary of each preset schedule category (can also be understood as basic vocabulary or seed words), which can accurately reflect the theme and content of the category in the most basic way.
[0163] In different languages, the keywords included in the same preset schedule category may be different. For example, taking the preset schedule category of train travel as an example, the keywords included in the train travel category for Chinese may include words such as "Harmony" and "Motor Vehicle", while the keywords included in the train travel category for German may include words such as "Zug", "Bahnhof", and "Fahrkarte". Among them, the Chinese meaning of the word Zug can refer to "train", the Chinese meaning of the word Bahnhof can refer to "train station", and the Chinese meaning of the word Fahrkarte can refer to "ticket".
[0164] By comparison, it can be seen that for German, the text related to train travel may not contain words such as "Harmony" in Chinese, that is, in different languages, the keywords corresponding to the same preset schedule category are different. Correspondingly, it can be understood that the keywords contained in one language may not correspond to the keywords contained in another language. Therefore, directly translating the keywords in one language to obtain the keywords in another language is actually unable to achieve the purpose of keyword expansion in multiple target languages.
[0165] Therefore, in order to achieve keyword expansion in multiple target languages, in this embodiment, first keyword sets corresponding to different languages can be set respectively, and the first keyword set includes seed keywords (that is, very basic keywords) of each preset schedule category corresponding to the target language currently being processed, 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.
[0166] Furthermore, seed words can be understood as the simplest concepts under each preset schedule category in the target language. Seed words can be used as a reference point for classification to guide the subsequent classification process. As an example, if you want to classify train travel in German, you can select words such as "Zug (train)", "Bahnhof (train station)" and "Fahrkarte (ticket)" as seed words for the train travel category.
[0167] 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 commonly existing concepts under each preset schedule category, thereby obtaining the basic keywords corresponding to each preset schedule category. The screening introduced here can be manual screening, or it can also be automatic screening by a machine, which is not limited in this embodiment. In this embodiment, the basic keywords in each preset schedule category can be set as seed words.
[0168] The first model in this embodiment is used to process the text to output the predicted probabilities of each preset schedule category corresponding to the text. And the current embodiment describes the training process for the first model, so it can be understood that when a text passes through the first model, the first model can output the predicted probabilities of each preset schedule category corresponding to the text. Among them, 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.
[0169] As an example, assume that the preset schedule categories can include three categories: train travel, flight travel, and hotel accommodation. When the vector corresponding to a text passes through the first model, the model will output another vector [0.25, 0.6, 0.15], which means that the predicted probability of this text belonging to the train travel category is 0.25, the predicted probability of belonging to the flight travel category is 0.6, and the predicted probability of belonging to the hotel accommodation category is 0.15. This means that the model predicts that the preset schedule category corresponding to this text is the flight travel category.
[0170] In actual scenarios, a text may contain information of one category or multiple preset schedule categories, but a text corresponds to more than one preset schedule category. As an example, there may be a text "Book an airport hotel at an international airport", which contains the two keywords "airport" and "hotel", and these two keywords correspond to different preset schedule categories, but ideally, the preset schedule category corresponding to this text should be the hotel accommodation category. It can be understood that after a text passes through the first model, the model will output the prediction probabilities corresponding to multiple preset schedule categories to predict the preset schedule category to which this text belongs.
[0171] Exemplarily, the first model may refer to a naive Bayes model, or the specific implementation of the first model may be arbitrarily selected according to actual needs, as long as the first model can be used to implement the functions introduced above.
[0172] In this embodiment, the first model can be trained by using multiple training texts. During the training process of the first model, multiple training texts can be input into the first model at once to perform subsequent training processes. Alternatively, multiple training texts can be input into the first model in batches to perform subsequent training processes. Alternatively, multiple training texts can be input into the first model in sequence to perform subsequent training processes.
[0173] 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 separately to output the predicted probabilities of the multiple preset schedule categories corresponding to the multiple training texts. At the same time, the first model processes each of the multiple training texts in a similar manner.
[0174] The first model of the first version may refer to a model obtained by training the initial first model based on the first training set and the first keyword set. Figure 4 Understand the training process of the first model of the first version, which can correspond to Figure 4The step numbered 1 is to input the training set and the keyword set into the first model 401 after processing, so as to train the first model. In this embodiment, the training set and the keyword set refer to the first training set and the first keyword set.
[0175] The following specifically describes the training process of the first model of the first version, which may include: 1. Preprocess the training text contained in the first training set.
[0176] Preprocessing operations can include word segmentation, punctuation removal, stop word removal, and case preservation, etc., which are used to reduce redundant or meaningless data to improve the efficiency of model training.
[0177] 2. Convert the training text in the first training set and the keywords in the first keyword set into vector representations.
[0178] Exemplarily, the training text in the current step may refer to the training text after the preprocessing described above. Before the first training set and the first keyword set are input into the first model, the training text contained in the first training set may be converted into a vector representation according to the keywords contained in the first keyword set, so as to facilitate the subsequent model to execute data processing. Common methods for converting text into numerical form may include methods such as bag of words model and TF-IDF.
[0179] In this embodiment, for example, TF-IDF can be used to convert the training text into a vector representation. TF-IDF measures the importance of keywords and the ability to distinguish text by calculating the TF-IDF values of keywords and texts. A TF-IDF value can be obtained for a keyword and a 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 calculation formula of the TF-IDF value can satisfy the following formula 1: Formula 1 In formula 1, Indicates In this embodiment, it specifically refers to the first keyword in the first keyword set. i Keywords. Indicates the first In this embodiment, it specifically refers to the first Article text. is the keyword In the sentence The frequency of words in . The calculation formula can satisfy the following formula 2:
[0180] Formula 2 In formula 2, Indicates keywords In text The number of times it appears in .
[0181] In formula 1, is the inverse document frequency of the keyword in the text. The calculation formula can satisfy the following formula 3:
[0182] Formula 3 In formula 3, Represents all text in the data In this embodiment, the number of training texts in the first training set is specifically the number of training texts in the first training set. Indicates that the data contains The number of texts containing the keyword, in this embodiment, specifically refers to the number of texts containing the keyword in the first training set. The denominator is added with 1 to smooth the denominator to prevent the denominator from being 0, that is, no sentence contains the first keyword. It can be understood that the larger the IDF value, the more keywords are included in the first training set. The fewer training texts there are for a keyword, the higher the discrimination of the keyword against the training text.
[0183] Through the above analysis, it can be understood that the larger the TF-IDF value is, the higher the word frequency or the inverse document frequency of the word in the text will be, which means that the word is more important in the training text and has a greater degree of discrimination for the training text.
[0184] Combine the following Figure 5 The calculation of the TF-IDF value for a text is briefly explained. Figure 5As shown, it is assumed that there is a text "Ich werde um 10 Uhr mit dem Zugticket zum Flughafen fahren.", whose Chinese meaning can refer to "I will go to the airport with a train ticket at 10 am.", and five keywords ["Zug", "Zugticket", "Hotel", "Termin", "Flughafen"], among which 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", and the Chinese meaning of the word Flughafen can refer to "airport", and for the convenience of subsequent calculation and explanation, it is assumed here that the IDF value is 1. It should be understood that here it is assumed that the IDF value of each keyword is 1, but in the actual calculation process, the IDF value of each keyword may be different, and its value can be calculated according to Formula 3.
[0185] The TF value of each keyword for this text is the frequency of the keyword in this text. Figure 5 As shown in the figure, the keyword "Zug (train)" appears 0 times in this text, so the keyword's frequency is 0. The keyword "Zugticket (train ticket)" appears 1 times in this text, so the keyword's frequency is 1. The keyword "Hotel (hotel)" appears 0 times in this text, so the keyword's frequency is 0. The keyword "Termin (date)" appears 0 times in this text, so the keyword's frequency is 0. The keyword "Flughafen (airport)" appears 1 times in this text, so the keyword's frequency is 1.
[0186] According to the TF value and IDF value of each keyword based on the above formula 1, it can be determined that the vector of this text after conversion is .
[0187] 3. Train the first model for category prediction.
[0188] After preprocessing the data contained in the small-scale first training set and the first keyword set, and performing TF-IDF vector representation, the vector corresponding to the training text is input into the first model to train the model, so as to enable the model to output more accurate prediction probabilities of each of the multiple preset schedule categories. Figure 6 As shown, the first training set and the first keyword set are converted into vectors after preprocessing and input into the first model 401.
[0189] After the above data is input into the first model, refer to Figure 6, the first model 401 can output the predicted probabilities of multiple preset schedule categories corresponding to the multiple texts. Then, the predicted schedule category of the training text can be determined according to the predicted probabilities of each preset schedule category corresponding to the training text. And based on the predicted schedule category of the training text and the actual schedule category of the text itself, the error of the predicted schedule category output by the first model can be determined.
[0190] After getting the error, refer to Figure 6 , the error will be returned to the first model, and the model can continuously adjust its parameters according to the error. This process will continue until the model is no longer improved, or the current number of iterations of the model has reached the preset number of cycles. At this time, the iterative training of the model is stopped, and the first version of the first model can be obtained.
[0191] In this way, the first model of the first version obtained through the above training can output the prediction probability corresponding to each preset schedule category for the text, and can ensure the correctness of the prediction probability output by the model, so as to provide an accurate data basis for subsequent processing.
[0192] Through the introduction of the above embodiments, it can be understood that after obtaining the first model of the first version, 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, multiple texts in the corpus that are not marked with schedule categories can be input into the first model of the first version, thereby obtaining the predicted schedule categories of the multiple texts in the corpus. Then, the corpus is screened based on the predicted schedule categories corresponding to each text to obtain a new data set, and new keywords are extracted based on this new data set. In the process of determining new keywords, consider coarse-grained filtering based on the statistical information of the vocabulary to preliminarily mine keywords. And fine filtering of keywords based on the semantic relevance of the vocabulary to further mine and select keywords.
[0193] In the above-mentioned preliminary keyword mining process, for example, multiple texts can be mined in the corpus first, and then new keywords can be mined based on the mined texts. The following will introduce the two parts of mining texts and mining keywords respectively.
[0194] First, the text mining process is described in conjunction with a specific embodiment. Figure 4 and Figure 7 Give a detailed introduction, Figure 4 A schematic diagram of the first model training provided in an embodiment of the present application, Figure 7 A flowchart of text mining provided in an embodiment of the present application. The text mining process may include the following steps: S701. For any reserved text in the corpus, determine a text vector of the reserved text according to a first keyword set.
[0195] The corpus includes multiple texts. In this embodiment, the texts contained in the corpus are referred to as reserve texts. Any name can be set for the texts contained in the corpus according to actual needs, and this embodiment does not limit this. The corpus is composed of multiple unlabeled texts, that is, the text data in the corpus does not correspond to the real schedule category. In order to obtain a broad corpus, these texts can come from public information on Internet websites and news reports in local media. The texts in the corpus are not limited to texts related to schedules. The texts in the corpus can be of any content, and this embodiment does not limit this.
[0196] Furthermore, in order to avoid repeated screening of previously selected keywords and texts during the screening process, before the current round of processing, for example, the data in the first training set and the data in the first keyword set contained in the corpus can be checked and deleted. Figure 4 As shown, the data of the training set and the keyword set are removed from the corpus.
[0197] It can be understood that in step S701, the processing method for each of the multiple reserve texts is similar, so any reserve text is used as an example for introduction below.
[0198] In this embodiment, for example, the text vector of the reserve text can be determined according to the first keyword set, wherein the first keyword set has been introduced in the above embodiment and will not be described in detail here. And 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, and will not be described in detail here.
[0199] Exemplarily, after the corpus is collected, for example, a preprocessing operation can be performed on any of the reserve texts in the corpus. The preprocessing operation described here is similar to the preprocessing operation described above, and can include operations such as word segmentation, punctuation removal, stop word removal, and preservation of uppercase and lowercase letters. Afterwards, for example, the text vector of the preprocessed reserve text can be determined based on the first keyword set. The preprocessing operation can effectively simplify and standardize the data format of the text to improve the efficiency of subsequent data processing.
[0200] S702: Input the text vector of the reserve text into the first model of the first version to obtain the predicted probabilities corresponding to the plurality of preset schedule categories output by the first model, wherein the predicted probabilities are used to indicate the probability that the reserve text meets the preset schedule category.
[0201] For example, you can refer to Figure 4The number 2 step understands the current operation, refer to Figure 4 , the text vectors of the reserve texts in the corpus can be input into the first model to obtain the predicted probabilities of the reserve texts output by the first model corresponding to the respective preset schedule categories. The first model introduced here can be understood as the first version of the first model.
[0202] Based on the above introduction, it can be determined that the first model of the first version 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 model of the first version, the first model can output the predicted probability that the text corresponds to multiple preset schedule categories. The predicted probability is used to indicate the probability that the text meets the preset schedule category.
[0203] Therefore, the text vector of the reserve text may be input into the first model of the first version, so that the first model outputs the predicted probability that the reserve text corresponds to each of the plurality of preset schedule categories.
[0204] S703: Determine the preset schedule category with the greatest prediction probability as the predicted schedule category corresponding to the reserve text.
[0205] In one implementation, for example, among the predicted probabilities of multiple preset schedule categories output by the first model, the preset schedule category with the highest predicted probability may be selected as the predicted schedule category of the reserve text.
[0206] As an example, assume that the preset schedule categories can include three categories: train travel, flight travel, and hotel accommodation. And assume that after the text vector of a reserve text is input into the first model, the first model outputs a vector: [0.85, 0.1, 0.05]. This vector indicates that the predicted probability of this reserve text belonging to the train travel category is 0.85, the predicted probability of belonging to the flight travel category is 0.1, and the predicted probability of belonging to the hotel accommodation category is 0.05. Based on the above three prediction probabilities, the preset schedule category with a predicted probability of 0.85 is selected as the schedule category corresponding to this reserve text, that is, the schedule category of this reserve text is train travel.
[0207] In this way, the accuracy of the predicted schedule categories corresponding to the reserved texts in the corpus can be guaranteed as much as possible.
[0208] S704: Select from the plurality of reserve texts a plurality of intermediate texts whose predicted probabilities corresponding to the predicted schedule categories are greater than a first threshold.
[0209] For example, you can refer to Figure 4 Understand the current operation in step 3, refer to Figure 4, the prediction probabilities corresponding to the multiple reserve texts output by the first model are processed to mine the target texts with greater relevance to the predicted schedule category. The first model introduced here can be understood as the first model of the first version.
[0210] Through the above analysis, it can be determined that the first model will output the predicted probability of the reserve text corresponding to each preset schedule category, and in this embodiment, the preset schedule category with the highest predicted probability will be selected as the predicted schedule category of the reserve text. It can be understood that each predicted schedule category of the reserve text corresponds to a predicted probability.
[0211] It can be understood that when the prediction probability corresponding to the forecast schedule category of the reserve text is greater, it means that the reliability of the reserve text belonging to the corresponding forecast schedule category is higher. Then when screening in the reserve text, for example, the reserve text with a larger prediction probability corresponding to the forecast schedule category can be screened, and subsequent processing is performed based on this part of the reserve text. The smaller the prediction probability corresponding to the forecast schedule category, the less reliable the reserve text belongs to the corresponding forecast schedule category, so this part of the reserve text can be screened out.
[0212] In one implementation, for example, a first threshold may be set, and the reserve texts may be screened based on the first threshold. The first threshold is a threshold used to measure the predicted probability corresponding to the predicted schedule category of the reserve text, so as to screen out the intermediate texts from the multiple reserve texts. In this embodiment, the reserve texts screened out after the preliminary screening are referred to as intermediate texts.
[0213] For example, the first threshold may be a preset value. For example, the reserve texts whose predicted probability corresponding to the predicted schedule category is greater than or equal to the first threshold may be used as intermediate texts, and the reserve texts whose predicted probability corresponding to the predicted schedule category is less than the first threshold may be discarded and not used as intermediate texts.
[0214] As an example, suppose the corpus contains a total of U The first threshold is set to 0.55, and it is assumed that the total number of reserve texts corresponding to the predicted schedule category with a predicted probability greater than or equal to the first threshold 0.55 is V , then this V The reserved text is used as intermediate text for subsequent operations.
[0215] In this way, by screening the reserve texts whose predicted probability of the predicted schedule category is greater than or equal to the first threshold as intermediate texts, the reserve texts with obvious tendency intentions can be used as intermediate texts to ensure that the intermediate texts have a high correlation with the predicted schedule category corresponding to the intermediate texts, thereby ensuring subsequent keyword processing.
[0216] S705. For any intermediate text, determine the keyword density corresponding to the intermediate text based on the first number of characteristic keywords contained in the intermediate text and the second number of words contained in the intermediate text. The characteristic keywords are keywords in the first keyword set that belong to the predicted schedule category of the intermediate text. The keyword density is proportional to the first number and inversely proportional to the second number.
[0217] It can be understood that the processing method for each of the multiple intermediate texts in step S705 is similar, so any intermediate text is taken as an example for description below.
[0218] In this embodiment, the keywords in the first keyword set that belong to the predicted schedule category of the intermediate text are defined as feature keywords. For example, there is currently an intermediate text 1, and the predicted schedule category corresponding to the intermediate text 1 is train travel, then the keywords in the first keyword set that belong to the schedule category of train travel are the feature keywords currently introduced. Afterwards, for example, the keyword density of the intermediate text can be determined based on the first number of feature keywords contained in the intermediate text and the second number of words contained in the intermediate text.
[0219] In one implementation, keyword density can be used to measure the relevance of a text to a 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 may be, which means 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 based on the first quantity and the second quantity introduced above to measure the relevance of the intermediate text and the corresponding predicted schedule category.
[0220] At the same time, it is understandable that in the case of a long text, since the text itself may contain more characteristic keywords, it is possible that the keyword density of the long text is naturally higher. In other words, long text has an advantage in calculating keyword density. In order to balance the density of the text and reduce the impact of the text length on the text density, for example, the processing idea of normalization can be analogized, and the first number of characteristic keywords contained in the intermediate text can be processed accordingly according to the second number of words contained in the intermediate text to obtain the keyword density corresponding to the intermediate text.
[0221] In one implementation, for example, the first number of characteristic keywords included in the intermediate text can be reduced according to the second number of words included in the intermediate text to adjust the first number corresponding to the intermediate text to a smaller numerical level, and then the keyword density corresponding to the intermediate text is obtained.
[0222] Exemplarily, the keyword density is proportional to the first quantity and inversely proportional to the second quantity. Specifically, the greater the first quantity of characteristic keywords included in the intermediate text, and the smaller the second quantity of words included in the intermediate text, the greater the keyword density corresponding to the intermediate text.
[0223] As an example, in one implementation, it can be assumed that Is the first of multiple intermediate texts The middle text, It is The predicted schedule category corresponding to the middle text, then the middle text In the forecast schedule category corresponding to this text Keyword density The following formula 4 can be satisfied: Formula 4 In formula 4, It is the middle text Included in the forecast schedule category No. Keywords (that is, the characteristic keywords introduced above), Type( ) represents the number of deduplicated keywords determined for the feature keywords. It is the middle text The Referring to Formula 4, it can be determined that, for example, the ratio of the first number of characteristic keywords included in the intermediate text to the second number of words included in the intermediate text can be determined as the keyword density corresponding to the intermediate text.
[0224] However, it is understandable that, in the actual implementation process, the implementation method of calculating the keyword density corresponding to the intermediate text according to the first number of characteristic keywords contained in the intermediate text and the second number of words contained in the intermediate text can be arbitrarily expanded according to actual needs. As long as the processing logic is based on the keyword density being proportional to the first number and inversely proportional to the second number, the effect of measuring the keywords of the predicted schedule category contained in the text can be achieved.
[0225] S706: Determine a 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 proportional to the keyword density and the predicted probability.
[0226] Based on the above introduction, it can be understood that keyword density can be used to measure the relevance of text and schedule categories. Specifically, the higher the keyword density, the denser the keywords in the text, which means that the text covers a wider range of keywords for predicting schedule categories.
[0227] Furthermore, the prediction probability corresponding to the predicted schedule category of the intermediate text can be used to indicate the possibility that the intermediate text belongs 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 that the intermediate text belongs to the corresponding predicted schedule category.
[0228] Therefore, in this embodiment, the first score corresponding to the intermediate text can be determined based on the keyword density corresponding to the intermediate text and the prediction probability corresponding to the predicted schedule category of the intermediate text. Among them, the keyword density corresponding to the intermediate text can be regarded as starting from the breadth of the correlation between the text and the schedule category to measure the correlation between the intermediate text and the corresponding predicted schedule category. And the prediction probability can be regarded as starting from the depth of the correlation between the text and the schedule category to measure the correlation between the intermediate text and the corresponding predicted schedule category.
[0229] Then, by measuring the correlation between the intermediate text and the predicted schedule category corresponding to the intermediate text from the above two dimensions, the mined text can be the text with greater correlation with the predicted schedule category, so as to achieve further screening of the text, thereby facilitating subsequent keyword mining processing.
[0230] 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.
[0231] As an example, in one implementation, the first score The following formula 5 can be satisfied: Formula 5 In Formula 5, For the first of multiple intermediate texts Intermediate text, It is The predicted schedule category corresponding to the middle text, It is the middle text Corresponding forecast schedule category Keyword density, It is the middle text The predicted probability corresponding to the predicted schedule category. Referring to Formula 5, it can be determined that, for example, 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.
[0232] However, it is understandable that in the actual implementation process, the implementation method of calculating 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 can be arbitrarily expanded according to actual needs. As long as the processing logic is based on the first score being proportional to the keyword density and the predicted probability, the effect of measuring the relevance of the text and the predicted schedule category can be achieved.
[0233] S707: Select multiple target texts from the multiple intermediate texts according to the first scores corresponding to the multiple intermediate texts.
[0234] It can be understood from the above description that the first score corresponding to each intermediate text can reflect the correlation between the intermediate text and the predicted schedule category corresponding to the intermediate text. The larger the first score, the greater the correlation between the intermediate text and the predicted schedule category corresponding to the intermediate text.
[0235] Then, for example, according to the first scores corresponding to the multiple intermediate texts, the first intermediate text with the highest first score can be selected from the multiple intermediate texts as the target text.
[0236] In one implementation, the first scores of all the intermediate texts may be sorted. For example, the first scores of the intermediate texts may be sorted in descending order to measure the size of the first scores of the intermediate texts, so as to select the first score with the highest first score. The intermediate text is used as the target text.
[0237] It can be understood from the above embodiments that multiple reserve texts in the corpus are input into the first model of the first version, and the first model can output the predicted probabilities of each preset schedule category corresponding to each of the multiple reserve texts. And the predicted schedule category corresponding to the reserve text can be determined according to the highest predicted probability. In this way, the preset schedule category with the most significant tendency in the prediction of the reserve text in the corpus by the first model is designated 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.
[0238] Afterwards, multiple intermediate texts can be screened out from the multiple reserve texts according to the first threshold value, and the reserve texts with predicted probabilities greater than the first threshold value are selected as intermediate texts, which have a high correlation with the predicted schedule category, thereby providing an accurate and reliable data basis for subsequent processing.
[0239] Furthermore, according to the keyword density corresponding to the plurality of intermediate texts and the prediction probability corresponding to the predicted schedule category of the intermediate texts, the first scores corresponding to the plurality of intermediate texts can be determined. Moreover, according to the first scores corresponding to the plurality of intermediate texts, a plurality of target texts can be selected from the plurality of intermediate texts. This process comprehensively considers the breadth and depth of the correlation between the text and the schedule category, effectively quantifies the correlation between the intermediate text and the predicted schedule category, thereby screening out texts that are highly matched with the predicted schedule category, and providing reliable and solid data support for subsequent processing.
[0240] The above introduces the processing flow of text mining. Next, the mined target text will be used to implement keyword mining.
[0241] The process of keyword mining is described in conjunction with a specific embodiment. Figure 4 , Figures 8 to 14 Give a detailed introduction, Figure 4 A schematic diagram of the first model training provided in an embodiment of the present application, Figure 8 A flowchart of keyword mining provided in an embodiment of the present application is provided. Fig. 9 A schematic diagram of the first parameter calculation provided in an embodiment of the present application, Fig.10 A schematic diagram of information entropy calculation provided in an embodiment of the present application, Fig.11 A schematic diagram of the first information gain calculation provided in an embodiment of the present application, Fig.12 A schematic diagram of determining a preset schedule category to which a candidate word belongs provided in an embodiment of the present application, Fig.13 A schematic diagram of an implementation method for selecting a supplementary keyword from a candidate vocabulary provided in an embodiment of the present application, Fig.14 A schematic diagram of another implementation method of selecting supplementary keywords from candidate words provided in an embodiment of the present application. The keyword mining process may include the following steps: S801. For any one of a plurality of vocabularies, calculate a first parameter of each of the vocabularies corresponding to a plurality of target texts, where the first parameter is used to indicate the importance of the vocabularies in the target text.
[0242] It can be understood from the above introduction that in this embodiment, new keywords can be determined based on multiple target texts. For example, multiple words can be determined based on multiple target texts first, and then new keywords can be screened out from the multiple words. The following first describes the implementation of determining multiple words based on multiple target texts.
[0243] In this embodiment, for example, multiple target texts can be split in the form of n-grams to obtain multiple words. Among them, the essence of a 1-gram word is a word, the essence of a 2-gram word is a combination of two words, and an n-gram word is a combination of n words. As an example, 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, and it can be set arbitrarily according to actual needs. And it should be noted that in the process of splitting multiple words in the form of n-grams, in addition to splitting to obtain words containing n words, it is also necessary to split to obtain words containing n-1 words, words containing n-2 words, ..., and so on, until a word containing 1 word is obtained.
[0244] Subsequently, in this embodiment, multiple words will be processed separately, and the processing methods of each word are similar, so any word is used as an example for introduction. In one implementation, for example, the importance of a word in a target text can be measured, so for example, a first parameter of the word corresponding to the target text can be calculated, and the first parameter is used to indicate the importance of the word in the target text.
[0245] For example, the importance of a word in a text can be measured based on TF-IDF, that is, the TF-IDF value of the word for the target text can be used as the first parameter, or the specific implementation of the first parameter can be arbitrarily selected according to actual needs, as long as the first parameter can be used to implement the above-mentioned functions. The following steps are described by taking the TF-IDF value as the first parameter as an example.
[0246] For example, further reference Fig. 9 Understand the calculation of TF-IDF value. For example, Fig. 9 As shown, it is assumed that there are currently multiple vocabularies and multiple target texts. The multiple vocabularies may include, for example, vocabulary a, vocabulary b, and vocabulary c, and the multiple target texts may include, for example, text 1, text 2, and text 3. Then, for example, the TF-IDF value of vocabulary a corresponding to text 1 can be calculated to obtain the value 1a shown in the figure, and the TF-IDF value of vocabulary a corresponding to text 2 can be calculated to obtain the value 2a shown in the figure, and so on, so as to obtain the TF-IDF values of each vocabulary corresponding to the multiple target texts.
[0247] The TF-IDF values of each word corresponding to multiple target texts can be expressed as Fig. 9 The form of the two-dimensional matrix shown.
[0248] S802: Calculate variances according to first parameters of the vocabulary corresponding to the plurality of target texts, and obtain target variances corresponding to the vocabulary.
[0249] Through the above introduction, it can be understood that for a word, the first parameters corresponding to multiple target texts can be obtained. Furthermore, if the values of the first parameters of the word in multiple target texts (such as TF-IDF values) are quite different, it means that the word appears more frequently in some target texts, but less frequently or not at all in other target texts, which means that the word has a strong text-distinguishing ability. On the contrary, if the values of the first parameters of the word in multiple target texts (such as TF-IDF values) are less different, it means that the word may appear in most or even all target texts, which means that the word has a poor text-distinguishing ability.
[0250] When a word has a stronger text distinguishing ability, the possibility that the word can represent the theme of a preset schedule category is greater. Therefore, in this embodiment, the word can be screened according to the difference in the first parameters of the words corresponding to the multiple target texts. The words with large differences in the first parameters corresponding to the multiple target texts are used as candidate keywords for subsequent keyword processing.
[0251] For example, the target variance corresponding to the vocabulary can be obtained by calculating the variance of the first parameters of each of the multiple target texts corresponding to the vocabulary, and then the difference in the first parameters of each of the multiple target texts corresponding to the vocabulary can be measured based on the target variance to determine the text differentiation ability of the vocabulary in the multiple target texts.
[0252] S803: Filter out some words from the multiple words as candidate words according to the target variances corresponding to the multiple words.
[0253] Through the above introduction, it can be determined that the target variances corresponding to multiple words reflect the text differentiation ability of each word. Specifically, if the target variance corresponding to the word is larger, the text differentiation ability of the word in multiple target texts is stronger, and if the target variance corresponding to the word is smaller, the text differentiation ability of the word in multiple target texts is weaker.
[0254] Therefore, for example, based on the target variances corresponding to the multiple words, some words with larger target variances can be screened out from the multiple words as candidate keywords. These words with larger target variances are words with stronger text distinguishing ability.
[0255] In one implementation, the target variances of all words may be sorted. For example, the target variances of the words may be sorted from large to small to measure the size of the target variances of the words, and then the top 200 words with the highest target variances (or any other numerical value) may be selected as candidate words.
[0256] S804. For any candidate word among the multiple candidate words, determine the first word frequency ratio of the candidate word corresponding to each of the multiple target texts of the first type according to the third number of times the candidate word appears in each of the multiple target texts of the first type and the total number of times the candidate word appears in the multiple 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 one of the multiple preset schedule categories.
[0257] S805. Determine the first information entropy of the candidate vocabulary corresponding to the first schedule category according to the first word frequency ratios of the candidate vocabulary corresponding to the first type of target texts, wherein the first information entropy is inversely proportional to the overall difference between the first word frequency ratios.
[0258] The steps S804 and S805 are explained together below. It can be understood that the processing methods for multiple candidate words in steps S804 and S805 are similar, so any candidate word is used as an example for description below.
[0259] After screening multiple candidate words, further screening can be performed within the scope of the multiple candidate words to obtain multiple words after screening, and this part of the words can be used as expanded keywords. In the process of screening multiple 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 explained below.
[0260] In information theory, information entropy is an important indicator to measure 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 the information, which usually means that the average amount of information contained in the information is small. On the contrary, the larger the information entropy, the higher the degree of information disorder, that is, the greater the uncertainty of the information, and the more average information contained in the information.
[0261] For example, the information entropy of the candidate words corresponding to a specific schedule category can be used to measure the distribution of the candidate words in the schedule category.
[0262] In this embodiment, there may be an indicator called first information entropy, where the first information entropy can be used to measure the uniformity of distribution of candidate words in multiple texts of a specific schedule category. Taking the schedule category of "train travel" as an example, assuming that the more evenly the candidate words are distributed in multiple texts of this schedule category, it means that this candidate word is a word that commonly appears in multiple texts of this schedule category, then the candidate word is more likely to be a more critical word under this schedule category. Therefore, based on the first information entropy, the possibility that the candidate word can be used as a keyword for a specific schedule category can be effectively measured.
[0263] The calculation process of the first information entropy is described below. Before introducing the first information entropy, the calculation logic of the information entropy is briefly introduced in combination with the following formula.
[0264] In one implementation, suppose there is a batch of samples, and suppose that these samples can be divided into multiple categories, and each sample belongs to a specific category. Then the information entropy corresponding to this batch of samples is The calculation formula can satisfy the following formula 6: Formula 6 In Formula 6, It means that among all samples The ratio of the number of class samples to the total number of samples. It can be used to measure the uncertainty of each type of sample. To simplify the calculation, refer to Formula 6. For example, the formula The approximate calculation formula is , through the formula Calculate the uncertainty degree corresponding to each type of sample, and sum the uncertainty degrees corresponding to each type of sample to obtain the information entropy corresponding to this batch of samples.
[0265] The following is an illustrative example of the calculation of information entropy. Fig.10 , assuming that there is currently a sample set containing 100 target texts, and assuming that there are currently three preset schedule categories: train travel, flight travel, and hotel accommodation, among which these 100 target texts have their own corresponding predicted schedule categories.
[0266] Assume that there are two distributions of the three preset schedule categories in these 100 target texts, and the corresponding information entropy of the sample set in the two cases is also different. Fig.10In (a), suppose there are 70 train travel texts, 20 flight travel texts, and 10 hotel accommodation texts among the 100 target texts. Then we can get that the train travel target texts account for 0.7 of the total target texts, the flight travel target texts account for 0.2 of the total target texts, and the hotel accommodation target texts account for 0.2 of the total target texts. Then referring to the formula introduced above, we can determine that the calculation process of the information entropy of the sample set is: , the value is 0.46.
[0267] refer to Fig.10 In (b), suppose there are 34 train travel texts, 33 flight travel texts, and 33 hotel accommodation texts among the 100 target texts. Then we can get that the train travel target texts account for 0.34 of the total target texts, the flight travel target texts account for 0.33 of the total target texts, and the hotel accommodation target texts account for 0.33 of the total target texts. Then referring to the formula introduced above, we can determine that the calculation process of the information entropy of the sample set is: , with a value of approximately 0.67.
[0268] Based on the above two examples, it can be understood that when the number of samples contained in each category in all samples is more uniform, the information entropy is greater. On the contrary, when the number of samples contained in each category in all samples is more different, the information entropy is smaller.
[0269] Analogously to the technical solution of this embodiment, when a candidate word is distributed more evenly in multiple target texts contained in a specific schedule category, it means that the candidate word is more representative in the text of this specific schedule category, that is, the candidate word can be regarded as a keyword under this specific schedule category.
[0270] In other words, information entropy can be used to determine whether a word appears in most of the texts in a specific schedule category. If a word basically appears in the texts of a specific schedule category, it means that the word is a relatively representative word in the schedule category.
[0271] As an example, for the schedule category of train travel, in actual scenarios, all texts in this category may contain the word "train ticket", that is to say, the word "train ticket" basically appears in the texts of the schedule category of train travel, that is, the word "train ticket" is evenly distributed in the texts of the schedule category of train travel, which indicates that "train ticket" is representative in the schedule category of train travel.
[0272] Based on the above-mentioned implementation of information entropy, the calculation of the first information entropy proposed in this embodiment is introduced below. In this embodiment, the first information entropy corresponding to a preset schedule category can be calculated for a candidate word. At the same time, because there are multiple preset schedule categories, for the sake of convenience, the first schedule category is introduced below. It can be understood that the first schedule category is any one of the multiple preset schedule categories.
[0273] In one implementation, first, the first word frequency ratio of each of the candidate words corresponding to the multiple target texts of the first schedule category can be determined based on the third number of times each of the candidate words appears in the multiple target texts of the first schedule category, and the total number of times each of the candidate words appears in the multiple target texts of the first schedule category. Then, based on the obtained first word frequency ratio of each of the multiple target texts corresponding to the first schedule category, the first information entropy of the candidate words corresponding to the first schedule category can be determined. The calculation of the first word frequency ratio and the calculation of the first information entropy are introduced in conjunction with specific formulas.
[0274] In one implementation, the first word frequency ratios of the plurality of target texts corresponding to the first schedule category are The calculation formula can satisfy the following formula 7: Formula 7 In Formula 7, Representative Candidate words In the first schedule category No. The number of occurrences in is the candidate word in The third occurrence of the number. Representative candidate words In the first schedule category The number of times the candidate words appear in all the texts of the first schedule category, that is, the total number of times the candidate words appear in multiple target texts of the first schedule category.
[0275] Referring to Formula 7, it can be determined that, for example, the ratio of the third number of times a candidate word appears in each of the multiple target texts of the first schedule category to the total number of times the candidate word appears in the multiple target texts of the first schedule category can be determined as the first word frequency ratio corresponding to each of the multiple target texts of the first schedule category.
[0276] After obtaining the first word frequency ratios of the plurality of target texts corresponding to the first schedule category of the candidate vocabulary Afterwards, the first information entropy of the candidate words corresponding to the first schedule category can be calculated based on the first word frequency ratios of the plurality of target texts of the first schedule category.
[0277] In one implementation, the candidate word corresponds to a first information entropy of the first schedule category The calculation formula can satisfy the following formula eight: Formula 8 Among them, the formula For the first word frequency ratio Process to obtain the The candidate words correspond to Afterwards, the uncertainty degrees corresponding to the multiple 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.
[0278] The above combination of Formula 7 and Formula 8 respectively introduces possible implementation methods of the first word frequency ratio and the first information entropy, but it should be understood that the implementation of the above formulas is only an exemplary description.
[0279] In the actual implementation process, the specific implementation method of calculating the first word frequency ratio can be arbitrarily expanded according to actual needs. As long as the processing logic is based on the first word frequency ratio being proportional to the third number of times the candidate word appears in each of the first type of multiple target texts, and inversely proportional to the total number of times the candidate word appears in the first type of multiple target texts, the effect of measuring the relevance of the text and the predicted schedule category can be achieved.
[0280] And, in the actual implementation process, the specific implementation of calculating the first information entropy can also be arbitrarily expanded according to actual needs. As long as the processing logic is inversely proportional to the difference between the first information entropy and the overall difference between the first word frequency proportions, the more evenly the candidate word is distributed in multiple target texts, the more representative the candidate word is.
[0281] S806. Determine the first category ratio corresponding to the first schedule category 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 second category ratio 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.
[0282] S807. Determine the first information gain corresponding to the candidate vocabulary according to the first category proportion corresponding to each of the plurality of preset schedule categories and the second category proportion corresponding to each of the plurality of preset schedule categories. The first information gain is proportional to the degree of difference between the first category proportion and the second category proportion.
[0283] S806 and S807 are explained together below. It is introduced above that some indicators can be set in this embodiment to measure the candidate words, so as to realize the screening of the candidate words. In this embodiment, there can also be an indicator called first information gain. Exemplarily, a first information gain can be calculated for a candidate word. When a candidate word can be used as an effective distinguishing feature in the target text of each preset schedule category, the first information gain of this candidate word is relatively large. On the contrary, when a candidate word cannot be used as an effective distinguishing feature in the target text of each preset schedule category, the first information gain of this candidate word is relatively small. In other words, the first information gain in this embodiment can measure whether the candidate word can effectively distinguish the text of each preset schedule category.
[0284] As an example, for the word "appointment", in actual scenarios, you can make reservations for trains, planes, hotels, and other matters, so the word "appointment" can appear in many schedule categories. For example, the text of schedule categories such as train travel, flight travel, and hotel accommodation corresponding to the above matters may contain this word. Therefore, it can be understood that the word "appointment" cannot distinguish multiple schedule categories well, and the first information gain corresponding to this word is relatively small.
[0285] For another example, in actual scenarios, the word "xxx railway station" will most likely only appear in texts of the schedule category of train travel, while in texts of other schedule categories, such as air travel or hotel accommodation, the word "xxx railway station" may not appear or may appear with a low probability. In this case, the word "xxx railway station" has a higher ability to distinguish categories, and the first information gain corresponding to the word is also relatively large.
[0286] A possible calculation method of the first information gain is described below. In one implementation, the first information gain The calculation formula can satisfy the following formula nine: Formula 9 In Formula 9, It can be understood as a general term for all schedule categories. refers to the number of preset schedule categories. Refers to the Preset Schedule Categories The ratio of the number of target texts included to the total number of target texts, i.e. The proportion of the first category. Refers to the Candidate words , and belongs to Preset Schedule Categories The number of target texts, including Candidate words The ratio of the total target text quantity, that is The proportion of the second category.
[0287] In Formula 9, It refers to the distribution of target texts of each preset schedule category in the entire target text under the original situation (without considering specific candidate words). It means in the candidate words as features (that is, we need to consider candidate words), the distribution of target texts of each preset schedule category in the entire target text. In other words, It means that each preset schedule category contains The target text of the candidate vocabulary contains The distribution of candidate words in the entire target text.
[0288] Specifically, for the Candidate words Among all the target texts, if the number of target texts belonging to a certain preset schedule category is large, and the number of target texts belonging to other preset schedule categories is small, then The smaller the value of The candidate words have a stronger ability to distinguish categories (because they appear in certain specific categories). On the contrary, if the word containing Candidate words Among all the target texts, the number of target texts belonging to all preset schedule categories is close, that is, including Candidate words The target text is evenly distributed in each preset schedule category. The larger the value, the The category discrimination ability of candidate words is weak (because they appear evenly in each category). Therefore, it is understandable that the candidate words with higher category discrimination ability correspond to The value should be smaller.
[0289] and The degree of difference can be used to express that without adding The distribution of target texts of multiple preset schedule categories in all target texts is statistically obtained when candidate words are used as features. Compared with When the candidate words are used as features, the distribution of the target texts of the multiple preset schedule categories in the entire target texts is statistically obtained, which is the first information gain corresponding to the candidate words introduced above. Specifically, and The greater the difference, the greater the first information gain corresponding to the candidate vocabulary.
[0290] Here, the above-mentioned "distribution of target texts of multiple preset schedule categories in all target texts" is further explained 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 texts of multiple preset schedule categories in all target texts" means determining the text distribution of preset schedule categories a, b, and c according to the proportion of target texts contained in each of preset schedule categories a, b, and c in all target texts.
[0291] Furthermore, in order to avoid different scales of difference, for example, the first information gain can be adjusted by using a normalized design idea. . Referring to Formula 9, we can use To reduce and to reduce the scale of the difference.
[0292] Referring to Formula 9, it can be determined that, for example, the sum of the uncertainty levels of the first category proportions corresponding to the plurality of preset schedule categories and the sum of the uncertainty levels of the second category proportions corresponding to the plurality of preset schedule categories of the candidate vocabulary can be determined as the first information gain corresponding to the candidate vocabulary. Furthermore, the difference can be divided by the sum of the uncertainty levels corresponding to the first category proportions to obtain the first information gain corresponding to the candidate vocabulary.
[0293] However, it is understandable that, in the actual implementation process, the implementation method of calculating the first information gain can be arbitrarily expanded according to actual needs, as long as the processing logic is proportional to the difference between the sum of the first information gain and the degree of uncertainty corresponding to the first category proportion and the sum of the degree of uncertainty corresponding to the second category proportion.
[0294] In order to further understand the above-mentioned contents, the calculation of the first information gain is further explained below with reference to a specific example.
[0295] For example, refer to Fig.11, assuming that there is currently a sample set, the set contains 10 texts, namely text 1 to text 10 as 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.
[0296] Then it can be determined that the first category of category C1 accounts for , the first category of category C2 accounts for , the first category of category C3 accounts for .
[0297] And suppose that among these 10 texts, there are three different situations of texts containing vocabulary 1, and the information gain of the sample set in the corresponding three situations is also different.
[0298] refer to Fig.11 In (a), suppose that the 10 texts that contain word 1 are text 2, text 4, text 8, text 9, and text 10. Then the second category proportion of category C1 is , the second category of category C2 accounts for , the second category of category C3 accounts for .
[0299] Referring to the formula introduced above, the calculation process of the information gain of the sample set can be determined as follows: , with a value of approximately 0.15.
[0300] refer to Fig.11 In (b), suppose that the 10 texts that contain word 1 are text 1, text 2, text 8, text 9, and text 10. Then the second category proportion of category C1 is , the second category of category C2 accounts for , the second category of category C3 accounts for .
[0301] Referring to the formula introduced above, the calculation process of the information gain of the sample set can be determined as follows: , with a value of approximately 0.27.
[0302] refer to Fig.11 In (c), let's assume that the 10 texts that contain word 1 are text 8, text 9, and text 10. Then the second category proportion of category C1 is , the second category of category C2 accounts for , the second category of category C3 accounts for .
[0303] Referring to the formula introduced above, the calculation process of the information gain of the sample set can be determined as follows: , with a value of approximately 1.
[0304] Based on the above three examples, it can be understood that when vocabulary 1 is used as a feature (that is, vocabulary 1 needs to be considered), the more evenly the texts of each preset schedule category are distributed in the entire text, the smaller the information gain corresponding to the vocabulary. In other words, the more evenly the target text containing vocabulary 1 is distributed under each preset schedule category, for example, it is concentrated under each preset schedule category, the smaller the information gain corresponding to vocabulary 1 is.
[0305] On the contrary, the greater the distribution difference of each preset schedule category in the entire text, the greater the information gain corresponding to the vocabulary. That is, the greater the distribution difference 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.
[0306] S808. Determine a second score for the candidate word based on the first information entropy and the first information gain of the candidate word corresponding to the preset schedule category to which the candidate word belongs. The second score is proportional to the first information entropy and the first information gain. The preset schedule category to which the candidate word belongs is the preset schedule category with the largest first information entropy.
[0307] S809: Select a supplementary keyword from the plurality of candidate words according to the second scores corresponding to the plurality of candidate words.
[0308] Through the above introduction, it can be determined that the first information entropy corresponding to each preset schedule category can be calculated for a candidate word, and the first information gain corresponding to each candidate word can also be calculated. In this embodiment, the score corresponding to each candidate word can be calculated based on the first information entropy and the first information gain, and then the expanded supplementary keywords are screened out from the candidate words based on the score.
[0309] However, based on the above introduction, it can be determined that each candidate word actually corresponds to multiple first information entropies, because the first information entropies corresponding to each preset schedule category are calculated for each candidate word in the above calculation process. In order to effectively calculate the score for the candidate word, in this embodiment, for example, the preset schedule category to which the candidate word belongs can be determined, and then the score is calculated based on the first information entropy corresponding to the preset schedule category to which the candidate word belongs.
[0310] It can be understood that the larger the first information entropy of a candidate word in a preset schedule category, the more evenly distributed and common the candidate word is in the text of the preset schedule category. This means that the probability that the candidate word belongs to the preset schedule category is greater. Therefore, the preset schedule category with the largest first information entropy corresponding to the candidate word can be selected as the preset schedule category to which the candidate word belongs.
[0311] like Fig.12 As shown, for example, assume that there are currently three preset schedule categories of vocabulary 1, C1, C2 and C3. Also, assume 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.
[0312] Based on the above method, determine the schedule category to which vocabulary 1 belongs, then refer to Fig.12 , it can be determined that category C1 is the preset schedule category to which vocabulary 1 belongs.
[0313] At the same time, it can 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 keywords. The second score is used to indicate the scores of the first information entropy and the first information gain corresponding to the candidate vocabulary, which is used to sort and screen the candidate vocabulary later. The scores of the first information entropy and the first information gain corresponding to the candidate vocabulary can also be set to any name according to actual needs, and this embodiment does not limit this.
[0314] In one implementation, the calculation formula for the second score of the candidate vocabulary may satisfy the following formula 10: Formula 10 In Formula 10, For the Candidate words The category of Candidate words Schedule category The preset schedule category corresponding to the candidate vocabulary has the largest first information entropy. For the Candidate words The first information gain.
[0315] It can be determined by referring to Formula 10 that, for example, the product of the first information entropy corresponding to the candidate word and the first information gain of the candidate word can be determined as the second score corresponding to the candidate word.
[0316] However, it is understandable that, in the actual implementation process, the implementation method of calculating the second score corresponding to the candidate vocabulary can be arbitrarily expanded according to actual needs. As long as the processing logic is based on the second score being proportional to the first information entropy and the first information gain, the larger the first information entropy and the first information gain corresponding to the candidate vocabulary, the higher the score corresponding to the candidate vocabulary.
[0317] It can be understood that after the second scores of the candidate words are obtained, the supplementary keywords can be selected from the multiple candidate words according to the second scores corresponding to the multiple candidate words, for example.
[0318] In this embodiment, in one implementation, for example, the candidate words under each preset schedule category can be sorted separately. For example, the second scores of the candidate words in the preset schedule category can be sorted in descending order to measure the size of the second scores of the candidate words, so as to select the top candidate words with the highest second score in each preset schedule category. candidate words as supplementary keywords.
[0319] Specifically, in order to ensure uniform classification, after sorting the second scores of the candidate words contained in each preset schedule category, the top words in each preset schedule category are selected. candidate words as supplementary keywords for each preset schedule category.
[0320] As an example, refer to Fig.13 , assuming that there are currently 10 candidate words, namely words 1 to 10. And, there are 2 preset schedule categories, C1 and C2. Among them, words 1 to 6 belong to the C1 category, and words 7 to 10 belong to the C2 category.
[0321] refer to Fig.13 , vocabulary 1 to 10 have corresponding second scores. Among them, the second score of vocabulary 1 is 0.98, the second score of vocabulary 2 is 0.33, the second score of vocabulary 3 is 0.64, the second score of vocabulary 4 is 0.82, the second score of vocabulary 5 is 0.53, the second score of vocabulary 6 is 0.68, the second score of vocabulary 7 is 0.86, the second score of vocabulary 8 is 0.55, the second score of vocabulary 9 is 0.74, and the second score of vocabulary 10 is 0.42.
[0322] Assume that 6 supplementary keywords need to be selected from the 10 candidate words as supplementary keywords for subsequent operations. The 6 supplementary keywords can be composed of 3 selected from the candidate words of the two categories C1 and C2 respectively.
[0323] refer to Fig.13For category C1, the sequence 1301 is obtained by sorting the words 1 to 6 according to the second scores, and the first three candidate words with the largest second scores, word 1, word 4 and word 6, can be selected as supplementary keywords for category C1. Similarly, for category C2, the sequence 1302 is obtained by sorting the words 7 to 17 according to the second scores, and the first three candidate words with the largest second scores, word 7, word 9 and word 8, can be selected as supplementary keywords for category C2.
[0324] In another implementation, the second scores of all candidate words may be sorted. For example, the second scores of all candidate words may be sorted in descending order to measure the second scores of the candidate words, so as to select a certain number of candidate words with the highest second scores as supplementary keywords. Here, the number of candidate words may depend on the number of preset schedule categories and the number of preset supplementary keywords of each category. In this way, among the round of candidate keywords selected, the schedule categories to which the candidate keywords belong may be dominated by a certain category.
[0325] As an example, refer to Fig.14 , assuming that there are currently 10 candidate words, namely words 1 to 10. And, there are 2 preset schedule categories, C1 and C2. Among them, words 1 to 6 belong to the C1 category, and words 7 to 10 belong to the C2 category.
[0326] refer to Fig.14 , vocabulary 1 to 10 have corresponding second scores. Among them, the second score of vocabulary 1 is 0.98, the second score of vocabulary 2 is 0.33, the second score of vocabulary 3 is 0.64, the second score of vocabulary 4 is 0.82, the second score of vocabulary 5 is 0.53, the second score of vocabulary 6 is 0.68, the second score of vocabulary 7 is 0.86, the second score of vocabulary 8 is 0.55, the second score of vocabulary 9 is 0.74, and the second score of vocabulary 10 is 0.42.
[0327] Assume that 6 supplementary keywords need to be selected from the 10 candidate words as supplementary keywords for subsequent operations. The 6 supplementary keywords may be the first 6 candidate words with the largest second scores.
[0328] refer to Fig.14, according to the size of the second scores of words 1 to 10, the sequence 1401 is obtained by sorting, and the first 6 candidate words with the largest second scores, word 1, word 7, word 4, word 9, word 6 and word 3, can be selected as supplementary keywords. Among them, word 1, word 4, word 6 and word 3 are candidate words belonging to the C1 category, and word 7 and word 9 are candidate words belonging to the C2 category. It can be understood that among the candidate keywords selected by this method, the majority belong to the C1 schedule category.
[0329] Usually, different keywords can be selected through these two methods. In this embodiment, both methods can be implemented, and then the union of candidate words is taken, and the selected candidate words are all used as supplementary keywords.
[0330] S810: Filter out candidate words whose part of speech is verb from the candidate words to obtain a plurality of verb words.
[0331] As an extensible implementation method, after obtaining the supplementary keywords, further processing may be performed on the verb vocabulary in the candidate vocabulary to more effectively enrich the expansion of the supplementary keywords.
[0332] It is understandable that for a text, both the nouns and verbs in the text may be more representative in the text. However, usually, for a text, the frequency of verbs in the text is less than the frequency of nouns in the text. Therefore, when calculating the frequency of nouns and verbs in a text at the same time, the frequency of verbs in the text may always be lower, and the frequency of nouns may always be higher, which may result in the inability to filter out verbs in the text in subsequent processing.
[0333] Therefore, the verb words in the text may be screened again to select the verb words that can reflect the preset schedule categories.
[0334] As an example, there is a text "Um 23:46 Uhr erhielt Air-Canada-Flug 759die Erlaubnis, auf der Landebahn 28R des SFO zu landen." For ease of understanding, the Chinese translation is provided as follows: "At 11:46 p.m., Air Canada Flight 759 was approved to land on Runway 28R of SFO (San Francisco International Airport)". In this text, the word "landen" has an obvious intention tendency, and its translation is "landing". In actual situations, this word may be involved in texts in the flight travel category, while this verb word is unlikely to be widely used in other types of texts. Therefore, the verb word "landen" can be used as a keyword in the flight travel category. However, referring to the above logical introduction, it can be determined that the verb word "landen" may be omitted, that is, it will not be screened out as a supplementary keyword.
[0335] In this embodiment, the words in the plurality of target texts may be marked first, then the verb words are selected from all the words, and finally the supplementary keywords are selected from the plurality of verb words.
[0336] In one implementation, the vocabulary of the text can be annotated with the help of a part-of-speech tagger. In this embodiment, the part-of-speech tagger of Spacy is used to annotate the vocabulary in multiple target texts. As an example, for example, several words in the above text are annotated, and the result is: erhielt: Verb, Uhr: Noun, der: Det, landebahn: Noun, landen: Verb. Among them, the Chinese meaning of the vocabulary erhielt can refer to "received", Verb is used to indicate that the vocabulary of the word erhielt is a verb part of speech, the Chinese meaning of the vocabulary Uhr can refer to "clock", Noun is used to indicate that the vocabulary of the word Uhr is a noun part of speech, the Chinese meaning of the vocabulary der can refer to "of", Det is used to indicate that the vocabulary of the word der is a prepositional part of speech, the Chinese meaning of the vocabulary landebahn can refer to "runway", Noun is used to indicate that the vocabulary of the word landebahn is a noun part of speech, the Chinese meaning of the vocabulary landen can refer to "landing", and Verb is used to indicate that the vocabulary of the word landen is a verb part of speech.
[0337] S811. Selecting supplementary keywords from the multiple verb vocabularies based on the multiple target texts and the multiple verb vocabularies.
[0338] It is understood that after obtaining multiple verb words, it is necessary to select supplementary keywords from the multiple verb words. This process is the same as the process of selecting supplementary keywords from multiple target texts. The specific processing process can refer to the introduction of the above embodiment, and will not be repeated here. It is necessary to understand that the supplementary keywords selected in the current step and the supplementary keywords selected in the above step S809 can eventually be used as supplementary keywords to participate in subsequent processing.
[0339] Through the introduction of the above embodiments, it can be determined that by processing multiple target texts, supplementary keywords that are highly relevant to the preset schedule category can be extracted. These supplementary keywords can effectively reflect the theme of the preset schedule category, provide strong support for the first model, enable it to more accurately and reliably match the text with the preset schedule category, and thus enable the first model to output a more accurate and reliable prediction probability.
[0340] After obtaining the filtered target text and extended keywords based on the above-described process, in this embodiment, a new round of training can be performed on the first model based on the target text and extended keywords. Figure 4 The first model training process based on the target text and extended keywords is introduced in detail. Figure 4 A schematic diagram of the first model training provided in an embodiment of the present application. The first model training process based on text and keyword iteration may include the following steps: S1001. Add multiple target texts to a first training set to obtain a second training set, and add supplementary keywords to a first keyword set to obtain a second keyword set.
[0341] In order to distinguish data in different rounds of training processes, in this embodiment, the training set with the target text added is called the second training set, and the keyword set with the supplementary keywords added is called the second keyword set.
[0342] In one implementation, after obtaining the target text and the supplementary keywords, refer to Figure 4 For example, you can first determine whether the training of the first model has been completed. If the training of the first model has not been completed, for example, you can execute Figure 4 Step 5 in is performed to add the target text and supplementary keywords to the corresponding training set and keyword set.
[0343] S1002: Train the first model of the first version according to the second training set and the second keyword set to obtain the first model of the second version.
[0344] Reference Figure 4In the step numbered 1, in this embodiment, the first model of the first version can be trained according to the expanded second training set and the second keyword set, thereby obtaining the first model of the second version. The specific implementation of the model training is similar to that described above and will not be repeated here.
[0345] S1003. After obtaining the first model of the second version, repeatedly perform the operations of expanding the training set and expanding the keyword set, and repeatedly train the first model according to the expanded training set and the expanded keyword set until the iteration end condition is met to obtain the first model of the target version.
[0346] After obtaining the first model of the second version, for example, the operations of expanding the training set and expanding the keyword set described in the above embodiments can be repeated, 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, and the first model of the target version can be obtained.
[0347] For example, you can refer to Figure 4 To understand, after obtaining the first model trained in step 1, continue to perform steps 2, 3, and 4 in the figure to expand the training set and the keyword set. And if it is determined that the first model has not finished training, continue to perform step 5, step 1, and step 2 until the first model meets the conditions for stopping iteration.
[0348] In one implementation, the condition for ending the model iteration may be a preset number of cycles. When the number of model iterations reaches the preset number of cycles, the model iteration may be stopped to obtain the first model of the target version. In another implementation, the model iteration is stopped until the model is no longer improved, to obtain the first model of the target version.
[0349] In this way, after multiple rounds of training the model with expanded keywords and expanded target texts, the first model can learn more relevant knowledge to output prediction probabilities with higher accuracy and reliability, thereby improving the performance of the first model.
[0350] The above embodiment introduces a series of processing flows for keyword expansion. In one implementation, in order to further expand the coverage of keywords and discover more detailed keywords, the present application can also implement keyword mining through 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 the data basis for secondary recall processing to obtain further expanded keywords.
[0351] Combine the following Figure 4 and Fig.15 The first model training process based on quadratic recall is introduced in detail. Figure 4A schematic diagram of the first model training provided in an embodiment of the present application, Fig.15 A schematic diagram of the first model training based on secondary recall provided in an embodiment of the present application. The first model training process based on secondary recall may include the following steps: S1501. Determine, based on the first model of the target version, the predicted schedule category of each of the plurality of reserve texts included in the corpus.
[0352] It can be determined from the above introduction that the first model of the target version is the first model obtained through the training of the above process. In this embodiment, multiple reserve texts contained in the corpus can be input into the first model of the target version, and the model will output the predicted probabilities of each preset schedule category corresponding to each of the multiple reserve texts. 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.
[0353] S1502. Select multiple extended texts from the multiple reserve texts according to the predicted schedule categories of the multiple reserve texts, the predicted probabilities corresponding to the predicted schedule categories, and the third keyword set, where the third keyword set is the keyword set expanded before the last round of model training.
[0354] Among them, the implementation of selecting multiple extended texts from multiple reserve texts is similar to the implementation of selecting target texts from multiple reserve texts introduced in the above embodiment, and will not be repeated here.
[0355] S1503 . For any extended text, determine a plurality of extended words from the plurality of words included in the extended text according to a first similarity between each of the plurality of words included in the extended text and the extended text.
[0356] In this embodiment, after obtaining a plurality of extended texts, further screening may be performed in the extended texts, so as to determine a plurality of extended words from a plurality of words included in the extended texts.
[0357] For example, the extended text can be processed by the KeyBert model to obtain multiple extended words. KeyBert is an unsupervised keyword extraction model. For an extended text, the KeyBert model can extract and output a preset number of extended words corresponding to the extended text.
[0358] First, we will illustrate the processing effect of the KeyBert model with two examples. For example, suppose there is a text "Patients who waited for a doctor's appointment for several months did not come - their next appointment was in a few months.". The Chinese translation of this text is: "Patients who waited for a doctor's appointment for several months did not come - their next appointment was in a few months.".
[0359] Input the text into the KeyBert model and set the preset number to 5. The model then returns a keyword list corresponding to the text: ["Arzttermin", "Patienten", "Monate", "warteten", "nicht"], where the Chinese meaning of the word Arzttermin can refer to "doctor's appointment", the Chinese meaning of the word Patienten can refer to "patient", the Chinese meaning of the word Monate can refer to "several months", the Chinese meaning of the word warteten can refer to "wait", and the Chinese meaning of the word nicht can refer to "nothing".
[0360] When multiple extended texts are input into the KeyBert model, the model can output the extended words extracted from the multiple extended texts and the number of times the extended words appear in the candidate extended word list. The extended word candidate list refers to a preset number of extended word lists extracted by the model for each extended text.
[0361] As an example, there are two German texts, "The finnische Flugtag Finnair strikes a string of airline employees and runs a busy Flüge." and "Dass der erste Flugtag, der von Flughafen-Mehrheitseigentümer Franz Peter Orasch vs. Flugtag Liliair, der forür 23. April angekündigt war.", whose Chinese translations can refer to "Due to the crew strike, Finnair will cancel around one hundred flights on Sunday and Monday." and "The first flight date for Liliair airline, promised by airport major shareholder Franz Peter Orasch, has been announced as April 23.".
[0362] Input these two texts into the KeyBert model, and set the preset number to 5, that is, the model needs to output 5 keywords for each text. For example, the 5 keywords selected by the model from the first text are ["finnische", "Fluglinie", "Finnair", "Streiks", "Kabinenpersonals"], where the Chinese meaning of the word finnische can refer to "Finland", the Chinese meaning of the word Fluglinie can refer to "Airline", the Chinese meaning of the word Finnair can refer to "Finnair", the Chinese meaning of the word Streiks can refer to "Strike", and the Chinese meaning of the word Kabinenpersonals can refer to "Crew". The model selects 5 keywords from the second text, namely ["Mehrheitseigentümer", "Franz", "Fluglinie", "Liliair", "April"]. Among them, the Chinese meaning of the word Mehrheitseigentümer can refer to "majority equity holder", the Chinese meaning of the word Franz can refer to "Franz", the Chinese meaning of the word Fluglinie can refer to "airline", the Chinese meaning of the word Liliair can refer to "Lili Ai Er (airline name)", and the Chinese meaning of the word April can refer to "April". These 10 keywords are used as candidate keywords. Then, the model records the number of times these candidate keywords appear and outputs them. The result is {"finnische": 1, "Fluglinie": 2, "Finnair": 1, "Streiks": 1, "Kabinenpersonals": 1, "Liliair": 1, "April": 1, "Franz": 1, "Mehrheitseigentümer": 1}.
[0363] The following is a brief introduction to the principle of the KeyBert model: For example, the extended text can be converted into a vector representation to facilitate the subsequent model to process the extended text. In this embodiment, the 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 vocabulary representation vector corresponding to multiple words in the extended text. For example, the paraphrase_multilingual_minillm (multilingual mini-MiniLM synonym paraphrase model) model can be used to convert the extended text and vocabulary into a text representation vector and a vocabulary representation vector.
[0364] Afterwards, the extended vocabulary can be selected from multiple vocabulary in the extended text according to the text representation vector and the vocabulary representation vector. In this example, the MMR (Maximal Marginal Relevance) method is used to select the extended vocabulary. The implementation steps of the MMR method include: For any extended text, the words with the highest similarity can be selected according to the similarity between each word in the extended text and the extended text, and counted into the vocabulary set. W , then the extended text contains the vocabulary set W Among the remaining words, words are selected one by one as extended words according to specific rules. The following is a detailed description of the process introduced this time with specific formulas.
[0365] The following describes the calculation method of similarity in conjunction with Formula 11. It is understandable that in this embodiment, the similarity can be calculated for words and texts, and the similarity can also be calculated for words and words. Regardless of which two types of data are used for similarity calculation, the implementation method is similar, and the similarity is calculated based on vectors. Therefore, the following first introduces the calculation logic of similarity in a unified manner without distinguishing between words and texts.
[0366] In one implementation, the calculation formula of the similarity may satisfy the following formula 11: Formula 11 In Formula 11, and are any vectors, where the vectors can be the vectors corresponding to the above words or texts. The value range of the first similarity is [-1,1].
[0367] It can be understood that the greater the first similarity, the higher the correlation between the word and a certain word or between the word and a certain text. Therefore, the word with the highest similarity to the extended text can be selected as the extended word first and counted into the word set. W Then according to the vocabulary set W And the extended text further filters the remaining extended words.
[0368] Specifically, the similarity between the remaining words in the extended text and the extended text and the word set W , score them, and select the remaining words with the largest score as the second extended words of the extended text. For example, the selection of the second extended word can be understood by referring to Formula 12: Formula 12 In Formula 12, For the Extended text, For extended text Excluding vocabulary sets W The words outside the A vocabulary. For extended text The Vocabulary and extended text The similarity. For extended text The Words and word sets W When the vocabulary set W When there is only one extended word in The similarity between the word and the extended word is taken as the Words and word sets W Similarity When the vocabulary set W When there are multiple expansion words in The vocabulary corresponds to the vocabulary set W The similarities of multiple extended words in the , and then the largest similarity is taken as the first Words and word sets W Similarity .
[0369] It is an additional parameter whose value range is the interval [0,1]. It can be understood as a parameter used to adjust the proportion of similarity with the text and difference with the vocabulary in the process of screening the extended vocabulary.
[0370] Specifically, as an example, for example, assume that there are currently three words, namely, word a, word b and word c, and assume that there is an extended text, text 1. Among them, word a is the word with the highest similarity to text 1, that is, the first extended word introduced in the above content.
[0371] In addition, suppose that the similarity between word b and text 1 is 0.8, and the similarity between word b and word a is 0.6. The similarity between word c and text 1 is 0.7, and the similarity between word b and word a is 0.2.
[0372] And, assuming The value of is 0.1. Then, referring to the formula introduced above, we can determine the word b corresponding to The value is 0.66, and the vocabulary c corresponds to The value is 0.61. Value greater than vocabulary c value, then word b can be used as the second extended word of text 1.
[0373] In addition, assuming The value of is 0.2. Then, referring to the formula introduced above, we can determine the word b corresponding to The value is 0.52, and the vocabulary c corresponds to The value is 0.52. The value is equal to the word c value, then you can discard or keep both word b and word c.
[0374] In addition, assuming The value of is 0.6. Then, referring to the formula introduced above, we can determine the word b corresponding to The value is -0.04, and the vocabulary c corresponds to 2 value is 0.16. That is, the The value is less than the vocabulary c value, then vocabulary c can be used as the second extended vocabulary of text 1.
[0375] Based on the above three examples, we can understand that for different parameter, Functions for a word and its expanded text, and its word set W The similarity metrics are different and can be selected according to actual needs. In this embodiment, Set to 0.5. Then referring to Formula 12, we can determine: The calculation results can be used as a criterion for screening extended vocabulary. For example, the remaining words in the extended text can be determined separately. The calculation result of , then the remaining word with the largest calculation result is determined as the second expanded word.
[0376] After filtering out the second extended word of the extended text, the second extended word can be added to the vocabulary set. W , and in the exclusion vocabulary set W On the basis of the above, the third extended word is selected from the remaining words in the extended text, and so on, until the selected extended words reach a preset number, then the keyword selection of the text is stopped, thereby obtaining a preset number of extended words.
[0377] In this way, by screening the extended vocabulary according to the above criteria, the first model can screen out relatively representative but different keywords for the preset schedule category, avoiding the screened keywords being very similar, so as to increase the diversity of the keywords.
[0378] S1504. For any one of the multiple extended words, determine a third similarity between the extended word and the second schedule category according to the second similarities between the extended word and the multiple keywords included in the third keyword set and belonging to the second schedule category, where the second schedule category is any one of the multiple preset schedule categories.
[0379] It is understandable that after obtaining multiple extended words based on the extended text, it is still unclear to which preset schedule category each extended word belongs. Therefore, in this embodiment, it is necessary to determine the preset schedule category to which the extended word belongs based on the similarity between the extended word and the keywords in the specific schedule category. It is understandable that the processing methods for multiple extended words are similar, so any extended word is taken as an example for introduction below.
[0380] For ease of introduction, the following takes the second schedule category as an object to introduce the similarity calculation of the extended vocabulary corresponding to multiple keywords in the second schedule category, wherein the second schedule category can be understood as any preset schedule category among multiple preset schedule categories.
[0381] In one implementation, similarity calculation can be performed between the extended vocabulary and multiple keywords belonging to the second schedule category to obtain multiple second similarities, and then the third similarity of the extended vocabulary corresponding to the second schedule category is determined based on the multiple second similarities of the extended vocabulary corresponding to the second schedule category, thereby determining the preset schedule category to which the extended vocabulary belongs. It should be understood that the multiple keywords belonging to the second schedule category mentioned in this embodiment are included in the third keyword set.
[0382] For example, after obtaining the second similarities corresponding to the multiple keywords of the second schedule category, the third similarity of the expanded vocabulary corresponding to the second schedule category can be obtained by calculating the average of the second similarities.
[0383] As an example, the calculation formula of the third similarity may satisfy the following formula 13: Formula 13 In Formula 13, For the second schedule category The number of keywords in For the second schedule category, For the An extended vocabulary, is the first keyword in the third keyword set belonging to the second schedule category. Keywords. For the The first extended word and the third keyword set that belong to the second schedule category The second similarity of keywords.
[0384] Referring to Formula 13, it can be determined that, for example, the average of the second similarities corresponding to the multiple keywords of the expanded vocabulary corresponding to the second schedule category can be taken to determine the third similarity of the expanded vocabulary corresponding to the second schedule category.
[0385] However, it is understandable that, in the actual implementation process, the implementation method of calculating the third similarity can be arbitrarily expanded according to actual needs.
[0386] S1505: Determine, according to the third similarities between the extended vocabulary and the plurality of preset schedule categories, the preset schedule category with the largest third similarity and / or a third similarity greater than a second threshold as the preset schedule category to which the extended vocabulary belongs.
[0387] It can be understood that the third similarity can measure the similarity between the extended vocabulary and the keywords in the preset schedule category. The higher the similarity between the extended vocabulary and the keywords in the preset schedule category, the greater the correlation between the extended vocabulary and the preset schedule category, which means that the probability that the extended vocabulary belongs to the preset schedule category is greater. On the contrary, the lower the similarity between the extended vocabulary and the keywords in the preset schedule category, the smaller the correlation between the extended vocabulary and the preset schedule category, which means that the probability that the extended vocabulary belongs to the preset schedule category is smaller.
[0388] Therefore, after obtaining the third similarities between the extended vocabulary and the plurality of preset schedule categories, the preset schedule category to which the extended vocabulary belongs can be determined according to the magnitudes of the third similarities between the extended vocabulary and the plurality of preset schedule categories.
[0389] Specifically, the extended vocabulary is compared with each preset schedule category. If the extended vocabulary has the highest similarity with a preset schedule category and a lower similarity with other categories, the extended vocabulary is counted as a candidate for the preset schedule category. On the contrary, if the extended vocabulary has the lowest similarity with a preset schedule category and a higher similarity with other categories, the extended vocabulary is not counted as a candidate for the preset schedule category.
[0390] In one implementation, for example, the preset schedule category with the largest third similarity can be used as the preset schedule category corresponding to the extended vocabulary. In this way, the accuracy of the preset schedule category determined for the extended vocabulary can be improved.
[0391] In another implementation, for example, the preset schedule category with a larger third similarity can be used as the preset schedule category corresponding to the extended vocabulary. Exemplarily, 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 categories with a third similarity greater than or equal to the second threshold can be assigned to their respective preset schedule categories as extended vocabulary. In this way, an extended vocabulary can belong to one or more preset schedule categories, so that the extended vocabulary has a more comprehensive coverage of the preset schedule categories.
[0392] Furthermore, in one implementation, after determining the preset schedule category corresponding to each extended vocabulary, the extended vocabulary whose third similarity to the preset schedule category is lower than the second threshold value may be discarded and no longer counted into 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 value may be set to 0.2, for example.
[0393] As an example, for the keyword "cabin", in actual situations, it has a higher similarity with airplane-related words and a lower similarity with train-related words. Therefore, the keyword "cabin" will be counted in the flight travel category and will be excluded from the train travel category.
[0394] For another example, the keyword "direction" is a common word and may be closest to train-related words, but "direction" and train-related words may not be strongly correlated. Assuming that their third similarity is lower than the second threshold, the keyword "direction" will not be included in the train travel category.
[0395] For another example, the keyword "night train" has a high similarity with train-related words, so the keyword "night train" can be included in the train travel category.
[0396] S1506: Determine a third score of the extended word according to a fourth similarity between the extended word and the preset schedule category to which the extended word belongs and a fourth number of occurrences of the extended word in the plurality of extended words, wherein the third score is proportional to the fourth similarity and the fourth number of occurrences.
[0397] Through the above introduction, it can be determined that the preset schedule category to which the extended vocabulary belongs is determined, and the extended vocabulary is preliminarily screened. After that, further screening can be performed on the extended vocabulary, for example, the extended vocabulary can be scored according to the fourth similarity between the extended vocabulary and the preset schedule category to which it belongs, and the number of occurrences of the extended vocabulary, and then the extended vocabulary is screened according to the score of the extended vocabulary to obtain the required keywords. The following first explains the two concepts of the fourth similarity and the number of occurrences of the extended vocabulary.
[0398] The calculation method of the fourth similarity between the extended vocabulary and the preset schedule category is similar to the third similarity calculation method described in the above embodiment, and will not be repeated here. It can be understood that the greater the fourth similarity, the greater the correlation between the extended vocabulary and the preset schedule category.
[0399] And, in the present embodiment, the number of times that extended vocabulary occurs in multiple extended vocabularies is called the fourth number of times. Exemplarily, suppose that currently there is extended text 1 and extended text 2, and suppose that extended vocabulary a and extended vocabulary b are obtained for extended text 1 screening, and suppose that extended vocabulary a and extended vocabulary c are obtained for extended text 1 screening. So can determine that the fourth number of times that extended vocabulary a occurs in multiple extended vocabularies is just 2 times, and extended vocabulary b and extended vocabulary c are respectively 1 time. That is to say, the fourth number of times in the present embodiment refers to the number of times that an extended vocabulary occurs in the common extended vocabulary processing result of multiple extended texts.
[0400] It can be understood that the more candidate times (i.e., the fourth times) of the extended vocabulary, the more 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 based on the similarity between the extended vocabulary and the preset schedule category to which it belongs, as well as 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 extended vocabulary is screened based on the third score of the extended vocabulary.
[0401] As an example, the calculation method of the third score may satisfy the following formula 14: Formula 14 In Formula 14, For the An extended vocabulary, For the Extended vocabulary The preset schedule category to which it belongs. For the The extended vocabulary and Extended vocabulary The fourth similarity of the preset schedule category. For the Extended vocabulary The fourth time.
[0402] Referring to Formula 14, it can be determined that, for example, the product of the fourth similarity of the extended vocabulary corresponding to the preset schedule category to which it belongs and the fourth number of times the extended vocabulary appears in the plurality of extended vocabulary can be determined as the third score of the extended vocabulary.
[0403] However, it is understandable that the implementation method of calculating the third score can be arbitrarily expanded according to actual needs, as long as the processing logic is based on the third score being proportional to the fourth similarity and the fourth number of times.
[0404] The following is a specific example to introduce the role of the third score. For example, there is currently an extended word "Flixtrain", which is a train operating brand under the Flix company. Its Chinese translation can refer to "Flix Train". In actual situations, this extended word has a high correlation with train-related words, that is, the semantics and frequency of this extended word are relatively high, and the corresponding third score of this extended word belonging to the train travel category will be higher, which means that the extended word "Flixtrain" can be used as a supplementary keyword for the train travel category.
[0405] For example, there is an extended word "SBB (Schweizerische Bundesbahnen, Swiss Federal Railways)". In practice, this extended word is not highly correlated with train-related words, but it appears very frequently in texts of this type, and the corresponding third score of this extended word belonging to the train travel category is also high, which means that the extended word "SBB" can also be used as a supplementary keyword for the train travel category.
[0406] In this way, by evaluating the extended vocabulary from both the semantics and the frequency of the extended vocabulary, the relevance of the extended vocabulary to the preset schedule category to which it belongs can be measured more comprehensively. Specifically, if an extended vocabulary is semantically close to multiple keywords contained in the preset schedule category to which it belongs, the third score corresponding to the extended vocabulary will be high, so that it will be used as a supplementary keyword for the preset schedule category to which the extended vocabulary belongs. At the same time, if an extended vocabulary is not close to multiple keywords in the preset schedule category to which it belongs in terms of meaning, but the third frequency of the extended vocabulary in the text of this type is high, the third score corresponding to the extended vocabulary will also be high, so that it will also be used as a supplementary keyword for the preset schedule category to which the extended vocabulary belongs.
[0407] In addition, the supplementary keywords can be further judged manually in combination with the scenario, and the extended words that are not very relevant to the preset schedule category can be eliminated, so that the words that are more relevant to the preset schedule category can be used as supplementary keywords. The supplementary keywords can be manually screened after each round of vocabulary expansion, or they can be manually screened only after the last round of vocabulary expansion. The specific implementation can be selected according to actual needs, and this embodiment does not limit this.
[0408] S1507: Determine a supplementary keyword from the multiple expanded words according to the third scores of the multiple expanded words.
[0409] It is understood that after obtaining the third scores of the plurality of extended words, the third scores of the plurality of extended words can be compared to determine the supplementary keywords from the plurality of extended words. In one implementation, for example, the extended words with larger third scores can be used as supplementary keywords, and the extended words with smaller third scores are not used as supplementary keywords.
[0410] Exemplarily, for example, a threshold may be set, and the supplementary keywords from the multiple extended words may be determined based on the threshold. For example, the threshold may be a preset value. According to the preset threshold, the extended words whose third scores are greater than or equal to the preset threshold may be used as supplementary keywords, and the extended words whose third scores are less than the preset threshold may be discarded and not used as supplementary keywords. In this embodiment, the preset threshold may be set to 0.5.
[0411] S1508, adding the supplementary keywords 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, where the third training set is the training set expanded before the last round of model training.
[0412] S1509: Train the first model of the target version according to the fourth keyword set and the fourth training set to obtain the first model of the final version.
[0413] It can be determined from the above introduction that the third keyword set is the keyword set expanded before the last round of model training. It can be understood that the fourth keyword set can be obtained by adding the above-obtained supplementary keywords to the third keyword set. And, the fourth training set can be obtained by adding multiple extended texts to the third training set.
[0414] At the same time, 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, and the first model is continuously optimized to obtain the final version of the first model. Figure 4 The process of this embodiment is the sixth operation in the figure, which performs secondary recall on the target text and supplementary keywords output by the first model to obtain a fourth training set and a fourth keyword set to train the first model of the target version and obtain the final version of the first model.
[0415] Through the above analysis, it can be understood that this application can screen out differentiated words as keywords according to the semantic similarity between words and texts, increase the diversity of keywords, and further expand the coverage of keywords included in the preset schedule category to obtain more comprehensive keywords.
[0416] In this embodiment, a corresponding first model can be trained for one language. It should be noted that after obtaining the first model for one language, when implementing keyword mining for another language, it is only necessary to re-collect the first training set, the first keyword set, and the corpus of the target language and input them into the first model according to the above process to implement keyword mining for multiple preset schedule categories in the target language.
[0417] 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 is possible to first check 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.
[0418] As an example, if the first model corresponding to German has been obtained and the first model corresponding to Italian needs to be trained, the first training set, the first keyword set and the corpus of Italian are first collected, and then these data are input into the first model according to the above process to guide the training of the first model.
[0419] When collecting the first keyword set in Italian, the seed words in German can be translated into Italian, and then the data in the first training set of Italian can be checked to see whether they contain seed words translated from German into Italian. If the data in the first training set of Italian contains seed words translated from German into Italian, these seed words can be directly used as seed words for Italian without repeatedly selecting these seed words from the first training set of Italian data.
[0420] Based on the above analysis, it can be determined that the first model is used to output the predicted probabilities of multiple preset schedule categories corresponding to the text, so as to determine the preset schedule category to which the text belongs. Then, the application process of the first model is described below in conjunction with a specific embodiment.
[0421] Combine the following Fig.16 The application of the first model is introduced in detail. Fig.16 A schematic diagram of a schedule recognition application of the first model provided in an embodiment of the present application. The application process of the first model may include the following steps: S1601: In response to a first operation for submitting schedule indication data, obtain a to-be-processed text corresponding to the schedule indication data.
[0422] S1602: According to the text to be processed, add schedule information corresponding to the text to be processed in the first application.
[0423] S1603, wherein the first application is used to process the text to be processed according to the first model to obtain a schedule type output by the first model, and the schedule type is used to add schedule information in the first application.
[0424] S1601, S1602 and S1603 are explained together below. In this embodiment, the schedule indication data can be data such as text messages, emails received by the user, and screenshots of the user on the software application interface. The text extracted or recognized from the schedule indication data is defined as the text to be processed. After obtaining the text to be processed, schedule information can be created based on the text to be processed. The application software that creates the schedule information is defined as the first application. The first application can process the text to be processed according to the first model to obtain the schedule type output by the first model. Among them, the schedule type is used to add schedule information in the first application.
[0425] Based on the above introduction, it can be determined that when a text passes through the first model, the first model can output the predicted probabilities of multiple preset schedule categories corresponding to the text. According to the predicted probabilities of multiple preset schedule categories corresponding to the text, it can be determined that the preset schedule category with the largest predicted probability is the preset schedule category to which the text belongs.
[0426] In this embodiment, the first model is the final version of the first model trained based on the above-mentioned embodiment, so the first model can output relatively accurate prediction probabilities of multiple preset schedule categories for the text to be processed, and further determine the preset schedule category to which the text to be processed belongs.
[0427] In one implementation, the user can, for example, perform an operation 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 processes the schedule indication data to obtain the text to be processed corresponding to the schedule indication data, and analyzes and processes the text to be processed in the first application, thereby obtaining the preset schedule category to which the text to be processed belongs, so as to create schedule information corresponding to the text to be processed in the first application.
[0428] The above process can refer to Fig.16 Understand. Fig.16As shown, in response to the operation of submitting the schedule indication data in the first application, the first application obtains the schedule indication data such as the text messages, emails received by the user and the screenshots of the user in the software application interface, and processes these schedule indication data through methods such as text extraction or OCR recognition, and then extracts the text to be processed corresponding to the schedule indication data. After obtaining the text to be processed, the text to be processed is subjected to preprocessing operations and vector conversion operations to obtain the vector corresponding to the text to be processed, and input into the first model 401 obtained by training in the above embodiment. The first model 401 can output the predicted probabilities of each of the multiple preset schedule types corresponding to the text to be processed. According to the predicted probabilities of each of these preset schedule types, the predicted schedule type to which the text belongs can be determined to create the schedule information corresponding to the text to be processed.
[0429] Through the training process introduced in the above embodiments, it can be understood that more comprehensive keywords can be expanded for the first model, and the first model will learn the relevant knowledge of these extended keywords during the training process, so that the first model can realize the corresponding schedule category recognition based on the extended keywords in the subsequent application process, and then the first model can more accurately identify the schedule category corresponding to the input text, which can effectively improve the accuracy and comprehensiveness of the first application in processing related operations of schedule recognition.
[0430] To sum up, the technical solution of the present application can select more accurate and comprehensive keywords in different languages, promote the first model to output accurate and reliable prediction probabilities corresponding to preset schedule categories, so as to create more accurate schedule information, thereby improving the overall performance of the first application.
[0431] 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 each module can be achieved, and there is no specific restriction on the names of the modules.
[0432] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0433] The model training method and schedule processing method of the embodiment of the present application have been described above, and the device for executing the above method provided by the embodiment 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 relevant device provided by the embodiment of the present application can execute the steps in the above model training method and schedule processing method.
[0434] The model training method and schedule processing method provided in the embodiments of the present application can be applied to electronic devices with schedule processing functions. The electronic devices include terminal devices, and the specific device form of the terminal devices can refer to the above-mentioned related descriptions, which will not be repeated here.
[0435] In one implementation, an embodiment of the present application provides an electronic device, Fig.17 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0436] like Fig.17 As shown, the electronic device 1700 includes: a processor 1701 and a memory 1702; the memory 1702 stores computer-executable instructions; the processor 1701 executes the computer-executable instructions stored in the memory 1702, so that the electronic device 1700 executes the above method.
[0437] When the memory 1702 is independently provided, the electronic device further includes a bus 1703 for connecting the memory 1702 and the processor 1701 .
[0438] The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.
[0439] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. The above method is implemented when the computer program is executed by the processor. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0440] In one possible implementation, a computer-readable medium may include RAM, ROM, 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 intended to carry or store the required program code in the form of instructions or data structures and can be accessed by a computer. Moreover, any connection is appropriately referred to as 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 technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disks and optical disks as used herein include optical disks, laser disks, optical disks, digital versatile disks (DVD), floppy disks and Blu-ray disks, where disks usually reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included in the scope of computer-readable media.
[0441] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.
[0442] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0443] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.
Claims
1. A model training method, characterized in that: include: Training an initial first model according to a first training set and a first keyword set to obtain a first version of a first model, wherein the first training set includes a plurality of training texts, each of the plurality of training texts is marked with a corresponding real schedule category, and the first model is used to output a predicted schedule category for the training text; Determine, according to the first model of the first version, the predicted schedule category of each of the plurality of reserve texts included in the corpus, the predicted schedule category corresponding to a predicted probability, the predicted probability being used to indicate the 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 respective predicted schedule categories of the plurality of reserve texts, the predicted probabilities corresponding to the respective predicted schedule categories, and the first keyword set; Selecting supplementary keywords from a plurality of words included in the plurality of target texts according to the plurality of target texts and the plurality of words; Adding the plurality of target texts to the first training set to obtain a second training set, and adding the supplementary keywords 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 the first model of the second version.
2. The method according to claim 1, characterized in that The step of determining the predicted schedule category of each of the plurality of reserve texts included in the corpus according to the first model of the first version includes: For any reserved text in the corpus, determining a text vector of the reserved text according to the first keyword set; Inputting the text vector of the reserve text into the first model of the first version to obtain the predicted probabilities corresponding to the plurality of preset schedule categories output by the first model, wherein the predicted probabilities are used to indicate the probability that the reserve text meets the preset schedule category; A preset schedule category with the greatest prediction probability is determined as the predicted schedule category corresponding to the reserve text.
3. The method according to claim 1 or 2, characterized in that: The selecting a plurality of target texts from the plurality of reserve texts according to the respective predicted schedule categories of the plurality of reserve texts, the predicted probabilities corresponding to the respective predicted schedule categories, and the first keyword set includes: Selecting, from the plurality of reserve texts, a plurality of intermediate texts whose prediction probabilities corresponding to the predicted schedule categories are greater than a first threshold; Determining first scores corresponding to the plurality of intermediate texts according to the respective predicted schedule categories of the plurality of intermediate texts, the predicted probabilities corresponding to the respective predicted schedule categories, and the first keyword set; The plurality of target texts are selected from the plurality of intermediate texts according to the first scores corresponding to the plurality of intermediate texts respectively.
4. The method according to claim 3, characterized in that The determining, according to the respective predicted schedule categories of the plurality of intermediate texts, the respective predicted probabilities corresponding to the respective predicted schedule categories, and the first keyword set, the first scores corresponding to the respective intermediate texts includes: For any of the intermediate texts, determining a keyword density corresponding to the intermediate text according to a first number of characteristic keywords contained in the intermediate text and a second number of words contained in the intermediate text, wherein the characteristic keywords are keywords in the first keyword set that belong to the predicted schedule category of the intermediate text, and the keyword density is proportional to the first number and inversely proportional to the second number; A first score of the intermediate text is 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, wherein the first score is proportional to both the keyword density and the predicted probability.
5. The method according to any one of claims 1 to 4, characterized in that: The method of selecting supplementary keywords from the plurality of words included in the plurality of target texts according to the plurality of target texts and the plurality of words includes: For any one of the plurality of vocabularies, calculating a first parameter of the vocabularies corresponding to each of the plurality of target texts, wherein the first parameter is used to indicate the importance of the vocabularies in the target texts; Calculate variances according to the first parameters of the vocabulary corresponding to the plurality of target texts, and obtain target variances corresponding to the vocabulary; Selecting some words from the plurality of words as candidate words according to the target variances corresponding to the plurality of words; According to the plurality of target texts and the plurality of candidate words, a supplementary keyword is selected from the plurality of candidate words.
6. The method according to claim 5, characterized in that The selecting, according to the plurality of target texts and the plurality of candidate words, supplementary keywords from the plurality of candidate words comprises: For any candidate word among the multiple candidate words, determining the first word frequency proportion of each of the candidate words corresponding to the multiple target texts of the first type according to the third number of times the candidate word appears in each of the multiple target texts of the first type and the total number of times the candidate word appears in the multiple 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 one of the multiple preset schedule categories; Determine, according to the first word frequency ratios of the candidate words corresponding to the first type of the plurality of target texts, a first information entropy of the candidate words corresponding to the first schedule category, wherein the first information entropy is inversely proportional to the overall difference between the plurality of first word frequency ratios; Determine the first category ratio corresponding to the first schedule category according to the number of target texts whose schedule category is predicted to be the first schedule category and the total number of multiple target texts; determine the second category ratio corresponding to the first schedule category of the candidate vocabulary according to the number of target texts containing the candidate vocabulary and whose schedule category is predicted to be the first schedule category and the total number of target texts containing the candidate vocabulary; Determine a first information gain corresponding to the candidate vocabulary according to the first category proportions corresponding to each of the plurality of preset schedule categories and the second category proportions corresponding to each of the plurality of preset schedule categories by the candidate vocabulary, wherein the first information gain is proportional to the degree of difference between 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 of the candidate vocabulary corresponding to the preset schedule category to which the candidate vocabulary belongs, wherein 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 to which the first information entropy is the largest; The supplementary keyword is selected from the plurality of candidate words according to the second scores corresponding to the plurality of candidate words.
7. The method according to claim 5 or 6, characterized in that: The method further comprises: Selecting candidate words whose part of speech is verb from the candidate words to obtain a plurality of verb words; According to the plurality of target texts and the plurality of verb vocabularies, supplementary keywords are selected from the plurality of verb vocabularies.
8. The method according to any one of claims 1 to 7, characterized in that: After obtaining the second version of the first model, the method further includes: Repeat the operations of expanding the training set and expanding the keyword set, and repeatedly train the first model according to the expanded training set and the expanded keyword set until the iteration end condition is met to obtain the target version of the first model.
9. The method according to claim 8, characterized in that The method further comprises: Determining, according to the first model of the target version, the predicted schedule category of each of the plurality of reserve texts included in the corpus; Selecting multiple extended texts from the multiple reserve texts according to the respective predicted schedule categories of the multiple reserve texts, the predicted probabilities corresponding to the respective predicted schedule categories, and a third keyword set, wherein the third keyword set is a keyword set expanded before the last round of model training; For any of the extended texts, determining a plurality of extended words from the plurality of words included in the extended text according to a first similarity between each of the plurality of words included in the extended text and the extended text; The first model of the target version is trained according to the multiple extended words, the multiple extended texts and the third keyword set to obtain the first model of the final version.
10. The method according to claim 9, characterized in that The step of training the first model of the target version according to the multiple extended words, the multiple extended texts and the third keyword set to obtain the first model of the final version includes: For any one of the plurality of extended words, determining a third similarity of the extended word to the second schedule category according to second similarities respectively corresponding to the plurality of keywords included in the third keyword set and belonging to the second schedule category, wherein the second schedule category is any one of the plurality of preset schedule categories; According to the third similarities between the extended vocabulary and the plurality of preset schedule categories, determining the preset schedule category with the largest third similarity and / or a third similarity greater than a second threshold as the preset schedule category to which the extended vocabulary belongs; Determining a third score of the extended vocabulary according to a fourth similarity between the extended vocabulary and the preset schedule category to which the extended vocabulary belongs and a fourth number of times the extended vocabulary appears in the plurality of extended vocabulary, wherein the third score is proportional to both the fourth similarity and the fourth number of times; determining a supplementary keyword from the plurality of expanded vocabularies according to respective third scores of the plurality of expanded vocabularies; Adding the supplementary keywords 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, wherein the third training set is a training set expanded before the last round of model training; The first model of the target version is trained according to the fourth keyword set and the fourth training set to obtain the first model of the final version.
11. A schedule processing method, characterized in that: include: 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 text to be processed, adding schedule information corresponding to the text to be processed in the first application; The first application is used to process the text to be processed according to a first model to obtain a schedule type output by the first model, and the schedule type is used to add the schedule information to the first application. The first model is trained according to the method described in any one of claims 1-10.
12. The method according to claim 11, characterized in that The first model is a final version of the first model.
13. An electronic device, characterized in that: The electronic device comprises: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions so that the electronic device executes the method as described in any one of claims 1 to 12.
14. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method as described in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 12.
16. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 12.
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