Text processing method and device, electronic equipment, storage medium and program product
By obtaining multi-semantic text and label feature vectors, and using interactive correlation and mutual information, the target label of multi-semantic text is determined, the problem of low accuracy of multi-semantic text labels is solved and higher recognition accuracy is achieved.
Patent Information
- Application Number
- CN202510418980.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-08-22
AI Technical Summary
In the prior art, determining multisemantic text tags is low in accuracy, which affects the user experience.
By obtaining the multi-semantic text feature vector and multiple label feature vectors, the semantic feature vector adjusted by the interactive correlation set is used to determine the target label of the multi-semantic text.
It improves the recognition accuracy of multi-semantic text target tags, and can more comprehensively consider the relationship between text and tags, improving user experience.
Smart Images

Figure CN120523949A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of text processing technology, and in particular to a text processing method, device, electronic device, storage medium, and program product. Background Art
[0002] With the continuous advancement of text processing technology, people's demand for text processing is increasing day by day, and the requirements are also increasing accordingly. Currently, the text input by users often contains rich semantic levels, such as multiple operational instructions or complex demand scenarios. Taking intelligent dialogue systems as an example, users' expressions are often not single intents, but may contain multiple intents. For example, users may request to "open the car window" and "navigate to the destination" at the same time. For this type of text containing multiple semantic information, all relevant intent labels need to be accurately identified. However, current methods for determining multi-semantic text labels are relatively inaccurate, which to some extent affects the user experience. Summary of the Invention
[0003] To overcome the problems existing in the related art, the present disclosure provides a text processing method, device, electronic device, storage medium and program product.
[0004] According to a first aspect of an embodiment of the present disclosure, a text processing method is provided, the method comprising:
[0005] Obtaining a polysemantic text feature vector to be identified and a plurality of preset tag feature vectors; wherein the polysemantic text feature vector corresponds to a polysemantic text, the plurality of tag feature vectors correspond to a plurality of tags, one tag feature vector in the plurality of tag feature vectors corresponds to one tag, the one tag feature vector representing a semantic feature vector of the corresponding tag adjusted using an interaction correlation degree set, the interaction correlation degree set including a correlation degree between the tag corresponding to the one tag feature vector and each of the plurality of tags;
[0006] At least two target tags for the multi-semantic text are determined from the multiple tags based on the multi-semantic text feature vector and the multiple tag feature vectors.
[0007] In some embodiments, the method further comprises:
[0008] Acquire a sample data set; wherein the sample data set includes a plurality of sample texts and at least two labels for each sample text;
[0009] Determining the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels;
[0010] Based on the mutual information between any two tags, the association degree between the any two tags is determined.
[0011] In some embodiments, determining the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels includes:
[0012] extracting at least two sample texts from the sample data set multiple times; wherein the number of the at least two sample texts extracted each time is less than the total number of sample texts in the sample data set;
[0013] For each of the at least two labels of the at least two sample texts extracted, determining a first number of sample texts respectively associated with each arbitrary two labels in the at least two labels, and a second number of the same sample texts associated with the arbitrary two labels, and determining mutual information between the arbitrary two labels based on the two first numbers and the second number;
[0014] In response to the arbitrary two tags appearing in different extractions, a mutual information statistic between the arbitrary two tags is determined based on the mutual information respectively determined in the different extractions, and the mutual information statistic is used as the mutual information between the arbitrary two tags.
[0015] In some embodiments, the one tag feature vector is a semantic feature vector obtained by weighting and fusing the semantic features of each tag in the multiple tags based on the association between its corresponding tag and each tag in the multiple tags.
[0016] In some embodiments, the method further includes: determining at least two target tags for the polysemantic text from the multiple tags based on the polysemantic text feature vector and the multiple tag feature vectors, including:
[0017] Determining a degree of matching between the polysemantic text and each label based on the polysemantic text feature vector and each label feature vector in the plurality of label feature vectors;
[0018] Based on the matching degree between the polysemantic text and each tag, at least two target tags whose matching degree with the polysemantic text satisfies a preset matching degree condition are determined from the multiple tags.
[0019] In some embodiments, the polysemantic text feature vector includes a feature vector for each character in the polysemantic text;
[0020] The determining, based on the multi-semantic text feature vector and each tag feature vector in the plurality of tag feature vectors, a matching degree between the multi-semantic text and each tag includes:
[0021] For each label, determining a correlation between the feature vector of each character and the label feature vector based on the feature vector of each character in the polysemantic text and the label feature vector corresponding to the label, and determining a feature vector of the polysemantic text associated label based on the correlation and the feature vector of each character; wherein the feature vector of the polysemantic text associated label is used to represent the degree of match between the polysemantic text and the label;
[0022] The determining, based on the degree of match between the polysemantic text and each tag, at least two target tags from the multiple tags whose degree of match with the polysemantic text satisfies a preset degree of match condition, includes:
[0023] For each tag, it is determined whether the tag is the target tag based on the feature vector of the multi-semantic text associated tag.
[0024] In some embodiments, determining the feature vector of the multi-semantic text association label based on the association degree and the feature vector of each character includes:
[0025] For each character, the character's feature vector is weighted based on the correlation between the character's feature vector and the label's feature vector;
[0026] The feature vectors obtained by weighting the feature vectors of each character are fused to obtain the feature vector of the multi-semantic text association label.
[0027] In some embodiments, determining whether a tag is the target tag based on the feature vector of the multi-semantic text associated tag includes:
[0028] Processing the feature vector of the multi-semantic text associated label using a preset confidence function to obtain the confidence of the multi-semantic text corresponding label;
[0029] The confidence is compared with a preset confidence threshold to determine whether the tag is the target tag.
[0030] According to a second aspect of an embodiment of the present disclosure, a text processing device is provided, the device comprising:
[0031] A first acquisition module is configured to acquire a multi-semantic text feature vector to be identified and a plurality of preset tag feature vectors; wherein the multi-semantic text feature vector corresponds to a multi-semantic text, the plurality of tag feature vectors correspond to a plurality of tags, one tag feature vector in the plurality of tag feature vectors corresponds to one tag, the one tag feature vector represents a semantic feature vector of the corresponding tag adjusted using an interaction correlation degree set, the interaction correlation degree set including a correlation degree between the tag corresponding to the one tag feature vector and each of the plurality of tags;
[0032] The first determining module is configured to determine at least two target tags of the multi-semantic text from the multiple tags based on the multi-semantic text feature vector and the multiple tag feature vectors.
[0033] In some embodiments, the text processing apparatus further comprises:
[0034] A second acquisition module is configured to acquire a sample data set; wherein the sample data set includes a plurality of sample texts and at least two labels for each sample text;
[0035] a second determining module configured to determine the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels;
[0036] The third determining module is configured to determine the degree of association between any two tags based on the mutual information between the two tags.
[0037] In some embodiments, the second determination module is further configured to extract at least two sample texts from the sample data set multiple times; wherein the number of the at least two sample texts extracted each time is less than the total number of sample texts in the sample data set; for the at least two labels of the at least two sample texts extracted each time, determine a first number of sample texts respectively associated with each arbitrary two labels in the at least two labels, and a second number of the same sample texts associated with the arbitrary two labels, and determine the mutual information between the arbitrary two labels based on the two first numbers and one second number; in response to the arbitrary two labels appearing in different extractions, determine a mutual information statistic between the arbitrary two labels based on the mutual information respectively determined in different extractions, and use the mutual information statistic as the mutual information between the arbitrary two labels.
[0038] In some embodiments, the one tag feature vector is a semantic feature vector obtained by weighting and fusing the semantic features of each tag in the multiple tags based on the association between its corresponding tag and each tag in the multiple tags.
[0039] In some embodiments, the first determination module is further configured to determine the degree of matching between the polysemantic text and each label based on the polysemantic text feature vector and each label feature vector in the multiple label feature vectors; and based on the degree of matching between the polysemantic text and each label, determine at least two target labels from the multiple labels whose degree of matching with the polysemantic text meets a preset matching condition.
[0040] In some embodiments, the multi-semantic text feature vector includes a feature vector of each character in the multi-semantic text; the first determination module is further configured to determine, for each label, the correlation between the feature vector of each character and the label feature vector based on the feature vector of each character in the multi-semantic text and the label feature vector corresponding to the label, and determine the feature vector of the multi-semantic text associated label based on the correlation and the feature vector of each character; wherein the feature vector of the multi-semantic text associated label is used to characterize the matching degree between the multi-semantic text and the label; for each label, determine whether the label is the target label based on the feature vector of the multi-semantic text associated label.
[0041] In some embodiments, the first determination module is further configured to weight the feature vector of each character based on the correlation between the feature vector of the character and the feature vector of the label; and fuse the weighted feature vectors of each character to obtain the feature vector of the multi-semantic text association label.
[0042] In some embodiments, the first determination module is further configured to process the feature vector of the multi-semantic text associated label using a preset confidence function to obtain the confidence of the label corresponding to the multi-semantic text; and compare the confidence with a preset confidence threshold to determine whether the label is the target label.
[0043] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0044] processor;
[0045] memory for storing computer programs or instructions;
[0046] The processor executes the computer program or instructions to implement the steps of the text processing method described in the first aspect above.
[0047] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, which stores a computer program or instructions. When the computer program or instructions in the storage medium are executed by a processor, the steps of the text processing method described in the first aspect above are implemented.
[0048] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program or instructions, which, when executed by a processor, implements the steps of the text processing method described in the first aspect above.
[0049] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:
[0050] In an embodiment of the present disclosure, an electronic device obtains a feature vector of a multi-semantic text to be identified and a plurality of preset tag feature vectors, and determines at least two target tags for the multi-semantic text from the plurality of tags based on the multi-semantic text feature vector and the plurality of tag feature vectors. Compared to the related art method of determining the target tag of a multi-semantic text based solely on the correlation between the feature vector of the multi-semantic text and the feature vector that can only represent the semantics of each tag, because the tag feature vector in the embodiment of the present disclosure can represent both the semantics of its corresponding tag and the degree of association between its corresponding tag and each of the plurality of tags, when determining the target tag of the multi-semantic text, the electronic device not only considers the semantic correlation between the text and each tag, but also considers the mutual association relationship between the tags. For example, even if the semantics of some tags do not completely match the text, they may still be correctly identified as target tags due to their association relationship with other tags. The method of the embodiment of the present disclosure can more comprehensively consider the relationship between text and tags, and between tags, thereby improving the accuracy of the determined target tag of the multi-semantic text.
[0051] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0053] Figure 1 is a flowchart of a text processing method provided by an embodiment of the present disclosure;
[0054] Figure 2 is a schematic diagram of a process for determining the degree of association between tags provided by an embodiment of the present disclosure;
[0055] Figure 3 It is an architectural diagram of the text processing model provided by the embodiment of the present disclosure.
[0056] Figure 4 This is a block diagram of a text processing device provided by an embodiment of the present disclosure.
[0057] Figure 5 This is a structural block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0058] Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices consistent with certain aspects of the present disclosure, as detailed in the appended claims.
[0059] Multi-intent recognition is a natural language processing technology used to analyze user input and identify multiple potential intents. In natural language processing, user input (multi-semantic text) often expresses more than just a single intent. For example, a user might inquire about the weather and flight information simultaneously in a single conversation. Multi-intent recognition technology parses this complex input and identifies multiple intents. In multi-intent recognition tasks, labels typically refer to predefined intent categories. These categories represent the user's intended tasks, information requirements, or emotions expressed, and the corresponding labels often vary across different scenarios. For example, in a vehicle-to-machine interaction scenario, predefined intent categories might include "open window," "open sunroof," and "start navigation." When user input is identified as matching one or more predefined intent categories, the system can provide appropriate services or responses based on these intent labels.
[0060] Figure 1 is a flowchart of a text processing method provided by an embodiment of the present disclosure, such as Figure 1 As shown, the method includes:
[0061] S11. Obtain a multi-semantic text feature vector to be identified and a plurality of preset label feature vectors; wherein the multi-semantic text feature vector corresponds to a multi-semantic text, the plurality of label feature vectors correspond to a plurality of labels, one label feature vector in the plurality of label feature vectors corresponds to one label, the one label feature vector represents a semantic feature vector of the corresponding label adjusted using an interaction correlation degree set, the interaction correlation degree set including a correlation degree between the label corresponding to the one label feature vector and each of the plurality of labels;
[0062] S12: Determine at least two target tags for the multi-semantic text from the multiple tags based on the multi-semantic text feature vector and the multiple tag feature vectors.
[0063] The text processing method provided in the embodiments of the present disclosure may be executed by a terminal device such as a user equipment (UE), a mobile device, a user terminal, a mobile phone, a tablet computer, a personal digital assistant (PDA), a handheld device, a computing device, an in-vehicle device, or a wearable device; or by a cloud device such as a cloud server. The embodiments of the present disclosure do not limit the execution subject; for ease of description, the embodiments of the present disclosure are described using an electronic device as the execution subject.
[0064] In step S11, the electronic device obtains a multi-semantic text feature vector to be identified, wherein the multi-semantic text feature vector corresponds to one multi-semantic text. It should be noted that one multi-semantic text contains multiple intentions of the user. The electronic device can obtain the multi-semantic text feature vector based on the multi-semantic text to be identified. For example, the electronic device can first obtain the multi-semantic text to be identified and then generate the multi-semantic text feature vector. The electronic device can receive the user's voice and convert the user's voice into the multi-semantic text to be identified; the electronic device can also directly receive the multi-semantic text input by the user. The embodiment of the present disclosure does not limit the way in which the electronic device obtains the multi-semantic text.
[0065] In some embodiments, the text processing method can be applied to vehicle-computer interaction scenarios. For example, the electronic device can be a vehicle-computer system. The vehicle-computer system can receive voice information from users in the vehicle and convert the voice information into multi-semantic text to be recognized. It can also receive multi-semantic text entered by the user on the display interface of the vehicle-computer system. The multi-semantic text in the vehicle-computer system can be the user's operating instructions for various functional services in the vehicle, such as "open the windows and sunroof, and navigate silently to place A."
[0066] In other embodiments, the text processing method can also be applied to smart home scenarios. For example, the electronic device can be a smart home central controller that can receive user voice commands and convert them into multi-semantic text to be recognized. The controller can also receive multi-semantic text input by users through smartphone applications or smart home panels. The multi-semantic text in the smart home control system can be various user instructions for smart devices in the home, such as "Turn on the living room lights to soft mode, adjust the air conditioner to 25 degrees, and start playing light music."
[0067] In other embodiments, the text processing method can also be applied to scenarios such as smart office scenarios, smart customer service scenarios, and smart medical scenarios, which are not limited by the embodiments of the present disclosure.
[0068] In an embodiment of the present disclosure, after the electronic device obtains the multi-semantic text to be identified, it can generate a multi-semantic text feature vector. In some embodiments, the electronic device can use an embedding model to generate the multi-semantic text feature vector; the multi-semantic text feature vector can represent the semantic features of the multi-semantic text. In other embodiments, the electronic device can also extract the semantic features corresponding to the multi-semantic text based on the bag-of-words model, such as determining the number of times each phrase appears in the multi-semantic text, and based on the number of times each phrase appears in the multi-semantic text, analyzing the theme or keywords of the multi-semantic text, thereby determining the semantic features of the multi-semantic text, and then generating a multi-semantic text feature vector. In other embodiments, after the electronic device obtains the multi-semantic text, it can also first segment the multi-semantic text, such as into multiple characters or multiple phrases, extract the feature vector of each character or each phrase, and fuse them into a multi-semantic text feature vector.
[0069] In an embodiment of the present disclosure, the electronic device further obtains a plurality of preset label feature vectors; wherein the plurality of label feature vectors correspond to a plurality of labels, one label feature vector in the plurality of label feature vectors corresponds to one label, and one label feature vector represents a semantic feature vector of its corresponding label adjusted using an interactive correlation degree set, and the interactive correlation degree set includes a correlation degree between a label corresponding to a label feature vector and each of the plurality of labels.
[0070] In an embodiment of the present disclosure, the electronic device may first obtain a plurality of preset tags, determine the semantic features of each tag, such as by using an embedded model, word embedding technology, or other methods to determine the semantic features of each tag, and determine the correlation between any two tags among the plurality of tags. It should be noted that the correlation between any two tags indicates the possibility that any two tags appear in the same multi-semantic text.
[0071] In some embodiments, the electronic device may determine the frequency with which any two tags appear in the same sample text in a preset sample text set, and determine the degree of association between any two tags based on the frequency with which any two tags appear in the same sample text, wherein the frequency with which any two tags appear in the same sample text may be the ratio between the number of identical sample texts associated with any two tags in the preset sample text set and the total number of sample texts included in the preset sample text set. The frequency with which any two tags appear in the same sample text is positively correlated with the degree of association between any two tags. For example, the frequency with which any two tags appear in the same sample text may be directly used as the degree of association between any two tags. For example, there are 100 sample texts in the preset sample text set. Among the 100 sample texts, the number of identical sample texts associated with tag A and tag B is 20, and the degree of association between tag A and tag B may be 0.2. The frequency between any two tags may also be normalized first, and the normalized frequency may be used as the degree of association between any two tags.
[0072] In other embodiments, the electronic device may also determine the mutual information value of any two tags in a preset sample text set, and determine the correlation between any two tags based on the mutual information value of any two tags; in other embodiments, the electronic device may also obtain a preset knowledge graph, and determine the correlation between any two tags based on the correlation between the paths or subgraphs of any two tags on the preset knowledge graph; in other embodiments, the electronic device may also directly use a preset model to calculate the correlation between any two tags.
[0073] In the embodiment of the present disclosure, after the electronic device determines the association degree between any two tags among a plurality of tags and the semantic feature of each tag, it may further determine a tag feature vector for each tag.
[0074] For example, in some embodiments, the one tag feature vector is a semantic feature vector obtained by weighting and fusing the semantic features of each tag in the multiple tags based on the association between its corresponding tag and each tag in the multiple tags.
[0075] In an embodiment of the present disclosure, the electronic device can determine, for each tag in a plurality of tags, the degree of association between the tag and each tag in the plurality of tags, and weight the semantic features of each tag based on the degree of association corresponding to each tag in the plurality of tags, and fuse the weighted semantic features of each tag to obtain a tag feature vector of the tag.
[0076] In an embodiment of the present disclosure, the electronic device may normalize the degree of association between the tag and each of the multiple tags before determining the degree of association between the tag and each of the multiple tags and weighting the semantic features of each tag based on the degree of association corresponding to each of the multiple tags, and then weight the semantic features of each tag based on the normalized degree of association corresponding to each tag.
[0077] The method for determining the feature vector of each tag in the embodiment of the present disclosure is relatively simple and effective, and by weighting the correlation between tags, the importance of the correlation can be increased, so that tags with higher correlation have higher weights, while tags with lower correlation have lower weights.
[0078] In other embodiments, the electronic device may generate a semantic feature vector for each tag, and mark the degree of association between the tag and each tag in the multiple tags on the semantic feature vector to obtain a tag feature vector.
[0079] In the embodiment of the present disclosure, the electronic device can also directly receive the multi-semantic text feature vector after multi-semantic text is processed by other electronic devices or models, as well as the individual label feature vectors after multiple labels are processed by other electronic devices or models, and the processing method is as described above.
[0080] In step S12, the electronic device determines at least two target tags for the polysemantic text from the multiple tags based on the polysemantic text feature vector and the multiple tag feature vectors. In some embodiments, the electronic device may utilize a preset text processing model to determine the at least two target tags for the polysemantic text from the multiple tags based on the polysemantic text feature vector and the multiple tag feature vectors. The preset text processing model may be a model obtained by training a preset neural network model based on a sample dataset, where each sample in the sample dataset is polysemantic text and each sample is associated with at least two tags.
[0081] In other embodiments, the electronic device may also determine at least two target tags of the multi-semantic text from multiple tags based on the multi-semantic text feature vector and multiple tag feature vectors using a preset algorithm, wherein the preset algorithm may include a keyword matching method, a similarity calculation method, a K-nearest neighbor algorithm, etc.
[0082] In the embodiment of the present disclosure, it should be noted that the label feature vector of the target label matches the feature vector of the multi-semantic text. The multi-semantic text contains multiple different intentions, and each target label is an intention in the multi-semantic text. For example, when the multi-semantic text is "open the car window and turn on the navigation", the target labels of the multi-semantic text are "open the car window" and "turn on the navigation".
[0083] In an embodiment of the present disclosure, an electronic device obtains a feature vector of a multi-semantic text to be identified and a plurality of preset tag feature vectors, and determines at least two target tags for the multi-semantic text from the plurality of tags based on the multi-semantic text feature vector and the plurality of tag feature vectors. Compared to the related art method of determining the target tag of a multi-semantic text based solely on the correlation between the feature vector of the multi-semantic text and the feature vector that can only represent the semantics of each tag, because the tag feature vector in the embodiment of the present disclosure can represent both the semantics of its corresponding tag and the degree of association between its corresponding tag and each of the plurality of tags, when determining the target tag of the multi-semantic text, the electronic device not only considers the semantic correlation between the text and each tag, but also considers the mutual association relationship between the tags. For example, even if the semantics of some tags do not completely match the text, they may still be correctly identified as target tags due to their association relationship with other tags. The method of the embodiment of the present disclosure can more comprehensively consider the relationship between text and tags, and between tags, thereby improving the accuracy of the determined target tag of the multi-semantic text.
[0084] Figure 2 is a flow chart of determining the correlation between tags provided by the embodiment of the present disclosure, such as Figure 2 As shown, the following steps are included:
[0085] S21. Obtain a sample data set; wherein the sample data set includes a plurality of sample texts and at least two labels for each sample text;
[0086] S22: determining the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels;
[0087] S23: Determine the degree of association between any two tags based on the mutual information between the two tags.
[0088] In step S21, the electronic device obtains a sample data set, wherein the sample data set includes a plurality of sample texts and at least two labels for each sample text. It should be noted that each sample text is a polysemantic text. In some embodiments, the electronic device may obtain historical polysemantic text data and use the historical polysemantic text data as sample text, and associate at least two labels with each historical polysemantic text data, wherein the at least two labels associated with the historical polysemantic text data may be manually determined or determined by a preset model or algorithm, and the embodiments of the present disclosure do not impose any limitation on this.
[0089] In other embodiments, the electronic device may also obtain sample text input by the user and at least two labels of the sample text input by the user; in other embodiments, the electronic device may also obtain a sample data set based on a generative model such as Generative Adversarial Networks (GANs), such as GANs can generate multi-semantic sample text and at least two labels for each sample text.
[0090] In the embodiment of the present disclosure, after the electronic device obtains the sample data set, it can clean the sample data set, such as removing noise data and outliers, processing missing data, etc., and can also convert each sample text in the sample data set into the same format.
[0091] In step S22, the electronic device determines the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with any two labels. Mutual information is used to measure the amount of shared information between two random variables.
[0092] In an embodiment of the present disclosure, the electronic device determines a first number of sample texts associated with each arbitrary two labels in a sample data set and a second number of sample texts associated with the same arbitrary two labels, and determines the mutual information between the arbitrary two labels based on the first number and the second number corresponding to the arbitrary two labels. For example, the mutual information between the arbitrary two labels can be determined based on the ratio between the second number and the first number, and the mutual information between the arbitrary two labels can also be determined based on the difference between the first number and the second number.
[0093] In step S23, the electronic device determines the degree of association between any two tags based on the mutual information between any two tags. The mutual information between any two tags is positively correlated with the degree of association between any two tags. In some embodiments, the mutual information value between any two tags can be directly used as the degree of association between any two tags. In other embodiments, the mutual information value between any two tags can be normalized first, and the normalized mutual information value can be used as the degree of association between any two tags. In other embodiments, a mapping relationship between the mutual information value and the degree of association can be set, and the degree of association between any two tags can be determined based on the mutual information value between any two tags and the mapping relationship.
[0094] In an embodiment of the present disclosure, an electronic device determines the mutual information between any two tags based on a first number of sample texts associated with each arbitrary two tags in a sample data set and a second number of sample texts associated with the arbitrary two tags, and determines the degree of association between the tags based on the mutual information. The solution is simple and effective, and compared with a method of directly determining the degree of association between tags based on semantic features of the tags, it can identify tags that are not semantically similar but always appear in the same sample text at the same time, and is more intelligent.
[0095] In some embodiments, determining the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels includes:
[0096] extracting at least two sample texts from the sample data set multiple times; wherein the number of the at least two sample texts extracted each time is less than the total number of sample texts in the sample data set;
[0097] For each of the at least two labels of the at least two sample texts extracted, determining a first number of sample texts respectively associated with each arbitrary two labels in the at least two labels, and a second number of the same sample texts associated with the arbitrary two labels, and determining mutual information between the arbitrary two labels based on the two first numbers and the second number;
[0098] In response to the arbitrary two tags appearing in different extractions, a mutual information statistic between the arbitrary two tags is determined based on the mutual information respectively determined in the different extractions, and the mutual information statistic is used as the mutual information between the arbitrary two tags.
[0099] In the disclosed embodiment, the electronic device extracts at least two sample texts from the sample data set multiple times; wherein the number of the at least two sample texts extracted each time is less than the total number of sample texts in the sample data set. It should be noted that the number of sample texts extracted each time can be the same or different. For example, the electronic device may extract three times in total, with the number of sample texts extracted the first time being 100, the number of sample texts extracted the second time being 200, and the number of sample texts extracted the third time being 200. This is not a limitation of the disclosed embodiment.
[0100] In an embodiment of the present disclosure, the electronic device determines, for at least two labels of at least two sample texts extracted each time, a first number of sample texts associated with each of the at least two labels, and a second number of the same sample texts associated with each of the two labels, and determines the mutual information between the two labels based on the two first numbers and the second number. For example, 100 sample texts are extracted at a time, and at least two labels of the 100 sample texts include label A and label B. The electronic device determines, for label A and label B, a first number of sample texts associated with each of the label A and label B. For example, if the number of sample texts associated with label A in the 100 sample texts is 20 and the number of sample texts associated with label B in the 100 sample texts is 30, then the first number of label A and label B corresponding to each of the label B is 20 and 30 respectively. The electronic device also determines a second number of sample texts associated with the same label A and label B. For example, if the number of sample texts associated with label A and label B in the 100 sample texts is 10, then the second number of label A and label B corresponding to each of the label B is 10.
[0101] In the embodiment of the present disclosure, the electronic device determines the mutual information between any two tags based on two first quantities and one second quantity. For example, the product between the two first quantities may be first determined, and the mutual information between the any two tags may be determined based on the ratio between the second quantity and the product. The specific calculation method may be as shown in formula (1):
[0102]
[0103] Among them, f i,j is the mutual information between label i and label j, |C i,j | is the number of identical sample texts extracted from at least two sample texts extracted between label i and label j, |C i | is the number of sample texts associated with label i in at least two sample texts extracted this time, |C j | is the number of sample texts associated with label j in at least two sample texts extracted this time, |C i | and |C j | are the two first quantities corresponding to labels i and j, |C i,j | is the second quantity corresponding to labels i and j.
[0104] In an embodiment of the present disclosure, in response to any two tags appearing in different extractions, the electronic device determines a mutual information statistic between the any two tags based on the mutual information determined in the different extractions, and uses the mutual information statistic as the mutual information between the any two tags. For example, the average value of the mutual information determined in the different extractions for any two tags can be used as the mutual information statistic between the any two tags, or the maximum value, minimum value, or median value of the mutual information determined in the different extractions for any two tags can be used as the mutual information statistic between the any two tags.
[0105] In the embodiment of the present disclosure, the method for calculating the mutual information statistic between any two tags can be shown as formula (2):
[0106] a i,j =normal(∑f i,j ) (2)
[0107] Among them, a i,j is the mutual information statistic between label i and label j, f i,j It is the mutual information corresponding to the extraction of the aforementioned label i and label j. Normal represents the average value of the mutual information in the extraction where label i and label j appear.
[0108] In the embodiment of the present disclosure, the mutual information between any two labels among a plurality of labels can be determined by the above method, thereby determining the degree of association between any two labels among a plurality of labels. It should be noted that if two labels are not extracted at the same time in multiple extractions, such as label C and label D do not appear at the same time in each extraction in multiple extraction processes, then the mutual information between label C and label D can be recorded as a preset value, such as 0.
[0109] In the embodiments of the present disclosure, on the one hand, since there may be a large number of repeated or highly similar sample texts in the sample data set, determining the mutual information between labels based on the sampled sample texts can reduce the redundancy caused by the same or similar sample texts and also reduce the computational cost; on the other hand, performing multiple samplings can also reduce the deviation caused by a single sampling, thereby improving the accuracy of the mutual information between labels.
[0110] In some embodiments, determining at least two target tags for the polysemantic text from the multiple tags based on the polysemantic text feature vector and the multiple tag feature vectors includes:
[0111] Determining a degree of matching between the polysemantic text and each label based on the polysemantic text feature vector and each label feature vector in the plurality of label feature vectors;
[0112] Based on the matching degree between the polysemantic text and each tag, at least two target tags whose matching degree with the polysemantic text satisfies a preset matching degree condition are determined from the multiple tags.
[0113] In an embodiment of the present disclosure, the electronic device determines the degree of matching between the multi-semantic text and each label based on the multi-semantic text feature vector and each label feature vector in a plurality of label feature vectors. For example, the electronic device can determine the degree of matching between the multi-semantic text and each label based on the similarity between the multi-semantic text feature vector and each label feature vector in a plurality of label feature vectors.
[0114] In an embodiment of the present disclosure, the electronic device determines, from multiple tags, at least two target tags whose matching degrees with the multi-semantic text satisfy preset matching conditions based on the matching degree between the multi-semantic text and each tag. For example, a matching threshold can be set to determine tags whose matching degrees with the multi-semantic text are greater than the matching threshold as target tags for the multi-semantic text. K tags with the highest matching degrees can also be selected as target tags, where K is greater than or equal to 2, and the K value can be adjusted according to specific circumstances.
[0115] In an embodiment of the present disclosure, an electronic device determines the degree of match between a polysemantic text and each tag, and based on the degree of match between the polysemantic text and each tag, determines, from a plurality of tags, at least two target tags whose degree of match with the polysemantic text satisfies a preset matching condition. The method is simple, effective, and highly intelligent.
[0116] In some embodiments, the polysemantic text feature vector includes a feature vector for each character in the polysemantic text;
[0117] The determining, based on the multi-semantic text feature vector and each tag feature vector in the plurality of tag feature vectors, a matching degree between the multi-semantic text and each tag includes:
[0118] For each label, determining a correlation between the feature vector of each character and the label feature vector based on the feature vector of each character in the polysemantic text and the label feature vector corresponding to the label, and determining a feature vector of the polysemantic text associated label based on the correlation and the feature vector of each character; wherein the feature vector of the polysemantic text associated label is used to represent the degree of match between the polysemantic text and the label;
[0119] The determining, based on the degree of match between the polysemantic text and each tag, at least two target tags from the multiple tags whose degree of match with the polysemantic text satisfies a preset degree of match condition, includes:
[0120] For each tag, it is determined whether the tag is the target tag based on the feature vector of the multi-semantic text associated tag.
[0121] In an embodiment of the present disclosure, a multi-semantic text feature vector includes a feature vector of each character in the multi-semantic text, wherein, as described above, the electronic device can obtain the multi-semantic text and process the multi-semantic text to obtain a multi-semantic text feature vector. After obtaining the multi-semantic text, the electronic device can first segment the multi-semantic text to obtain multiple characters. For example, when the multi-semantic text is in Chinese, each word can be segmented as a character. When the multi-semantic text is in English, each English word can be segmented as a character. After segmenting the multi-semantic text, an embedded model, a bag-of-words model, or a bidirectional transformer encoding (Bidirectional Encoder Representations from Transformers, BERT) model can be used to generate a feature vector for each character. The feature vector of each character constitutes a multi-semantic text feature vector. For example, a polysemantic text may be a query. The polysemantic text is first segmented to obtain the segmented polysemantic text query = {w1, w2, …, wn}. The polysemantic text query includes n characters. Then, the feature vector of each character is determined to form a polysemantic text feature vector. The polysemantic text feature vector of the polysemantic text query is Encoder(query) = {z1, z2, …, zn}, where z1 is the feature vector of the character w1 and zn is the feature vector of the character wn.
[0122] It should be noted that before electronic devices segment multi-semantic texts, they can pre-process the multi-semantic texts, such as removing punctuation marks, spaces and other irrelevant characters, removing repeated phrases, and converting the multi-semantic texts into a preset format.
[0123] In the embodiment of the present disclosure, the electronic device may also directly receive the multi-semantic text feature vector after other electronic devices or other models perform the above processing on the multi-semantic text.
[0124] In an embodiment of the present disclosure, for each label, the electronic device determines the degree of association between the feature vector of each character and the label feature vector based on the feature vector of each character in the polysemantic text and the label feature vector corresponding to the label. The electronic device can determine the degree of association between the feature vector of each character and the label feature vector based on the similarity between the feature vector of each character in the polysemantic text and the label feature vector corresponding to the label. The electronic device can also calculate the degree of association between the feature vector of each character and the label feature vector based on a preset algorithm. Formula (3) is a calculation method for determining the degree of association between the feature vector of a certain character and the label feature vector:
[0125]
[0126] Among them, l i is the label feature vector of label i, z j is the feature vector of the jth character in the multi-semantic text, h is l i The dimension of s(l i ,z j ) is l i With z j The correlation between them.
[0127] In an embodiment of the present disclosure, after the electronic device determines the correlation between the feature vector of each character in the polysemantic text and the feature vector of the label, it can determine the feature vector of the polysemantic text associated label based on the correlation and the feature vector of each character, wherein the feature vector of the polysemantic text associated label is used to represent the matching degree between the polysemantic text and the label.
[0128] In some embodiments, determining the feature vector of the multi-semantic text association label based on the association degree and the feature vector of each character includes:
[0129] For each character, the character's feature vector is weighted based on the correlation between the character's feature vector and the label's feature vector;
[0130] The feature vectors obtained by weighting the feature vectors of each character are fused to obtain the feature vector of the multi-semantic text association label.
[0131] In the disclosed embodiment, the electronic device weights the feature vector of each character based on the correlation between the feature vector of the character and the label feature vector, such as multiplying the feature vector of the character by the correlation between the feature vector of the character and the label feature vector.
[0132] It should be noted that, before weighting the character feature vectors based on the correlation between the character feature vectors and the label feature vectors, the electronic device may first normalize the correlation between the feature vectors of each character and the label feature vectors, wherein the normalization method may be as shown in formula (4):
[0133]
[0134] Among them, b ij For the aforementioned s(l i ,z j ) is the normalized value, and n is the number of characters in the multi-semantic text.
[0135] In an embodiment of the present disclosure, the electronic device fuses the weighted feature vectors of the feature vectors of each character to obtain a feature vector of a multi-semantic text association label. The electronic device may fuse the weighted feature vectors of the feature vectors of each character based on a preset model to obtain a feature vector of the multi-semantic text association label. The electronic device may also simply concatenate the weighted feature vectors of the feature vectors of each character to obtain a feature vector of the multi-semantic text association label. In an embodiment of the present disclosure, the method for fusing the weighted feature vectors of the feature vectors of each character may be as shown in formula (5):
[0136]
[0137] Among them, qbs i is the feature vector of multi-semantic text associated label i, z j is the feature vector of the jth character in the multi-semantic text, b ij is the label feature vector of label i and z j The value after normalization of the correlation between them, n is the number of characters in the multi-semantic text.
[0138] The embodiment of the present disclosure adopts a weighted fusion method, which is relatively simple and fast, and can increase the importance of the correlation between each character and the label feature vector to the feature vector of the multi-semantic text association label, so that the feature vector of the multi-semantic text association label can represent the correlation between each character and the label feature vector.
[0139] In an embodiment of the present disclosure, the electronic device determines, for each tag, whether the tag is a target tag based on a feature vector of the tag associated with the multi-semantic text. For example, in some embodiments, determining whether the tag is the target tag based on the feature vector of the tag associated with the multi-semantic text includes:
[0140] Processing the feature vector of the multi-semantic text associated label using a preset confidence function to obtain the confidence of the multi-semantic text corresponding label;
[0141] The confidence is compared with a preset confidence threshold to determine whether the tag is the target tag.
[0142] In the embodiment of the present disclosure, the electronic device processes the feature vector of the multi-semantic text associated label using a preset confidence function to obtain the confidence of the multi-semantic text corresponding label. The specific method of processing the feature vector of the multi-semantic text associated label using the preset confidence function to obtain the confidence of the multi-semantic text corresponding label can be shown in formula (6):
[0143] logits i =sigmoid(W*qbs i+c) (6)
[0144] Among them, logits i Represents the confidence of the label i corresponding to the multi-semantic text, that is, the possibility that the target label of the multi-semantic text includes label i, W is the preset weight vector, qbs i is the feature vector of the polysemantic text associated label i, c is the preset bias term, and the result of this function is a probability value between 0 and 1, which indicates the possibility that the target label of the polysemantic text includes label i.
[0145] In an embodiment of the present disclosure, the electronic device compares the confidence level with a preset confidence threshold to determine whether a tag is a target tag. The preset confidence threshold is a preset value. For example, when the confidence level of a tag corresponding to a polysemantic text is a value between 0 and 1, the preset confidence threshold may be set to 0.5. The electronic device may select a tag with a confidence level greater than the preset confidence threshold as a target tag.
[0146] In the disclosed embodiment, the confidence of a multi-semantic text corresponding to a label text is determined by a confidence function. The solution is simple, effective, and highly intelligent.
[0147] The disclosed embodiment can capture key information associated with the label in the polysemantic text by determining a feature vector unique to the polysemantic text relative to each label, and determine whether the polysemantic text corresponds to the label based on the feature vector, thereby improving the accuracy of determining whether the polysemantic text corresponds to the label.
[0148] In the related art, a text processing model is usually used to process polysemantic text to determine the target label of the polysemantic text. However, the processing method of the text processing model in the related art is to compare the distance (similarity) between the semantic feature vector of the polysemantic text and the semantic feature vector of each label in the preset multiple labels to determine the target label of the polysemantic text. The text processing model in the related art also follows the above process during training, but this is highly dependent on the training sample data set. For sample data sets with uneven distribution, the trained model will be more biased towards categories with large sample sizes and underfit the categories with small sample sizes. If the sample data set is manually adjusted to make the sample texts in the sample data set evenly distributed, the data distribution of the sample texts will be destroyed, so that the data distribution fitted by the model is not the distribution that exists in the real environment, which will affect the performance of the model after training.
[0149] In this regard, the present disclosure provides a text processing model. Figure 3 This is an architectural diagram of a text processing model provided by an embodiment of the present disclosure, such as Figure 3As shown, L31 is the multi-semantic text input by the user, the knowledge-enhanced semantic representation model L32 is used to extract the semantic features of the multi-semantic text L31 to determine the multi-semantic text feature vector that can express the semantics of the multi-semantic text L31, the label semantic matrix L33 includes the semantic features of each label in the preset multiple labels, the label relationship matrix L34 includes the correlation between each arbitrary two labels in the preset multiple labels, the graph attention network L35 is used to determine the preset multiple label feature vectors based on the label semantic matrix L33 and the label relationship matrix L34, and the label attention layer L36 is used to determine for each label, The multi-semantic text L31 is associated with the feature vector of the label, and output L37 is used to determine the confidence of the multi-semantic text L36 corresponding to the label for each label based on the feature vector of the multi-semantic text L31 associated with the label in the label attention layer L36, so as to determine whether the label is the target label of the multi-semantic text L31, and output the value corresponding to each label, such as L38, L39, and L40, which are the values corresponding to three of the preset multiple labels, and the value corresponding to each label is 0 or 1, 0 indicates that the label is not the target label of the multi-semantic text L31, and 1 indicates that the label is the target label of the multi-semantic text L31.
[0150] In the embodiment of the present disclosure, the training process of the above text processing model is also the above process, wherein, during the model training process, the parameters of the model need to be updated based on the loss of each label. The calculation method of the loss of each label is shown in formula (7):
[0151]
[0152] Among them, L is the loss of each label, N is the number of sample texts in the sample data set, K is the number of labels of the preset multiple labels, logits i |x represents the confidence of the multi-semantic text sample corresponding to label i, is the true value of the intention of the multi-semantic text sample with label i, which is 0 or 1. After each iterative training of the sample data set, the model parameters of the preset neural network model are updated using L corresponding to this iterative training. After multiple iterative trainings, the text processing model in the embodiment of the present disclosure is obtained. Since the text processing model in the embodiment of the present disclosure takes into account the correlation between labels, when training the sample data set, the minority sample label can also be trained with the multi-sample label associated with it, thereby enabling the performance of the text processing model in the embodiment of the present disclosure to be higher.
[0153] Figure 4 FIG. 4 is a block diagram of a text processing device 400 provided by an embodiment of the present disclosure. Figure 4 As shown, the device mainly includes:
[0154] A first acquisition module 401 is configured to acquire a polysemantic text feature vector to be identified and a plurality of preset tag feature vectors; wherein the polysemantic text feature vector corresponds to a polysemantic text, the plurality of tag feature vectors correspond to a plurality of tags, one tag feature vector in the plurality of tag feature vectors corresponds to one tag, the one tag feature vector represents a semantic feature vector of the corresponding tag adjusted using an interaction correlation degree set, the interaction correlation degree set including a correlation degree between the tag corresponding to the one tag feature vector and each of the plurality of tags;
[0155] The first determining module 402 is configured to determine at least two target tags of the multi-semantic text from the multiple tags based on the multi-semantic text feature vector and the multiple tag feature vectors.
[0156] In some embodiments, the text processing apparatus 400 further includes:
[0157] A second acquisition module is configured to acquire a sample data set; wherein the sample data set includes a plurality of sample texts and at least two labels for each sample text;
[0158] a second determining module configured to determine the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels;
[0159] The third determining module is configured to determine the degree of association between any two tags based on the mutual information between the two tags.
[0160] In some embodiments, the second determination module is further configured to extract at least two sample texts from the sample data set multiple times; wherein the number of the at least two sample texts extracted each time is less than the total number of sample texts in the sample data set; for the at least two labels of the at least two sample texts extracted each time, determine a first number of sample texts respectively associated with each arbitrary two labels in the at least two labels, and a second number of the same sample texts associated with the arbitrary two labels, and determine the mutual information between the arbitrary two labels based on the two first numbers and one second number; in response to the arbitrary two labels appearing in different extractions, determine a mutual information statistic between the arbitrary two labels based on the mutual information respectively determined in different extractions, and use the mutual information statistic as the mutual information between the arbitrary two labels.
[0161] In some embodiments, the one tag feature vector is a semantic feature vector obtained by weighting and fusing the semantic features of each tag in the multiple tags based on the association between its corresponding tag and each tag in the multiple tags.
[0162] In some embodiments, the first determination module 402 is further configured to determine the degree of matching between the polysemantic text and each label based on the polysemantic text feature vector and each label feature vector in the multiple label feature vectors; and based on the degree of matching between the polysemantic text and each label, determine at least two target labels from the multiple labels whose degree of matching with the polysemantic text meets a preset matching condition.
[0163] In some embodiments, the multi-semantic text feature vector includes a feature vector of each character in the multi-semantic text; the first determination module 402 is further configured to determine, for each label, the correlation between the feature vector of each character and the label feature vector based on the feature vector of each character in the multi-semantic text and the label feature vector corresponding to the label, and determine the feature vector of the multi-semantic text associated label based on the correlation and the feature vector of each character; wherein the feature vector of the multi-semantic text associated label is used to characterize the matching degree between the multi-semantic text and the label; for each label, determine whether the label is the target label based on the feature vector of the multi-semantic text associated label.
[0164] In some embodiments, the first determination module 402 is further configured to weight the feature vector of each character based on the correlation between the feature vector of the character and the feature vector of the label; and fuse the weighted feature vectors of each character to obtain the feature vector of the multi-semantic text association label.
[0165] In some embodiments, the first determination module 402 is further configured to process the feature vector of the multi-semantic text associated label using a preset confidence function to obtain the confidence of the label corresponding to the multi-semantic text; and compare the confidence with a preset confidence threshold to determine whether the label is the target label.
[0166] Figure 5 1 is a block diagram of an electronic device 500 provided in an embodiment of the present disclosure. For example, the electronic device 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a tablet device, a personal digital assistant, or an electronic device in a vehicle, such as an in-vehicle communication system, a vehicle information management system, or a vehicle driving assistance system.
[0167] Reference Figure 5, electronic device 500 may include one or more of the following components: a processing component 502 , a memory 504 , a power component 506 , a multimedia component 508 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , and a communication component 516 .
[0168] The processing component 502 generally controls the overall operation of the electronic device 500, such as operations associated with at least one of display, phone calls, data communications, camera operation, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 502 may include one or more modules to facilitate interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
[0169] The memory 504 is configured to store various types of data to support operations on the electronic device 500. Examples of such data include at least one of the following: instructions for any application or method operating on the electronic device 500, contact data, phone book data, messages, pictures, and videos. The memory 504 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0170] The power supply component 506 provides power to various components of the electronic device 500. The power supply component 506 may include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 500.
[0171] The multimedia component 508 includes a screen that provides an output interface between the electronic device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the electronic device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
[0172] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 504 or transmitted via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.
[0173] I / O interface 512 provides an interface between processing component 502 and peripheral interface modules, such as a keyboard, click wheel, and buttons. These buttons may include, but are not limited to, a home button, volume buttons, a start button, and a lock button.
[0174] The sensor assembly 514 includes one or more sensors for providing various aspects of the status assessment of the electronic device 500. For example, the sensor assembly 514 can detect the open / closed state of the electronic device 500, the relative positioning of components, such as the display and keypad of the electronic device 500. The sensor assembly 514 can also detect changes in the position of the electronic device 500 or a component thereof, the presence or absence of user contact with the electronic device 500, the orientation or acceleration / deceleration of the electronic device 500, and changes in the temperature of the electronic device 500. The sensor assembly 514 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 can also include an optical sensor, such as a complementary metal oxide semiconductor (CMOS) or charge coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 can also include, but is not limited to, at least one of the following: an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, and a temperature sensor.
[0175] The communication component 516 is configured to facilitate communication between the electronic device 500 and other devices in a wired or wireless manner. The electronic device 500 can access a wireless network based on a communication standard, such as Wi-Fi, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology and other technologies.
[0176] In an exemplary embodiment, the electronic device 500 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.
[0177] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is further provided, such as a memory 504 including executable instructions or a computer program. The instructions or computer program can be executed by the processor 520 of the electronic device 500 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0178] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform any of the above-mentioned text processing methods of the embodiments of the present disclosure. For example, the method includes:
[0179] Obtaining a polysemantic text feature vector to be identified and a plurality of preset tag feature vectors; wherein the polysemantic text feature vector corresponds to a polysemantic text, the plurality of tag feature vectors correspond to a plurality of tags, one tag feature vector in the plurality of tag feature vectors corresponds to one tag, the one tag feature vector representing a semantic feature vector of the corresponding tag adjusted using an interaction correlation degree set, the interaction correlation degree set including a correlation degree between the tag corresponding to the one tag feature vector and each of the plurality of tags;
[0180] At least two target tags for the multi-semantic text are determined from the multiple tags based on the multi-semantic text feature vector and the multiple tag feature vectors.
[0181] The present disclosure provides a computer program product comprising a computer program or executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or executable instructions from the computer-readable storage medium and executes the computer program or executable instructions, causing the computer device to perform any of the above-described text processing methods of the present disclosure.
[0182] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0183] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A text processing method, characterized in that: The method comprises: Obtaining a polysemantic text feature vector to be identified and a plurality of preset tag feature vectors; wherein the polysemantic text feature vector corresponds to a polysemantic text, the plurality of tag feature vectors correspond to a plurality of tags, one tag feature vector in the plurality of tag feature vectors corresponds to one tag, the one tag feature vector representing a semantic feature vector of the corresponding tag adjusted using an interaction correlation degree set, the interaction correlation degree set including a correlation degree between the tag corresponding to the one tag feature vector and each of the plurality of tags; At least two target tags for the multi-semantic text are determined from the multiple tags based on the multi-semantic text feature vector and the multiple tag feature vectors.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining a sample data set; wherein the sample data set includes a plurality of sample texts and at least two labels for each sample text; Determining the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels; Based on the mutual information between any two tags, the association degree between the any two tags is determined.
3. The method according to claim 2, characterized in that The determining the mutual information between any two labels based on a first number of sample texts associated with each of the two labels in the sample data set and a second number of sample texts associated with the same two labels includes: extracting at least two sample texts from the sample data set multiple times; wherein the number of the at least two sample texts extracted each time is less than the total number of sample texts in the sample data set; For each of the at least two labels of the at least two sample texts extracted, determining a first number of sample texts respectively associated with each arbitrary two labels in the at least two labels, and a second number of the same sample texts associated with the arbitrary two labels, and determining mutual information between the arbitrary two labels based on the two first numbers and the second number; In response to the arbitrary two tags appearing in different extractions, a mutual information statistic between the arbitrary two tags is determined based on the mutual information respectively determined in the different extractions, and the mutual information statistic is used as the mutual information between the arbitrary two tags.
4. The method according to any one of claims 1 to 3, characterized in that The tag feature vector is a semantic feature vector obtained by weighting and fusing the semantic features of each tag in the multiple tags based on the association degree between its corresponding tag and each tag in the multiple tags.
5. The method according to any one of claims 1 to 3, characterized in that The determining, based on the multi-semantic text feature vector and the multiple tag feature vectors, at least two target tags for the multi-semantic text from the multiple tags includes: Determining a degree of matching between the polysemantic text and each label based on the polysemantic text feature vector and each label feature vector in the plurality of label feature vectors; Based on the matching degree between the polysemantic text and each tag, at least two target tags whose matching degree with the polysemantic text satisfies a preset matching degree condition are determined from the multiple tags.
6. The method according to claim 5, characterized in that The multi-semantic text feature vector includes a feature vector of each character in the multi-semantic text; The determining, based on the multi-semantic text feature vector and each tag feature vector in the plurality of tag feature vectors, a matching degree between the multi-semantic text and each tag includes: For each label, determining a correlation between the feature vector of each character and the label feature vector based on the feature vector of each character in the polysemantic text and the label feature vector corresponding to the label, and determining a feature vector of the polysemantic text associated label based on the correlation and the feature vector of each character; wherein the feature vector of the polysemantic text associated label is used to represent the degree of match between the polysemantic text and the label; The determining, based on the degree of match between the polysemantic text and each tag, at least two target tags from the multiple tags whose degree of match with the polysemantic text satisfies a preset degree of match condition, includes: For each tag, it is determined whether the tag is the target tag based on the feature vector of the multi-semantic text associated tag.
7. The method according to claim 6, characterized in that The determining the feature vector of the multi-semantic text association label based on the association degree and the feature vector of each character includes: For each character, the character's feature vector is weighted based on the correlation between the character's feature vector and the label's feature vector; The feature vectors obtained by weighting the feature vectors of each character are fused to obtain the feature vector of the multi-semantic text association label.
8. The method according to any one of claims 6 to 7, characterized in that The determining whether a label is the target label based on the feature vector of the multi-semantic text associated label includes: Processing the feature vector of the multi-semantic text associated label using a preset confidence function to obtain the confidence of the multi-semantic text corresponding label; The confidence is compared with a preset confidence threshold to determine whether the tag is the target tag.
9. A text processing device, characterized in that: The device comprises: an acquisition module configured to acquire a multi-semantic text feature vector to be identified and a plurality of preset tag feature vectors; wherein the multi-semantic text feature vector corresponds to a multi-semantic text, the plurality of tag feature vectors correspond to a plurality of tags, one tag feature vector in the plurality of tag feature vectors corresponds to a tag, the tag feature vector represents a semantic feature vector of the corresponding tag adjusted using an interaction correlation degree set, the interaction correlation degree set including a correlation degree between the tag corresponding to the tag feature vector and each of the plurality of tags; The determination module is configured to determine at least two target tags of the multi-semantic text from the multiple tags based on the multi-semantic text feature vector and the multiple tag feature vectors.
10. An electronic device, characterized in that: include: processor; memory for storing computer programs or instructions; The processor executes the computer program or instructions to implement the steps of the text processing method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing a computer program or instruction, characterized in that: When the computer program or instructions in the storage medium are executed by a processor, the steps of the text processing method according to any one of claims 1 to 8 are implemented.
12. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the text processing method according to any one of claims 1 to 8 are implemented.