Label system construction method and device, storage medium, equipment and program product
Patent Information
- Application Number
- CN202510229494.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2026-08-28
AI Technical Summary
例如,扁平化标签体系无法清晰地表达标签之间的层级关系,导致信息检索和管理的效率低下
[0027] This application embodiment obtains source data for the label system to be constructed; obtains the original label set corresponding to the source data, the original label set including at least one label pair; performs prediction processing on each label pair in the original label set based on the prediction model to obtain the predicted hierarchical relationship between the two labels in each label pair, and constructs a relationship matrix through the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained based on the training dataset, and each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair; by traversing the relationship matrix, identifies the labels belonging to the root node in the original label set, and searches for the labels belonging to the child nodes in the original label set starting from the root node. A tree structure is constructed by the root node and the found child nodes. By performing depth sorting on the labels in the tree structure, a multi-level label system corresponding to the source data is formed. This application's embodiments utilize a predictive model to predict the hierarchical relationship between the two tags in each tag pair of the original tag set. Then, based on this predicted hierarchical relationship, a relationship matrix is constructed. This automatically determines the hierarchical relationship (parent-child, child-parent, or no relationship) between the two tags in each tag pair, significantly reducing manual intervention and improving efficiency. Based on the constructed relationship matrix, a multi-level tag system with hierarchical relationships is accurately built, improving classification accuracy and overall data processing efficiency.
Smart Images

Figure CN122654645A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a method, apparatus, storage medium, device, and program product for constructing a tag system. Background Technology
[0002] In the age of information overload, the classification and organization of data have become particularly important. Traditional tagging systems often employ a flat structure, where all tags are at the same level. While this structure may be sufficient for handling small amounts of data, its shortcomings become increasingly apparent as the volume of data increases. For example, a flat tagging system cannot clearly express the hierarchical relationships between tags, leading to inefficient information retrieval and management. Summary of the Invention
[0003] This application provides a label system construction method, apparatus, storage medium, device, and program product, which can automatically determine the relationship between labels and accurately construct a multi-level label system based on the relationship matrix, reducing manual intervention and improving classification accuracy.
[0004] On the one hand, embodiments of this application provide a method for constructing a tag system, the method comprising:
[0005] Obtain the source data for the tag system to be built;
[0006] Obtain the original tag set corresponding to the source data, wherein the original tag set includes at least one tag pair;
[0007] Based on the prediction model, each label pair in the original label set is predicted to obtain the predicted hierarchical relationship between the two labels in each label pair. A relationship matrix is constructed based on the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained on the training dataset. Each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair.
[0008] By traversing the relation matrix, the labels belonging to the root node in the original label set are identified. Starting from the root node, the labels belonging to the child nodes in the original label set are searched. A tree structure is constructed from the root node and the found child nodes. By performing depth sorting on the labels in the tree structure, a multi-level label system corresponding to the source data is formed.
[0009] On the other hand, embodiments of this application provide a tag system construction apparatus, the apparatus comprising:
[0010] The first acquisition unit is used to acquire the source data of the tag system to be built;
[0011] The second acquisition unit is used to acquire the original tag set corresponding to the source data, wherein the original tag set includes at least one tag pair;
[0012] The processing unit is used to perform prediction processing on each label pair in the original label set based on the prediction model, to obtain the predicted hierarchical relationship between the two labels in each label pair, and to construct a relationship matrix through the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained based on the training dataset, and each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair.
[0013] The construction unit is used to identify the tags belonging to the root node in the original tag set by traversing the relation matrix, search for the tags belonging to the child nodes in the original tag set starting from the root node, construct a tree structure by the root node and the found child nodes, and form a multi-level tag system corresponding to the source data by performing depth sorting on the tags in the tree structure.
[0014] In some embodiments, the processing unit is configured to: predict each tag pair in the original tag set into the prediction model to obtain the probability value of each tag pair belonging to each hierarchical relationship; select the hierarchical relationship corresponding to the highest probability value as the predicted hierarchical relationship between the two tags in each tag pair according to the probability value of each tag pair belonging to each hierarchical relationship; and construct a relationship matrix according to the predicted hierarchical relationship between the two tags in each tag pair in the original tag set.
[0015] In some embodiments, the predicted hierarchical relationship includes no relationship, parent-child relationship, and child-parent relationship, wherein parent-child relationship and child-parent relationship are two different hierarchical relationships; the actual hierarchical relationship includes no relationship, parent-child relationship, and child-parent relationship.
[0016] In some embodiments, each tag in the original tag set corresponds to a tag node; the construction unit is configured to: traverse the relationship matrix and identify tag nodes that are not in a parent-child relationship as root nodes; starting from the root node, recursively search for the child nodes of each tag node according to the parent-child relationship in the relationship matrix, and set a depth attribute value for each tag node, wherein the depth attribute value of each tag node represents the hierarchical position of each tag node in the tree structure; connect each tag node to its parent node and / or child node according to the depth attribute value of each tag node to form a tree structure; sort all tag nodes in the tree structure in descending order of the depth attribute value of each tag node in the tree structure; and form a multi-level tag system with hierarchical relationships corresponding to the source data according to the sorted tree structure.
[0017] In some embodiments, when setting the depth attribute value for each tag node, the construction unit is configured to: set the depth attribute value of the tag node belonging to the root node to 0; set the depth attribute value of the child node of the tag node belonging to the root node to 1; set the depth attribute value of any tag node to be equal to the depth attribute value of its parent node plus 1; and recursively set the depth attribute value of each tag node layer by layer according to the parent-child relationship until the depth attribute values of all tag nodes in the original tag set are determined.
[0018] In some embodiments, when setting the depth attribute value for each tag node, the construction unit is further configured to: if the tree structure changes, recalculate the depth attribute value of each tag node according to the position of each tag node in the changed tree structure.
[0019] In some embodiments, the device further includes a display unit for: visually displaying the multi-level tagging system on a graphical user interface.
[0020] In some embodiments, the building unit is further configured to: update the multi-level tag system in response to a modification instruction for the multi-level tag system; and record different historical versions of the multi-level tag system based on a version control mechanism.
[0021] In some embodiments, the construction unit is further configured to: optimize the multi-level tag system by deleting redundant tags or merging similar tags to obtain an optimized multi-level tag system; or periodically update the multi-level tag system based on updated source data to obtain an updated multi-level tag system.
[0022] In some embodiments, the apparatus further includes a training unit, configured to: acquire a training dataset, wherein each training sample in the training dataset includes a sample label pair and a true hierarchical relationship between the two sample labels in the sample label pair; input the sample label pair in each training sample into a pre-trained model to predict the relationship, thereby obtaining a probability value for each sample label pair belonging to each hierarchical relationship; select the hierarchical relationship corresponding to the highest probability value as the predicted hierarchical relationship between the two sample labels in each sample label pair based on the probability value of each sample label pair belonging to each hierarchical relationship; calculate the loss value between the predicted hierarchical relationship between the two sample labels in each sample label pair and the true hierarchical relationship; and adjust the model parameters of the pre-trained model based on the loss value until the loss value reaches a preset threshold or the number of training iterations reaches a preset upper limit, thereby obtaining a prediction model.
[0023] In some embodiments, the source data includes at least one of multimedia resources, text content, product information, and knowledge entries.
[0024] On the other hand, an embodiment of this application provides a computer-readable storage medium storing a computer program adapted for loading by a processor to execute the tag system construction method as described in any of the above embodiments.
[0025] On the other hand, an embodiment of this application provides a computer device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the tag system construction method as described in any of the above embodiments by calling the computer program stored in the memory.
[0026] On the other hand, an embodiment of this application provides a computer program product, including computer instructions, which, when executed by a processor, implement the tag system construction method as described in any of the above embodiments.
[0027] This application embodiment obtains source data for the label system to be constructed; obtains the original label set corresponding to the source data, the original label set including at least one label pair; performs prediction processing on each label pair in the original label set based on the prediction model to obtain the predicted hierarchical relationship between the two labels in each label pair, and constructs a relationship matrix through the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained based on the training dataset, and each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair; by traversing the relationship matrix, identifies the labels belonging to the root node in the original label set, and searches for the labels belonging to the child nodes in the original label set starting from the root node. A tree structure is constructed by the root node and the found child nodes. By performing depth sorting on the labels in the tree structure, a multi-level label system corresponding to the source data is formed. This application's embodiments utilize a predictive model to predict the hierarchical relationship between the two tags in each tag pair of the original tag set. Then, based on this predicted hierarchical relationship, a relationship matrix is constructed. This automatically determines the hierarchical relationship (parent-child, child-parent, or no relationship) between the two tags in each tag pair, significantly reducing manual intervention and improving efficiency. Based on the constructed relationship matrix, a multi-level tag system with hierarchical relationships is accurately built, improving classification accuracy and overall data processing efficiency. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a schematic diagram illustrating an application scenario of the label system construction device provided in this application embodiment.
[0030] Figure 2 This is a flowchart illustrating the label system construction method provided in an embodiment of this application.
[0031] Figure 3 This is a flowchart illustrating the training method for the prediction model provided in the embodiments of this application.
[0032] Figure 4 This is a schematic diagram of the label system construction device provided in an embodiment of this application.
[0033] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0034] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0035] This application provides a method, apparatus, storage medium, device, and program product for constructing a tag system. Exemplarily, the tag system construction method of this application can be executed by a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, desktop computer, smart TV, smart speaker, wearable smart device, personal computer (PC), smart vehicle terminal, etc. The terminal can also include a client, which can be a video client, shopping application client, reading application client, browser client, or instant messaging client, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms.
[0036] The embodiments of this application can be applied to scenarios such as artificial intelligence, machine learning, information recommendation, data classification, and tag system construction.
[0037] The solutions provided in this application involve technologies such as tag system construction, which are specifically illustrated through the following embodiments. Detailed descriptions are provided below. It should be noted that the order of description of the following embodiments is not intended to limit the priority of the embodiments.
[0038] It is understood that in the specific implementation of this application, user source data, tags and other related data are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0039] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of the tag system construction apparatus provided in this application embodiment. Taking the tag system construction method executed by a computer device as an example, the computer device can be a terminal or a server, etc. During the training phase, the computer device acquires a training dataset. Each training sample in the training dataset includes a sample label pair and the true hierarchical relationship of the sample label pair. The sample label pair in each training sample is input into a pre-trained model to predict the relationship, obtaining the probability value of each sample label pair belonging to each hierarchical relationship. Based on the probability value of each sample label pair belonging to each hierarchical relationship, the hierarchical relationship corresponding to the highest probability value is selected as the predicted hierarchical relationship between the two labels in each sample label pair. The loss value is calculated based on the predicted hierarchical relationship and the true hierarchical relationship of each sample label pair. The model parameters of the pre-trained model are adjusted based on the loss value until the loss value reaches a preset threshold or the number of training iterations reaches a preset upper limit, thus obtaining the prediction model. During the application phase, the computer equipment acquires the source data for the tag system to be constructed; it acquires the original tag set corresponding to the source data, which includes at least one tag pair; it performs prediction processing on each tag pair in the original tag set based on the prediction model to obtain the prediction hierarchy relationship between the two tags in each tag pair, and constructs a relationship matrix through the prediction hierarchy relationship between the two tags in each tag pair; by traversing the relationship matrix, it identifies the tags belonging to the root node in the original tag set, and starts from the root node to find the tags belonging to the child nodes in the original tag set, constructing a tree structure from the root node and the found child nodes; and by performing depth sorting on the tags in the tree structure, a multi-level tag system corresponding to the source data is formed.
[0040] It should be noted that the training and application processes can be completed on the server or on the terminal.
[0041] This application provides a method for constructing a tag system, which can be executed by a terminal or a server, or by both a terminal and a server. This application uses the example of the tag system construction method being executed by a server to illustrate the method.
[0042] Please see Figures 2 to 3 , Figure 2 This is a flowchart illustrating the tag system construction method provided in an embodiment of this application. Figure 3 This is a flowchart illustrating the training method for the prediction model provided in an embodiment of this application. The method may include the following steps:
[0043] Step 110: Obtain the source data for the tag system to be built.
[0044] The main task of this step is to collect and organize the source data that will be used to build the tagging system. Source data can include, but is not limited to, various forms of multimedia resources such as text data, image data, audio data, and video data, as well as other types of data such as product information and object behavior data.
[0045] For example, this source data can come from various sources, such as database records, behavioral logs, and text content (e.g., news reports, social media posts). The quality, completeness, and relevance of the source data are crucial to the accuracy and usability of the labeling system in subsequent steps. Therefore, when acquiring source data, preprocessing operations such as noise and outlier removal, formatting (standardizing data formats), and normalization (numerical standardization) can be performed to ensure data accuracy and consistency.
[0046] In some embodiments, the source data includes at least one of multimedia resources, text content, product information, and knowledge entries.
[0047] Multimedia resources, such as images, videos, and audio, may contain a wealth of information and need to be organized and categorized through a tagging system to facilitate subsequent retrieval and analysis.
[0048] Text content, such as news articles, academic papers, and product descriptions, usually contains a large number of information points and keywords. A tagging system can help to better extract and organize this information.
[0049] Product information: On e-commerce platforms, product information is abundant and complex. A tag system can be used to easily classify, recommend, and search for products.
[0050] Knowledge entries: such as entries in encyclopedias, records in databases, etc. Knowledge entries usually have a clear hierarchical structure and relationships, and are suitable for organization and display through a tag system.
[0051] When acquiring source data, it is necessary to consider the completeness, accuracy, and timeliness of the data. Completeness requires acquiring all relevant data as much as possible to avoid omissions; accuracy requires that the data be true and reliable, without errors or misleading information; and timeliness emphasizes that the data should be updated in a timely manner to reflect the latest situation.
[0052] In some embodiments, when obtaining the source data for the tag system to be constructed, the source data can also be preprocessed, including deduplication, cleaning, and formatting, to improve the accuracy and efficiency of the tag system construction.
[0053] For example, the source data may contain duplicate records or information. This duplication not only increases the burden of data processing and storage but can also mislead the construction of the tagging system. Therefore, deduplication is the primary task in preprocessing. Through comparison and identification, the system can automatically delete or merge duplicate data items, ensuring that each data item is unique and meaningful when constructing the tagging system.
[0054] For example, source data may contain invalid, incomplete, or erroneous information that can interfere with the labeling process. Cleaning operations aim to identify and correct these problems. Examples include removing null values, filling in missing values, correcting spelling errors, and converting data formats. Through cleaning, the source data can be made more accurate and usable when building the labeling system.
[0055] For example, formatting is necessary to make source data more consistent and easier to process when building a tagging system. This includes converting data to a uniform format, standardizing data representation (such as date formats, numeric formats, etc.), and organizing data into a structured form (such as tables, databases, etc.). Formatting not only helps improve the speed and efficiency of data processing but also reduces errors caused by inconsistent data formats.
[0056] In addition to deduplication, cleaning, and formatting, other preprocessing operations may be required depending on the characteristics of the source data and the specific needs of building the tagging system. These may include data standardization (converting data to a uniform unit of measurement or scale), data normalization (scaling data to the same range or scale), and data transformation (converting one data type to another).
[0057] Step 120: Obtain the original tag set corresponding to the source data. The original tag set includes at least one tag pair.
[0058] For example, the original tag set can come from existing classification systems, expert annotations, automated tag extraction algorithms (such as keyword extraction, topic modeling, etc.), or external imports. These tags are usually a summary or description of the source data content, used to identify the theme, category, or characteristics of the source data.
[0059] When obtaining the original tag set, it can be cleaned and preprocessed to remove duplicate, irrelevant or incorrect tags to ensure the smooth progress of subsequent steps.
[0060] In some embodiments, the method further includes receiving a raw set of tags input by a user through a graphical user interface.
[0061] For example, to improve the customization and flexibility of the tagging system, a graphical user interface (GUI) can be used to receive the original tag set input by the user. Users can manually add, edit, or delete tags through the GUI to adapt to specific application scenarios or needs. For instance, the tags could be a given flat tagging scheme, i.e., simple tags without a hierarchical structure.
[0062] In some embodiments, obtaining the original tag set corresponding to the source data further includes: extracting keywords or phrases from the source data as candidate tags; and performing deduplication, merging, and standardization processing on the candidate tags to form the original tag set.
[0063] In this process, keywords or phrases that can describe the content or characteristics of the source data are extracted and used as candidate tags for constructing a multi-level tagging system.
[0064] For example, for text-based source data (text content, product information, knowledge entries, etc.), natural language processing techniques (such as word segmentation, part-of-speech tagging, named entity recognition, etc.) can be used to extract keywords or phrases.
[0065] For example, for source data of image or video type (multimedia resources, etc.), image recognition technology (such as object detection, scene recognition, etc.) and speech recognition technology can be used to extract relevant tags.
[0066] For example, for structured or semi-structured source data (such as database records, web page metadata, etc.), keywords or phrases can be directly extracted as candidate tags.
[0067] This process involves removing duplicates from candidate tags to avoid redundant tags in subsequent steps. For example, hash algorithms and string matching methods can be used to identify and remove duplicate candidate tags. Simultaneously, tags with the same semantics but different expressions (such as synonyms) also need to be identified and processed during deduplication. Deduplication significantly reduces the number of candidate tags, improving the efficiency and accuracy of subsequent steps.
[0068] This involves merging semantically similar or identical candidate tags into a single candidate tag, reducing the number of candidate tags and improving the consistency and accuracy of the tagging system. Natural language processing techniques (such as semantic similarity analysis) or rule-based methods can be used for this merging. For example, a semantic similarity threshold can be set; when the semantic similarity of two candidate tags exceeds this threshold, they are merged into one candidate tag. This merging process reduces the number of candidate tags, improving the simplicity and consistency of the tagging system. Furthermore, the merged tags will be more representative and comprehensive, helping to better reflect the content of the source data.
[0069] The process involves formatting and standardizing candidate tags to ensure consistency and readability. Standardization includes features such as case conversion, spell correction, and abbreviation expansion. Furthermore, prefixes, suffixes, or specific formats can be added to tags based on business needs to facilitate subsequent management and use. Standardization improves tag consistency and comparability, reducing the difficulty and cost of subsequent data processing. Standardized tags are also easier for users to understand and use.
[0070] After deduplication, merging, and standardization, the candidate tag set will be transformed into a more concise, consistent, and standardized original tag set. This original tag set will serve as the foundation for subsequently building a multi-level tag system, providing rich tag resources and reliable data support for the construction of the tag system.
[0071] Step 130: Based on the prediction model, perform prediction processing on each label pair in the original label set to obtain the predicted hierarchical relationship between the two labels in each label pair, and construct a relationship matrix through the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained based on the training dataset. Each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair.
[0072] The prediction model is typically a trained machine learning or deep learning model that can identify parent-child, child-parent, or no relationship between the two labels in each label pair.
[0073] Before building a prediction model, it is necessary to train the model using a training dataset containing sample label pairs and their true hierarchical relationships. The quality of the training dataset directly affects the model's prediction performance.
[0074] Then, each label pair from the original label set is input into the trained prediction model, which outputs the probability value of each label pair belonging to each hierarchical relationship. The hierarchical relationship with the highest probability value is selected as the predicted hierarchical relationship between the two labels in that label pair. Based on the predicted hierarchical relationship between the two labels in each label pair, a relationship matrix is constructed. Each element in the relationship matrix represents the hierarchical relationship between the two labels. The relationship matrix is the foundation for subsequently constructing a multi-level label system, clearly showing the hierarchical structure and relationships between labels.
[0075] In some embodiments, each tag pair in the original tag set is predicted based on a prediction model to obtain the predicted hierarchical relationship between the two tags in each tag pair, and a relationship matrix is constructed based on the predicted hierarchical relationship between the two tags in each tag pair. This includes: inputting each tag pair in the original tag set into the prediction model for prediction to obtain the probability value of each tag pair belonging to each hierarchical relationship; selecting the hierarchical relationship corresponding to the highest probability value as the predicted hierarchical relationship between the two tags in each tag pair based on the probability value of each tag pair belonging to each hierarchical relationship; and constructing a relationship matrix based on the predicted hierarchical relationship between the two tags in each tag pair in the original tag set.
[0076] In some embodiments, the predicted hierarchical relationship includes no relationship, parent-child relationship, and child-parent relationship, wherein parent-child relationship and child-parent relationship are two different hierarchical relationships;
[0077] True hierarchical relationships include no relationship, parent-child relationship, and child-parent relationship.
[0078] The predicted hierarchical relationship refers to the hierarchical relationship between two labels obtained after the prediction model processes each label pair in the original label set. This relationship is derived from the prediction model's understanding and analysis of the input data, reflecting the model's prediction or inference of the hierarchical relationship between labels. Specifically, the predicted hierarchical relationship is obtained by inputting each label pair in the original label set into a pre-trained prediction model. The prediction model outputs the probability value of each label pair belonging to various hierarchical relationships (such as no relationship, parent-child relationship, child-parent relationship), and then selects the hierarchical relationship with the highest probability value as the predicted hierarchical relationship between the two labels in that label pair.
[0079] The true hierarchical relationship refers to the actual hierarchical relationship between the sample label pairs contained in each training sample in the training dataset. This relationship is determined based on actual data or expert knowledge, and it reflects the true hierarchical structure between labels. Specifically, the true hierarchical relationship is obtained by constructing the training dataset. The training dataset contains multiple training samples, each including a sample label pair and the true hierarchical relationship between the two sample labels in that pair. These true hierarchical relationships are usually obtained through methods such as manual annotation, expert judgment, or data mining.
[0080] For example, all tags in the original tag set can be paired up to form tag pairs.
[0081] Then, each label pair is fed into a pre-trained prediction model. This prediction model (such as a trained BERT model) has powerful text understanding and representation capabilities, and can capture the semantic relationships between labels.
[0082] Then, the prediction model predicts for each label pair, outputting the probability value that the label pair belongs to each hierarchical relationship. These hierarchical relationships can include no relationship (e.g., there is no direct parent-child or child-parent relationship between label i and label j), parent-child relationship (e.g., label i is the parent node of label j), and child-parent relationship (e.g., label i is the child node of label j), etc.
[0083] For each label pair, based on the probability values of belonging to each hierarchical relationship output by the prediction model, the hierarchical relationship with the highest probability value is selected as the predicted hierarchical relationship between the two labels in that label pair. This ensures the accuracy and reliability of the prediction.
[0084] Then, a relation matrix R is constructed based on the predicted hierarchical relationship between the two labels in each label pair of the original label set. The relation matrix R represents the predicted hierarchical relationship between the two labels in each label pair of the original label set. This relation matrix R is a two-dimensional array, where R[i][j] represents the relationship between label i and label j. The relation matrix can be represented as: R = [r(ij)], where each element r(ij) ∈ {0, 1, 2} represents the relationship between label i and label j, and the value range of each element r(ij) can be {0, 1, 2}, corresponding to no relationship, parent-child relationship, and child-parent relationship, respectively. This representation allows the relation matrix R to clearly reflect the relationship between any two labels.
[0085] Constructing a relation matrix R helps to quickly query and understand the hierarchical and relational structure between tags, facilitating subsequent analysis and processing.
[0086] Step 140: By traversing the relation matrix, identify the labels belonging to the root node in the original label set. Starting from the root node, search for the labels belonging to the child nodes in the original label set. Construct a tree structure from the root node and the found child nodes. Perform depth sorting on the labels in the tree structure to form a multi-level label system corresponding to the source data.
[0087] A multi-level tagging system refers to a management system based on the hierarchical relationship of tags. It reflects the inherent connections and logical structure between data by constructing hierarchical tags. The multi-level tagging system arranges tags according to a hierarchical structure to display the hierarchical relationships and classification system between tags. This system is typically represented as a directed acyclic graph (DAG), where each node represents a tag, and directed edges between nodes represent parent-child relationships between tags. In this system, tags are divided into different levels, and each level of tags can have subordinate child tags (child nodes), forming a tree structure or a graph structure.
[0088] In some embodiments, each tag in the original tag set corresponds to a tag node. By traversing the relation matrix, the tags belonging to the root node in the original tag set are identified. Starting from the root node, tags belonging to child nodes are searched from the original tag set. A tree structure is constructed from the root node and the found child nodes. By performing depth sorting on the tags in the tree structure, a multi-level tag system corresponding to the source data is formed. This includes: traversing the relation matrix and identifying tag nodes that are not in a parent-child relationship as the root node of the multi-level tag system; starting from the root node, recursively searching for the child nodes of each tag node according to the parent-child relationship in the relation matrix, and setting a depth attribute value for each tag node, where the depth attribute value of each tag node represents the hierarchical position of each tag node in the tree structure; connecting each tag node to its parent node and / or child node according to the depth attribute value of each tag node to form a tree structure; sorting all tag nodes in the tree structure in descending order of the depth attribute value of each tag node; and forming a multi-level tag system with hierarchical relationships corresponding to the source data based on the sorted tree structure.
[0089] For example, traversing the relation matrix R, we find nodes whose label result is not 1 (i.e., the prediction model predicts that this node is not a child node of any other node). This identifies label nodes that are not in a parent-child relationship (such as unrelated label nodes or child-parent related label nodes), initially designated as root nodes. Later, after performing depth-based sorting on the label nodes in the tree structure, the root node of the branch containing the label node with the highest depth attribute value is designated as the root node of the tree structure (or the subsequently formed multi-level label system). For instance, we can find nodes without a parent node by examining each column of the relation matrix R.
[0090] Then, starting from the found root node set `roots`, the relation matrix is traversed again. Based on the parent-child relationships in the relation matrix `R` (i.e., `R[i][j] = 1` indicates that label `i` is the parent node of label `j`), the child nodes of each label node are recursively searched. During the search, a depth attribute value is set for each label node, representing its hierarchical position in the tree structure. The depth attribute value of the root node is usually set to 0, and the depth attribute value of its child nodes is incremented by 1, and so on, until all label nodes have been traversed. Then, based on the depth attribute value of each label node, each label node is connected to its parent node and / or child node to form a tree structure. Through recursive searching and setting the depth attribute value, a preliminary tree structure can be constructed. A tree structure is an intuitive representation of a multi-level label system. It clearly shows the hierarchical relationship between labels through parent-child relationships and depth attribute values. When constructing a tree structure, it is necessary to ensure that each label node is correctly connected to its parent and child nodes to form a complete hierarchical label system.
[0091] For example, iterate through all the tag nodes. For each tag node, first check its depth attribute value. Based on the depth attribute value, determine the parent node A (the node whose depth attribute value is one less than B's) and possible child nodes C (the node whose depth attribute value is one more than B's and which has a parent-child relationship). Then, use a data structure (such as a linked list, tree, etc.) to connect these nodes (A, B, C) according to their parent-child relationships, ensuring that each node correctly points to its parent node and / or contains its child nodes. Repeat this process until all tag nodes are correctly connected, forming a complete tree structure.
[0092] To ensure that a node is treated as a child node with a greater depth when processing it, the nodes need to be sorted in descending order of depth. This can be achieved by sorting all nodes.
[0093] For example, if tag A has a depth attribute value of 0, tag B has a depth attribute value of 1, and tag C has a depth attribute value of 2, then the sorted order is: tag C > tag B > tag A. This sorted list of tag nodes will serve as the foundation for constructing a multi-level tag system. This method ensures that lower-level nodes (nodes with greater depth) are processed first during the construction process, thus guaranteeing the correctness and completeness of the hierarchical relationship.
[0094] Then, based on the sorted tree structure, a multi-level tag system with hierarchical relationships is formed corresponding to the source data. Specifically, a sorted list of tag nodes and a list of child nodes for each tag node can be obtained from the sorted tree structure. This list of sorted tag nodes and child nodes is then used to construct the multi-level tag system for the source data. This system, represented by a tree structure, clearly demonstrates the hierarchical relationships and semantic connections between tags. Each tag node is associated with its parent and child nodes, forming a complete hierarchical tag structure.
[0095] For example, in the sorted tree structure, the position and hierarchical relationship of each label node are already clear. At this point, two key pieces of information can be extracted:
[0096] The sorted list of tag nodes is a sequence of tag nodes arranged from largest to smallest depth attribute value. It reflects the hierarchical order of the tag nodes in the tree structure, with the bottom-level nodes (maximum depth) at the beginning and the root node (minimum depth) at the end.
[0097] The list of child nodes for each tag node records the set of related child nodes for each tag node. These lists of child nodes form the basis for building a hierarchical structure, clearly defining the relationship between each node and its subordinate nodes.
[0098] Based on the two lists above, the process of constructing a multi-level tag system is as follows:
[0099] (1) Initialize the tag system architecture: Based on a tree structure, initialize the framework of the multi-level tag system. The root node of the tree serves as the top-level entry point for the entire tag system, its child nodes constitute the second level, and so on. The tag nodes of each level are connected through parent-child relationships to form a clear hierarchical structure.
[0100] (2) Populating Tag Nodes and Their Child Nodes: Based on the sorted list of tag nodes, process each node one by one. For each tag node, correctly connect it to its parent node according to its depth attribute value and parent-child relationship. For example, if a node has a depth of 2, then its parent node has a depth of 1. At the same time, connect its child nodes to the tag node according to its child node list. In this way, each node not only knows its position in the hierarchy, but also understands the relationships between its subordinate nodes.
[0101] (3) Constructing a complete hierarchical tag structure: Through the above steps, a complete multi-level tag system is gradually constructed. In this multi-level tag system, each tag node is explicitly associated with its parent and child nodes, forming a hierarchical tree structure. During the construction process, ensure that each node is correctly associated with its parent and child nodes, including: each child node must explicitly point to its parent node; each parent node must contain references to all its child nodes; the hierarchical relationship must conform to the order of the depth attribute values, that is, nodes with greater depth are located below nodes with less depth.
[0102] For example, this multi-level tagging system can be applied to fields such as data management, knowledge graph construction, and recommendation systems. In data management, it helps users quickly classify and retrieve data. In knowledge graphs, it clearly displays the hierarchical relationships between knowledge points, facilitating knowledge dissemination and understanding. In recommendation systems, it can be used for user profiling and personalized recommendations, better understanding user needs through hierarchical relationships.
[0103] In constructing a tree structure based on the relation matrix, in addition to constructing the tree structure based on the depth attribute value of each label node, other methods such as minimum spanning tree and hierarchical clustering can also be used to generate the tree structure.
[0104] A minimum spanning tree (MST) is an acyclic subgraph that connects all vertices of a graph, minimizing the sum of edge weights. For example, elements in a relation matrix can be viewed as edge weights (representing relation strength or similarity), and a minimum spanning tree algorithm (such as Kruskal's algorithm or Prim's algorithm) can be applied to construct a tree structure. This tree structure preserves the primary connections in the data while removing redundant and secondary connections.
[0105] Hierarchical clustering is a clustering method that constructs a hierarchical tree structure. It progressively merges or splits clusters based on the similarity (or distance) between data points until a stopping condition is met. For example, rows or columns of a relation matrix can be treated as data points, and similarity can be calculated based on the elements in the matrix. Then, a hierarchical clustering algorithm (such as single-chain, full-chain, or average-chain) is applied to generate a tree structure that reflects the hierarchical relationships between the data points.
[0106] For example, a Python programming environment can be used to construct relational matrices and tree structures. For instance, a Python 3.x version can be used. Python is a high-level programming language known for its concise syntax, rich library support, and strong community support. Using a Python programming environment to construct relational matrices and tree structures allows full utilization of Python's rich libraries and tools, such as NumPy, Pandas, and Scikit-learn, which provide efficient data processing and analysis capabilities.
[0107] In some embodiments, setting a depth attribute value for each tag node includes:
[0108] For tag nodes that are root nodes, set their depth attribute value to 0;
[0109] For child nodes of the tag node that is a root node, set their depth attribute value to 1;
[0110] For any tag node, its depth attribute value is equal to the depth attribute value of its parent node plus 1;
[0111] By recursively setting the depth attribute value of each tag node layer by layer according to the parent-child relationship, the depth attribute value of all tag nodes in the original tag set is determined.
[0112] For example, the root node typically has a depth attribute value of 0, its child nodes have a depth attribute value of 1, its grandchild nodes have a depth attribute value of 2, and so on. To dynamically and accurately calculate the depth attribute value of tag nodes, it is necessary to traverse all tag nodes in the original tag set. Starting from the root node, proceeding downwards layer by layer, assign a corresponding depth value to each node. This process can be accomplished using recursive or iterative algorithms, determining the depth attribute value based on the node's parent node information.
[0113] In some embodiments, the step of setting the depth attribute for each tag node further includes: if the tree structure changes, recalculating the depth attribute value of each tag node based on the position of each tag node in the changed tree structure.
[0114] In a multi-level tagging system, tags are typically organized in a tree structure, where the root node represents the top-level tag category, and child nodes represent more specific tags or subcategories. This structure clearly demonstrates the hierarchical and subordinate relationships between tags.
[0115] The depth attribute value refers to the hierarchical position of a tag node within a tree structure. It not only statically reflects the hierarchical structure and logical relationships of the data but also adapts to dynamic changes in the tree structure. For example, the root node typically has a depth attribute value of 0, its child nodes have a depth attribute value of 1, its grandchild nodes have a depth attribute value of 2, and so on. To dynamically and accurately calculate the depth attribute value of tag nodes, if the tree structure changes, the system needs to traverse the entire tree structure, starting from the root node and descending layer by layer, reallocating the corresponding depth attribute value to each node. In this process, the system can use recursive or iterative algorithms to traverse the tree structure and determine the depth attribute value based on the node's parent node information.
[0116] By setting depth attribute values for tag nodes, the hierarchical structure and logical relationships of the data can be reflected more accurately. This helps in building a more refined and complex tag system in subsequent steps to meet the needs of different application scenarios.
[0117] For example, in recommender systems, depth attribute values can help the system identify the hierarchical structure of user interests, thereby providing more personalized and accurate recommendations. In text classification, depth attribute values help the system understand the topic hierarchy of documents, improving the accuracy and efficiency of classification.
[0118] For example, depth attribute values can also be used for sorting and retrieving tag nodes. For instance, when displaying a tag system, the system can sort tags hierarchically based on depth attribute values, allowing users to more intuitively understand the hierarchical relationships between tags.
[0119] For example, when searching for specific tags, depth attribute values can be used to narrow down the search scope, improving search speed and accuracy. For instance, when a user needs to find a specific subcategory, the system can first locate its parent node and then search within its child nodes.
[0120] In practical applications, the tree structure may change due to the addition, deletion, or modification of tag nodes. To ensure the accuracy of depth attribute values, these values need to be updated dynamically. For example, when a tag node is added, its depth attribute value needs to be calculated and set; when a tag node is deleted, the depth attribute values of its child nodes and their descendants need to be updated; when the hierarchical relationship of tag nodes is modified, the depth attribute values of the relevant nodes need to be recalculated and updated. This dynamic update process ensures the flexibility and accuracy of the multi-level tag system.
[0121] In some embodiments, the multi-level tagging system is represented by a tree structure, where the root node is a tag node that is not in a parent-child relationship, and the child nodes are connected sequentially according to the parent-child relationship.
[0122] For example, a multi-level tagging system can be represented by a tree structure. The tree structure starts with the root node, and each node can have one or more child nodes. The child nodes are then connected sequentially according to the parent-child relationship to form a complete hierarchical structure.
[0123] In some embodiments, the method further includes: visually displaying the multi-level tagging system on a graphical user interface.
[0124] To facilitate user viewing and understanding of the multi-level tag system, it is visualized in a tree structure on a graphical user interface (GUI). This interface not only provides an intuitive visual presentation but also supports rich dynamic interactive functions to enhance the user experience.
[0125] Before depth-sorting, it is a tree structure; after depth-sorting, it is still a tree structure; the positions of all or some nodes in the sorted tree structure will change relative to the tree structure before sorting. When this multi-level tagging system is displayed visually, the user sees a tree structure.
[0126] The graphical user interface supports dynamic interactive features, such as allowing users to expand or collapse tag branches and view tag details. It also allows users to adjust the display style and layout of the tree structure through dragging, zooming, and other operations.
[0127] For example, users can expand or collapse their child nodes by clicking or double-clicking a tag node. This interaction method allows users to flexibly view tag information at different levels without having to display the entire tag system at once, thereby improving the usability and responsiveness of the interface.
[0128] For example, when a user selects a tag node, the GUI can display detailed information about that tag, such as the tag name, description, and associated data. This helps users gain a deeper understanding of the tag's content and purpose.
[0129] For example, to accommodate different user needs, the GUI interface also supports drag-and-drop and zoom operations. Users can drag to adjust the position of tab nodes for better organization and management of the tab system. Simultaneously, users can zoom to change the display ratio of the tree structure to suit different screen sizes or window sizes.
[0130] For example, the GUI interface can also provide other functions according to actual needs, such as tag search, tag editing, and tag deletion. These functions allow users to manage and use the multi-level tag system more flexibly.
[0131] To facilitate user input of tags and the display of a pre-built multi-level tag system, a simple graphical user interface (GUI) can be implemented using a Python GUI library (such as Tkinter). Python offers several GUI libraries, including Tkinter, PyQt, and wxPython. Tkinter is Python's standard GUI library, requiring no additional installation and suitable for quickly developing simple GUI applications. PyQt and wxPython, on the other hand, provide richer controls and functionalities, making them suitable for developing complex GUI applications. The choice of GUI library should be based on actual needs and application scenarios.
[0132] In some embodiments, the method further includes: updating the multi-level tagging system in response to a modification instruction for the multi-level tagging system; and recording different historical versions of the multi-level tagging system based on a version control mechanism.
[0133] For example, when a user or system administrator needs to modify the multi-level tagging system, the system receives and responds to these modification instructions. These instructions can include adding new tags, deleting existing tags, adjusting the hierarchical relationships or attributes between tags, etc. Then, based on these modification instructions, the system automatically updates the multi-level tagging system, ensuring its accuracy and timeliness. This update mechanism helps maintain the flexibility and adaptability of the tagging system to cope with constantly changing needs and business scenarios.
[0134] For example, to ensure the stability and traceability of the multi-level tagging system, a version control mechanism can be used to record different historical versions of the tagging system. Whenever the multi-level tagging system is modified or updated, the system should record a new version. Each version should contain complete information about the current tagging system, including tag nodes, relationship matrices, and tree structures. The system supports version comparison, allowing users to view the differences between versions. Simultaneously, the system supports version rollback, allowing users to restore the tagging system to a previous version when necessary. To facilitate user management and viewing of version information, the system can provide a version management interface that clearly displays information about all historical versions, including version number, modification time, and modified content, and supports user operations such as version comparison and rollback.
[0135] In some embodiments, in response to a modification instruction for a multi-level tagging system, updating the multi-level tagging system includes: parsing the modification instruction to determine the tag nodes to be modified and their relationships; updating the relationship matrix and tree structure according to the modification instruction; and reconstructing a new multi-level tagging system according to the updated relationship matrix and tree structure.
[0136] For example, when the system receives a modification instruction, it first parses it to determine which tag nodes and their relationships need to be modified. This includes identifying the specific tag to be modified, its current hierarchical position, and the relationship between it and other tags.
[0137] The relationship matrix is a data structure describing the relationships between tags, while the tree structure visually displays the hierarchical relationships between tags. The system updates the relationship matrix and tree structure based on the parsed modification instructions, such as modifying the values of corresponding elements in the relationship matrix and adjusting the position or hierarchical relationship of tag nodes in the tree structure.
[0138] Then, based on the updated relation matrix and tree structure, the multi-level labeling system is reconstructed or updated to ensure the consistency and accuracy of the system, so that the modified labeling system can still accurately reflect the structure and characteristics of the data source.
[0139] In some embodiments, the method further includes: optimizing the multi-level labeling system by deleting redundant labels or merging similar labels to obtain an optimized multi-level labeling system; or periodically updating the multi-level labeling system based on updated source data to obtain an updated multi-level labeling system.
[0140] One approach is to optimize the multi-level labeling system by removing redundant labels or merging similar labels, resulting in an optimized multi-level labeling system. For example, during the construction of a multi-level labeling system, redundant or similar labels may arise due to various reasons (such as data noise, human annotation errors, and inaccurate label extraction algorithms). These redundant or similar labels not only increase the complexity of the system but may also lead to classification confusion and errors. Therefore, further optimization of the multi-level labeling system is necessary.
[0141] Redundant tags refer to those tags that have no practical use in the overall multi-level tagging system or are highly repetitive with other tags. These tags not only consume system resources but may also interfere with normal user operation. By removing redundant tags, the multi-level tagging system can be simplified, improving system efficiency and accuracy.
[0142] Similar tags refer to tags that are semantically close or similar. While these tags are not entirely identical, they are often interchangeable in practical applications. Merging similar tags reduces the number of tags and improves tag coverage and accuracy. Furthermore, merging similar tags helps reduce system complexity and enhances the user experience.
[0143] When optimizing tags, appropriate methods and tools are needed to identify and judge redundant and similar tags. For example, Natural Language Processing (NLP) techniques can be used to analyze the semantic similarity of tags, or clustering algorithms can be used to discover clusters of similar tags. For instance, semantic similarity analysis algorithms in NLP can calculate the semantic similarity between tags. When the semantic similarity of two tags exceeds a certain threshold, they can be considered similar and merged. For example, part-of-speech tagging and dependency parsing can further help understand the grammatical roles and semantic relationships of tags in sentences, aiding in a more accurate assessment of tag similarity and redundancy. For situations with a large number of tags and a relatively even distribution, the K-means clustering algorithm can be used to cluster similar tags into the same cluster, thereby discovering clusters of similar tags.
[0144] For example, a hierarchical clustering algorithm can be used to generate a hierarchical clustering tree, and similar labels can be merged into one level by setting an appropriate threshold.
[0145] For example, appropriate optimization strategies need to be developed based on actual application scenarios and requirements to ensure that the optimized multi-level tagging system is both concise and accurate. For instance, tags can be prioritized based on factors such as usage frequency and importance, with priority given to optimizing those that are frequently used and highly important, ensuring the efficiency and effectiveness of the optimization work. For large-scale multi-level tagging systems, a phased optimization strategy can be adopted, first optimizing a subset of tags, observing the optimization effects and user feedback, and then gradually extending it to the entire multi-level tagging system. Furthermore, when judging tag similarity and redundancy, the context in which the tag exists needs to be considered; for example, the same tag may have different meanings and uses in different business scenarios or data sources.
[0146] This process involves periodically updating the multi-level tagging system based on the updated source data. For example, as the source data is continuously updated and changes, the multi-level tagging system also needs corresponding adjustments and optimizations. Periodic updates are a crucial means of ensuring that the multi-level tagging system remains synchronized with the source data.
[0147] For example, a suitable periodic update strategy can be formulated based on the frequency of changes in the source data and business needs. For instance, the tag system can be updated daily, weekly, or monthly. During the update process, it is necessary to re-acquire the tag set corresponding to the source data and reconstruct and optimize the tag system based on the new tag set.
[0148] For example, updating a multi-level labeling system requires rigorous verification and adjustment. This includes verifying the correctness of the relationship between new and existing labels, checking for new redundant or similar labels, and adjusting the hierarchical structure of the labeling system. Through verification and adjustment, it can be ensured that the updated multi-level labeling system is both accurate and meets actual needs.
[0149] For example, in addition to periodic updates, user feedback can be collected, and the multi-level tagging system can be continuously optimized based on this feedback. For instance, user feedback on satisfaction, usage frequency, and suggestions regarding the multi-level tagging system can be gathered, and adjustments and improvements can be made based on this feedback. Through continuous optimization, the usability and user experience of the multi-level tagging system can be constantly improved.
[0150] By deleting redundant labels, merging similar labels, and periodically updating based on updated source data, the quality and efficiency of the multi-level labeling system can be continuously improved to meet the needs of practical applications.
[0151] In some embodiments, the system can also support the construction of a multilingual tagging system, enabling tags to contain text in multiple languages to meet internationalization requirements. For example, the system can have a built-in multilingual recognition and processing mechanism, automatically detect and correctly process tag input in different languages, and provide translation and mapping functions to ensure the accuracy and consistency of tags in different language environments.
[0152] In some embodiments, synonym management can also be implemented, merging semantically similar but differently expressed tags under the same tag to improve the consistency of the tag system. By merging semantically similar but differently expressed tags under the same tag, tag redundancy is effectively reduced, improving the cleanliness and consistency of the tag system. This function can accurately identify and merge synonym tags based on natural language processing technologies (such as semantic analysis, text similarity calculation, etc.), ensuring the accuracy and rationality of the merging process.
[0153] In some embodiments, in the above Figure 2 Based on the corresponding embodiments, in another optional embodiment of the tag system construction method provided in this application, such as... Figure 3 As shown, the training steps for the prediction model may include the following steps S31 to S35:
[0154] S31, Obtain the training dataset. Each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair.
[0155] The training dataset D consists of multiple training samples. Each training sample contains a sample label pair (label_A, label_B) and the true hierarchical relationship between the two sample labels in the label pair. The true hierarchical relationship can be no relationship (0), parent-child relationship (1), or child-parent relationship (2). For example, there is a training dataset D = {(x1,y1),(x2,y2),...,(xi,yi),…,(xn,yn)}, where (xi,yi) represents a training sample, xi = (label_Ai,label_Bi) represents a sample label pair, and yi ∈ {0,1,2} represents the true hierarchical relationship between the sample label pairs (0 represents no relationship, 1 represents a parent-child relationship, and 2 represents a child-parent relationship).
[0156] The training data needs to be manually labeled or obtained through other reliable means to ensure the accuracy of the true hierarchical relationships. The training data can come from existing classification systems, expert annotations, or the output of automated label extraction algorithms.
[0157] S32, the sample labels in each training sample are input into the pre-trained model to predict the relationship, and the probability value of each sample label pair belonging to each level of relationship is obtained.
[0158] For example, BERT is chosen as the pre-trained model. BERT is a pre-trained language model based on the Transformer architecture, capable of capturing bidirectional contextual information in text and performing excellently on natural language processing tasks. Then, the sample label pair xi = (label_Ai, label_Bi) from each training sample is input into the BERT model. The model will output the probability distribution pi = [p(i|0), p(i|1), p(i|2)] of the sample label pair belonging to each hierarchical relationship, where p(i|0) represents the probability that the sample label pair belongs to no relationship, p(i|1) represents the probability that the sample label pair belongs to a parent-child relationship, and p(i|2) represents the probability that the sample label pair belongs to a child-parent relationship.
[0159] One approach is to use open-source machine learning model libraries, such as the Transformers library, to load pre-trained BERT models and fine-tune them to suit specific label relationship classification tasks.
[0160] S33. Based on the probability values of each sample label pair belonging to each hierarchical relationship, select the hierarchical relationship corresponding to the highest probability value as the predicted hierarchical relationship between the two sample labels in each sample label pair.
[0161] For each training sample, the hierarchical relationship corresponding to the highest probability value among the hierarchical relationship probabilities is selected as the predicted hierarchical relationship between the two sample labels in that sample label pair. For example, if the value of p(i|1) is the largest, then the predicted hierarchical relationship between sample label_Ai and sample label_Bi in that sample label pair is a parent-child relationship. This step converts the model's output into a specific predicted hierarchical relationship so that it can be compared with the true hierarchical relationship.
[0162] S34, based on the loss value between the predicted hierarchical relationship and the true hierarchical relationship between the two sample labels in each sample label pair.
[0163] For example, the cross-entropy loss function can be used to calculate the loss between the predicted hierarchical relationship and the actual hierarchical relationship. The loss value reflects the accuracy of the model's prediction; the smaller the loss value, the more accurate the model's prediction. The loss value is the objective of model optimization; the model's parameters are updated by minimizing the loss value.
[0164] S35, adjust the model parameters of the pre-trained model according to the loss value until the loss value reaches the preset threshold or the number of training times reaches the preset upper limit, and obtain the prediction model.
[0165] For example, the backpropagation algorithm and optimizer can be used to adjust the model parameters of the BERT model based on the loss value. Through multiple iterations of training, the model gradually learns the complex relationship patterns between label pairs.
[0166] The training process terminates when the loss value reaches a preset threshold or the number of training iterations reaches a preset limit. At this point, the resulting model is the prediction model, which can accurately predict the relationship between label pairs.
[0167] Besides BERT, other pre-trained models such as GPT and RoBERTa can be considered to achieve three-class classification of hierarchical relationships between two labels in a label pair. Different models can show different performance on different tasks and datasets.
[0168] GPT (Generative Pre-trained Transformer) is a generative pre-trained model based on the Transformer architecture, which performs exceptionally well on natural language generation tasks. Unlike BERT, GPT is unidirectional, primarily focusing on text generation capabilities. However, by fine-tuning the GPT model, its language understanding capabilities can still be leveraged to perform three-class classification of hierarchical relationships between two labels in a label pair. The GPT model is suitable for tasks requiring text generation or sequence prediction, such as text classification and question answering systems. In the three-class classification of label hierarchical relationships, GPT can be used to predict the order relationship between two labels in a label pair.
[0169] RoBERTa (A Robustly Optimized BERT Pretraining Approach) is an improved version of BERT. Through longer pre-training time and a more optimized training strategy, RoBERTa achieves better performance on multiple natural language processing tasks. RoBERTa has demonstrated superior performance on various NLP tasks, especially in text classification and sequence labeling. In the three-class classification of label hierarchical relationships, RoBERTa can serve as a powerful base model for fine-tuning to identify complex label relationships.
[0170] In addition to deep learning models, other machine learning or deep learning methods, such as support vector machines (SVM), decision trees, and convolutional neural networks (CNN), can be used to achieve three-class classification of hierarchical relationships between labels.
[0171] Support Vector Machine (SVM) is a classification method based on statistical learning theory. It separates data points of different classes by finding an optimal hyperplane.
[0172] Decision trees are an intuitive classification method that builds a tree-like model by recursively partitioning a dataset.
[0173] Convolutional Neural Networks (CNNs) are a type of deep learning method primarily used for image processing and computer vision tasks. By combining word embeddings and convolutional operations, CNNs can capture both local and global features in text, making them suitable for tasks such as text classification and relation extraction.
[0174] To better illustrate the tag system construction method of this application, this application also provides examples of application scenarios such as text content topic hierarchical system construction, product category tag hierarchical system construction, and knowledge graph construction.
[0175] Regarding the construction of a hierarchical text content thematic system: For example, a multi-level tagging system is a hierarchical system for text content thematics. News, blogs, forums, and other content platforms generate a large amount of text data daily. This data needs to be effectively classified and organized to facilitate user search and reading. Source data can be obtained by scraping news articles, blog posts, forum discussions, etc., from content platforms. Then, natural language processing techniques can be used to extract keywords or phrases as candidate tags from the text data, or an original tag set can be obtained from the platform's existing classification system. Next, a trained prediction model is used to predict each tag pair in the original tag set, obtaining the prediction hierarchy between the two tags in each tag pair. A relationship matrix is constructed based on the prediction hierarchy between the two tags in each tag pair. Based on the relationship matrix, by identifying the root node, recursively searching for child nodes, constructing a tree structure, and sorting by depth, a hierarchical text content thematic system (multi-level tagging system) is built, classifying news articles, blog posts, etc., into different themes and sub-themes. By building a multi-level tagging system, content platforms can more accurately classify and organize text data, improve the efficiency of users' search and reading, and also help with the platform's content recommendation and personalized services.
[0176] Regarding the construction of a hierarchical system for product classification tags: For example, a multi-level tag system is a hierarchical system for product classification tags. E-commerce platforms offer a wide variety of products, requiring effective classification and organization to facilitate user search and purchase. Product information (such as product name, description, and images) can be scraped from the e-commerce platform as source data; keywords or phrases can be extracted from product descriptions as candidate tags, or an original tag set can be obtained from the platform's existing classification system. Then, a trained prediction model is used to predict each tag pair in the original tag set, obtaining the prediction hierarchy relationship between the two tags in each tag pair. A relationship matrix is constructed based on the prediction hierarchy relationship between the two tags in each tag pair. Based on the relationship matrix, by identifying the root node, recursively searching for child nodes, constructing a tree structure, and sorting by depth, a hierarchical tag system for product classification (a multi-level tag system) is built, classifying products into different categories and subcategories. By constructing a multi-level tag system, e-commerce platforms can more accurately classify and organize products, improving the efficiency of user search and purchase, and also contributing to product recommendations and personalized marketing on the platform.
[0177] Regarding knowledge graph construction: For example, a multi-level tagging system is a hierarchical system for knowledge graphs. In the process of constructing a knowledge graph, entities and relationships need to be classified to facilitate knowledge representation and reasoning. For instance, in the construction of a knowledge graph in the medical field, entities and relationships such as diseases, symptoms, and treatment methods need to be classified. Entities and relationships can be extracted from various knowledge sources (such as domain data, academic papers, patent documents, online encyclopedias, etc.) as source data. For example, entities and their relationships related to diseases, symptoms, and treatment methods can be collected from medical literature, databases, etc. Keywords or phrases can be extracted from the descriptions of entities and relationships as candidate labels, or an original label set can be obtained from an existing knowledge classification system. For example, a flat label set can be obtained based on existing classification labels in the medical field or an artificially defined initial label set. Then, each label pair in the original label set is used to perform prediction processing using a trained prediction model to obtain the predicted hierarchical relationship between the two labels in each label pair. A relationship matrix is constructed based on the predicted hierarchical relationship between the two labels in each label pair. Based on the relationship matrix, a hierarchical system (multi-level label system) of the knowledge graph is constructed by identifying the root node, recursively searching for child nodes, constructing a tree structure, and sorting by depth, thereby classifying entities and relationships into different categories and subcategories. By constructing a multi-level tagging system, knowledge graphs can more accurately represent the hierarchical structure of entities and relationships, improve the ability to represent and reason about knowledge, and also facilitate knowledge search and recommendation. For example, knowledge graphs based on the medical field can improve the convenience for doctors to search for diseases.
[0178] All of the above technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.
[0179] This application embodiment obtains source data for the label system to be constructed; obtains the original label set corresponding to the source data, the original label set including at least one label pair; performs prediction processing on each label pair in the original label set based on the prediction model to obtain the predicted hierarchical relationship between the two labels in each label pair, and constructs a relation matrix through the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained based on the training dataset, and each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair; based on the relation matrix, by traversing the relation matrix, identifies the labels belonging to the root node in the original label set, and searches for the labels belonging to the child nodes in the original label set starting from the root node. A tree structure is constructed by the root node and the found child nodes. By performing depth sorting on the labels in the tree structure, a multi-level label system corresponding to the source data is formed. This application's embodiments utilize a predictive model to predict the hierarchical relationship between the two tags in each tag pair of the original tag set. Then, based on the predicted hierarchical relationship between the two tags in each tag pair, a relationship matrix is constructed. This automatically determines the hierarchical relationship between tags (parent-child, child-parent, or no relationship), greatly reducing the workload of manual intervention and improving work efficiency. Based on the constructed relationship matrix, a multi-level tag system with hierarchical relationships is accurately built, improving classification accuracy and overall data processing efficiency.
[0180] To facilitate better implementation of the label system construction method of this application, this application also provides a label system construction apparatus. Please refer to... Figure 4 , Figure 4 This is a schematic diagram of the structure of a label system construction apparatus provided in an embodiment of this application. The label system construction apparatus 200 may include:
[0181] The first acquisition unit 210 is used to acquire the source data of the tag system to be constructed;
[0182] The second acquisition unit 220 is used to acquire the original label set corresponding to the source data, wherein the original label set includes at least one label pair.
[0183] The processing unit 230 is used to perform prediction processing on each label pair in the original label set based on the prediction model, to obtain the predicted hierarchical relationship between the two labels in each label pair, and to construct a relationship matrix through the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained based on the training dataset, and each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair.
[0184] The construction unit 240 is used to identify the labels belonging to the root node in the original label set by traversing the relation matrix, and to find the labels belonging to the child nodes in the original label set starting from the root node. A tree structure is constructed by the root node and the found child nodes. By performing depth sorting on the labels in the tree structure, a multi-level label system corresponding to the source data is formed.
[0185] In some embodiments, the processing unit 230 is configured to: predict each label pair in the original label set into the prediction model to obtain the probability value of each label pair belonging to each hierarchical relationship; select the hierarchical relationship corresponding to the highest probability value as the predicted hierarchical relationship between the two labels in each label pair according to the probability value of each label pair belonging to each hierarchical relationship; and construct a relationship matrix according to the predicted hierarchical relationship between the two labels in each label pair in the original label set.
[0186] In some embodiments, the predicted hierarchical relationships include no relationship, parent-child relationship, and child-parent relationship, wherein parent-child relationship and child-parent relationship are two different hierarchical relationships; the actual hierarchical relationships include no relationship, parent-child relationship, and child-parent relationship.
[0187] In some embodiments, each tag in the original tag set corresponds to a tag node; the construction unit 240 is configured to: traverse the relationship matrix and identify tag nodes that are not in a parent-child relationship as root nodes; starting from the root node, recursively search for the child nodes of each tag node according to the parent-child relationship in the relationship matrix, and set a depth attribute value for each tag node, wherein the depth attribute value of each tag node represents the hierarchical position of each tag node in the tree structure; connect each tag node to its parent node and / or child node according to the depth attribute value of each tag node to form a tree structure; sort all tag nodes in the tree structure in descending order of the depth attribute value of each tag node in the tree structure; and form a multi-level tag system with hierarchical relationships corresponding to the source data based on the sorted tree structure.
[0188] In some embodiments, when setting the depth attribute value for each tag node, the construction unit 240 performs the following steps: for tag nodes belonging to the root node, sets their depth attribute value to 0; for child nodes of tag nodes belonging to the root node, sets their depth attribute value to 1; for any tag node, its depth attribute value is equal to the depth attribute value of its parent node plus 1; and recursively sets the depth attribute value of each tag node layer by layer according to the parent-child relationship until the depth attribute values of all tag nodes in the original tag set are determined.
[0189] In some embodiments, when setting the depth attribute for each tag node, the building unit is further configured to: if the tree structure changes, recalculate the depth attribute value of each tag node based on the position of each tag node in the changed tree structure.
[0190] In some embodiments, the tag system construction apparatus 200 further includes a display unit for: visually displaying the multi-level tag system on a graphical user interface.
[0191] In some embodiments, the construction unit 240 is further configured to: update the multi-level tag system in response to a modification instruction for the multi-level tag system; and record different historical versions of the multi-level tag system based on a version control mechanism.
[0192] In some embodiments, the construction unit 240 is further configured to: optimize the multi-level tag system by deleting redundant tags or merging similar tags to obtain an optimized multi-level tag system; or periodically update the multi-level tag system based on the updated source data to obtain an updated multi-level tag system.
[0193] In some embodiments, the label system construction device 200 further includes a training unit, configured to: acquire a training dataset, wherein each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair; input the sample label pair in each training sample into a pre-trained model to predict the relationship, thereby obtaining the probability value of each sample label pair belonging to each hierarchical relationship; select the hierarchical relationship corresponding to the highest probability value as the predicted hierarchical relationship between the two sample labels in each sample label pair based on the probability value of each sample label pair belonging to each hierarchical relationship; calculate the loss value between the predicted hierarchical relationship between the two sample labels in each sample label pair and the true hierarchical relationship; and adjust the model parameters of the pre-trained model based on the loss value until the loss value reaches a preset threshold or the number of training iterations reaches a preset upper limit, thereby obtaining a prediction model.
[0194] In some embodiments, the source data includes at least one of multimedia resources, text content, product information, and knowledge entries.
[0195] It should be noted that the functions of each module in the tag system construction device 200 in this application embodiment can be referred to the specific implementation of any embodiment in the above method embodiments, and will not be repeated here.
[0196] Each unit in the above-described device can be implemented entirely or partially through software, hardware, or a combination thereof. Each unit can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each unit.
[0197] For example, the tag system construction device 200 can be integrated into a terminal or server that has storage and a processor and thus computing power, or the tag system construction device 200 can be the terminal or server.
[0198] In some embodiments, this application also provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0199] Figure 5 A schematic structural diagram of the computer device provided in the embodiments of this application, such as Figure 5 As shown, the computer device 300 may include: a communication interface 301, a memory 302, a processor 303, and a communication bus 304. The communication interface 301, memory 302, and processor 303 communicate with each other via the communication bus 304. The communication interface 301 is used for data communication between the device 300 and external devices. The memory 302 can be used to store software programs and modules, and the processor 303 runs the software programs and modules stored in the memory 302, such as the software programs for the corresponding operations in the aforementioned method embodiments.
[0200] In some embodiments, the processor 303 may invoke software programs and modules stored in the memory 302 to perform the following operations: obtain source data for the label system to be constructed; obtain the original label set corresponding to the source data, the original label set including at least one label pair; perform prediction processing on each label pair in the original label set based on the prediction model to obtain the predicted hierarchical relationship between the two labels in each label pair, and construct a relation matrix through the predicted hierarchical relationship between the two labels in each label pair, wherein the prediction model is trained based on the training dataset, each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair; identify the labels belonging to the root node in the original label set by traversing the relation matrix, find the labels belonging to the child nodes in the original label set starting from the root node, construct a tree structure by the root node and the found child nodes, and form a multi-level label system corresponding to the source data by performing depth sorting on the labels in the tree structure.
[0201] In some embodiments, the computer device 300 may be integrated into a terminal or server that has storage and a processor and thus computing power, or the computer device 300 may be the terminal or server.
[0202] This application also provides a computer-readable storage medium for storing a computer program. This computer-readable storage medium can be applied to a computer device, and the computer program causes the computer device to execute the corresponding processes in the methods described above in the embodiments of this application; for brevity, further details are omitted here.
[0203] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding processes in the methods described above in the embodiments of this application. For brevity, these details will not be elaborated further here.
[0204] This application also provides a computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding processes in the methods described above in the embodiments of this application. For brevity, these details will not be elaborated further here.
[0205] It should be understood that the processor in the embodiments of this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0206] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0207] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0208] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0209] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0210] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0211] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0212] In addition, the functional units in the embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0213] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer or a server) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0214] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for constructing a tag system, characterized in that, The method includes: Obtain the source data for the tag system to be built; Obtain the original tag set corresponding to the source data, wherein the original tag set includes at least one tag pair; Based on the prediction model, each label pair in the original label set is predicted to obtain the predicted hierarchical relationship between the two labels in each label pair. A relationship matrix is constructed based on the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained on the training dataset. Each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair. By traversing the relation matrix, the labels belonging to the root node in the original label set are identified. Starting from the root node, the labels belonging to the child nodes in the original label set are searched. A tree structure is constructed from the root node and the found child nodes. By performing depth sorting on the labels in the tree structure, a multi-level label system corresponding to the source data is formed.
2. The label system construction method as described in claim 1, characterized in that, The prediction model is used to predict each tag pair in the original tag set to obtain the prediction hierarchy relationship between the two tags in each tag pair. A relationship matrix is then constructed based on the prediction hierarchy relationship between the two tags in each tag pair, including: Each label in the original label set is input into the prediction model to predict the probability value of each label pair belonging to each hierarchical relationship. Based on the probability value of each label pair belonging to each hierarchical relationship, the hierarchical relationship corresponding to the highest probability value is selected as the predicted hierarchical relationship between the two labels in each label pair; A relationship matrix is constructed based on the predicted hierarchical relationship between the two labels in each label pair of the original label set.
3. The label system construction method as described in claim 2, characterized in that, The predicted hierarchical relationships include no relationship, parent-child relationship, and child-parent relationship, where parent-child relationship and child-parent relationship are two different hierarchical relationships; The actual hierarchical relationships include no relationship, parent-child relationship, and child-parent relationship.
4. The label system construction method as described in claim 2, characterized in that, Each tag in the original tag set corresponds to a tag node; The process involves traversing the relation matrix to identify labels belonging to the root node in the original label set, searching for labels belonging to child nodes from the original label set starting from the root node, constructing a tree structure from the root node and the found child nodes, and performing depth-ordering on the labels in the tree structure to form a multi-level label system corresponding to the source data, including: Traverse the relationship matrix and identify the tag nodes that are not in a parent-child relationship as the root nodes; Starting from the root node, the child nodes of each tag node are recursively searched according to the parent-child relationship in the relationship matrix, and a depth attribute value is set for each tag node. The depth attribute value of each tag node represents the hierarchical position of each tag node in the tree structure. Based on the depth attribute value of each tag node, each tag node is connected to its parent node and / or child node to form a tree structure; Sort all the tag nodes in the tree structure in descending order of their depth attribute values; Based on the sorted tree structure, a multi-level label system with hierarchical relationships is formed corresponding to the source data.
5. The label system construction method as described in claim 4, characterized in that, Setting the depth attribute value for each tag node includes: For tag nodes that are root nodes, set their depth attribute value to 0; For child nodes of the tag node that is a root node, set their depth attribute value to 1; For any tag node, its depth attribute value is equal to the depth attribute value of its parent node plus 1; By recursively setting the depth attribute value of each tag node layer by layer according to the parent-child relationship, the depth attribute value of all tag nodes in the original tag set is determined.
6. The label system construction method as described in claim 5, characterized in that, The step of setting the depth attribute value for each tag node also includes: If the tree structure changes, the depth attribute value of each tag node is recalculated based on the position of each tag node in the changed tree structure.
7. The label system construction method as described in claim 4, characterized in that, The method further includes: The multi-level tagging system is visualized on a graphical user interface.
8. The label system construction method as described in claim 1, characterized in that, The method further includes: In response to a modification instruction for the multi-level tagging system, update the multi-level tagging system; The version control mechanism records different historical versions of the multi-level tag system.
9. The label system construction method as described in claim 1, characterized in that, The method further includes: The multi-level tagging system is optimized by deleting redundant tags or merging similar tags to obtain an optimized multi-level tagging system; or Based on the updated source data, the multi-level tagging system is periodically updated to obtain the updated multi-level tagging system.
10. The label system construction method according to any one of claims 1-9, characterized in that, The training of the prediction model includes: Obtain a training dataset, wherein each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair; The sample labels in each training sample are input into the pre-trained model to predict the relationship, and the probability value of each sample label pair belonging to each level of relationship is obtained. Based on the probability value of each sample label pair belonging to each hierarchical relationship, the hierarchical relationship corresponding to the highest probability value is selected as the predicted hierarchical relationship between the two sample labels in each sample label pair; The loss value is based on the predicted hierarchical relationship between the two sample labels in each sample label pair and the true hierarchical relationship; The model parameters of the pre-trained model are adjusted according to the loss value until the loss value reaches a preset threshold or the number of training iterations reaches a preset upper limit, thus obtaining the prediction model.
11. The label system construction method according to any one of claims 1-9, characterized in that, The source data includes at least one of multimedia resources, text content, product information, and knowledge entries.
12. A label system construction device, characterized in that, The device includes: The first acquisition unit is used to acquire the source data of the tag system to be built; The second acquisition unit is used to acquire the original tag set corresponding to the source data, wherein the original tag set includes at least one tag pair; The processing unit is used to perform prediction processing on each label pair in the original label set based on the prediction model, to obtain the predicted hierarchical relationship between the two labels in each label pair, and to construct a relationship matrix through the predicted hierarchical relationship between the two labels in each label pair. The prediction model is trained based on the training dataset, and each training sample in the training dataset includes a sample label pair and the true hierarchical relationship between the two sample labels in the sample label pair. The construction unit is used to identify the tags belonging to the root node in the original tag set by traversing the relation matrix, search for the tags belonging to the child nodes in the original tag set starting from the root node, construct a tree structure by the root node and the found child nodes, and form a multi-level tag system corresponding to the source data by performing depth sorting on the tags in the tree structure.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to execute the tag system construction method as described in any one of claims 1-11.
14. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program, and the processor executing the label system construction method as described in any one of claims 1-11 by calling the computer program stored in the memory.
15. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the tag system construction method according to any one of claims 1-11.