Semantic label acquisition method and apparatus, node device, and storage medium
By using machine learning models to extract semantic features and contextual information of target fields in relational databases, the problem of inconsistent naming of specified fields in different information systems is solved, and highly accurate automatic recognition of semantic tags is achieved, which is suitable for accurate matching of multi-source heterogeneous relational patterns.
Patent Information
- Application Number
- CN202010984552.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-18
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2040-12-07
AI Technical Summary
In the existing technology, the lack of a unified naming standard in the Internet or other information systems leads to different names for the same semantic field in different information systems, making it difficult to identify the semantic tags of the specified field, especially in multi-source heterogeneous relational patterns where it is difficult to accurately identify the correspondence between fields.
By retrieving data items of the target field from a relational database, using machine learning models such as BERT for bidirectional encoding, and combining the contextual information of the target field, semantic features are extracted and semantic labels are obtained, thus avoiding rule-based methods and achieving automated and highly accurate semantic label recognition.
It improves the recognition accuracy of semantic tags, can be widely applied to various general semantic category recognition scenarios, breaks the business limitations of rule-based methods, and improves the recognition accuracy of semantic tags.
Smart Images

Figure CN112163428B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technology, and in particular to a method, apparatus, node device, and storage medium for obtaining semantic tags. Background Technology
[0002] With the development of database technology, the semantic labeling of specified fields in relational databases has become fundamental to numerous data analysis tasks. For example, in pattern matching, accurate semantic labels can help infer the correspondence between different fields in multi-source heterogeneous relational schemas. Currently, the lack of a unified naming convention for relational data in the internet and other information systems leads to different names for the same semantically defined field in different systems, and these names often suffer from ambiguity. This poses a significant challenge to the identification of semantic labels for specified fields. Therefore, accurately identifying the semantic labels of specified fields has become an urgent problem to be solved. Summary of the Invention
[0003] This application provides a method, apparatus, node device, and storage medium for acquiring semantic tags, which can accurately identify the semantic tags of a specified field. The technical solution is as follows:
[0004] On the one hand, a method for obtaining semantic tags is provided, which includes:
[0005] Retrieve at least one data item corresponding to the target field to be identified in a relational database;
[0006] Based on the at least one data item, obtain the semantic features of the target field;
[0007] The semantic features are processed to obtain the semantic tags of the target field.
[0008] On the one hand, a semantic tag acquisition device is provided, the device comprising:
[0009] The first acquisition module is used to acquire at least one data item corresponding to the target field to be identified in the relational database;
[0010] The second acquisition module is used to acquire the semantic features of the target field based on the at least one data item;
[0011] The third acquisition module is used to process the semantic features and acquire the semantic tags of the target field.
[0012] In one possible implementation, the second acquisition module includes:
[0013] The first encoding unit is used to call the first translation model to encode the at least one data item to obtain the semantic features. The first translation model is used to obtain the semantic features based on the at least one data item.
[0014] In one possible implementation, the first encoding unit is used to:
[0015] The at least one data item is segmented to obtain a first segmentation sequence including at least one character, wherein the at least one character includes a classifier and characters obtained from the segmentation of the at least one data item;
[0016] The first word segmentation sequence is input into at least one bidirectional encoding layer in the first translation model. The first word segmentation sequence is forward encoded and backward encoded by the at least one bidirectional encoding layer to output a first semantic vector sequence. In the first semantic vector sequence, one first semantic vector corresponds to one character in the first word segmentation sequence.
[0017] The first semantic vector in the first semantic vector sequence that corresponds to the classifier is determined as the semantic feature.
[0018] In one possible implementation, the second acquisition module includes:
[0019] The first acquisition unit is used to acquire the context information of the target field, the context information including data items of other fields that correspond to the same relational data as the target field;
[0020] The second encoding unit is used to call the second translation model to encode the at least one data item and the context information to obtain the semantic features. The second translation model is used to obtain the semantic features based on the at least one data item and the context information.
[0021] In one possible implementation, the second encoding unit is used for:
[0022] The at least one data item and the context information are segmented to obtain a second segmentation sequence including at least one character, wherein the at least one character includes a classifier, a character obtained from the segmentation of the at least one data item and the context information, and a statement separator;
[0023] The second word segmentation sequence is input into at least one bidirectional encoding layer in the second translation model. The second word segmentation sequence is forward encoded and backward encoded by the at least one bidirectional encoding layer to output a second semantic vector sequence. In the second semantic vector sequence, one second semantic vector corresponds to one character in the second word segmentation sequence.
[0024] The second semantic vector in the second semantic vector sequence that corresponds to the classifier is determined as the semantic feature.
[0025] In one possible implementation, the third acquisition module includes:
[0026] The second acquisition unit is used to acquire at least one first prediction probability based on the semantic features, wherein the first prediction probability is used to represent the degree of matching between the semantic features and a semantic label;
[0027] The first determining unit is used to determine the semantic label corresponding to the largest first prediction probability among the at least one first prediction probabilities as the semantic label of the target field.
[0028] In one possible implementation, the device further includes:
[0029] The query module is used to query at least one candidate category corresponding to the at least one data item from the knowledge base, wherein one data item corresponds to one or more candidate categories;
[0030] An encoding module is used to encode the at least one candidate category to obtain the first category feature of the at least one data item;
[0031] The dimensionality reduction module is used to reduce the dimensionality of the first category feature of the at least one data item to obtain the second category feature of the at least one data item.
[0032] In one possible implementation, the third acquisition module includes:
[0033] The third acquisition unit is used to acquire the average embedding feature of the at least one data item;
[0034] The first splicing unit is used to splice the average embedding feature with the second category feature to obtain the first spliced feature;
[0035] The fourth acquisition unit is used to acquire the semantic label of the target field based on the first concatenation feature and the semantic feature.
[0036] In one possible implementation, the fourth acquisition unit is used for:
[0037] Based on the semantic features, at least one first prediction probability is obtained, and the first prediction probability is used to represent the degree of matching between the semantic features and a semantic label;
[0038] Based on the first splicing feature, at least one second prediction probability is obtained, and the second prediction probability is used to represent the degree of matching between the first splicing feature and a semantic label;
[0039] The at least one first prediction probability and the at least one second prediction probability are weighted respectively to obtain at least one third prediction probability;
[0040] The semantic label corresponding to the maximum third prediction probability among the at least one third prediction probabilities is determined as the semantic label of the target field.
[0041] In one possible implementation, the third acquisition module includes:
[0042] The second splicing unit is used to splice the second category feature with the semantic feature to obtain the second spliced feature;
[0043] The fifth acquisition unit is used to acquire at least one fourth prediction probability based on the second splicing feature, wherein the fourth prediction probability is used to represent the degree of matching between the second splicing feature and a semantic label;
[0044] The second determining unit is used to determine the semantic label corresponding to the maximum fourth prediction probability among the at least one fourth prediction probability as the semantic label of the target field.
[0045] On the one hand, a node device is provided, which includes one or more processors and one or more memories, wherein at least one piece of program code is stored in the one or more memories, and the at least one piece of program code is loaded and executed by the one or more processors to implement a semantic tag acquisition method as described in any of the possible implementations above.
[0046] On the one hand, a storage medium is provided that stores at least one piece of program code, which is loaded and executed by a processor to implement a method for obtaining semantic tags as described in any of the possible implementations above.
[0047] On one hand, a computer program product or computer program is provided, the computer program product or computer program comprising one or more lines of program code, the one or more lines of program code being stored in a computer-readable storage medium. One or more processors of a node device are capable of reading the one or more lines of program code from the computer-readable storage medium, the one or more processors executing the one or more lines of program code, enabling the node device to perform the semantic tag acquisition method of any of the above possible embodiments.
[0048] The beneficial effects of the technical solutions provided in this application include at least the following:
[0049] By targeting any field in a relational database and obtaining its semantic label based on the semantic features of each data item corresponding to that target field, the semantic label can be improved because the semantic features depend on each data item and will not change based on the name of the target field. Attached Figure Description
[0050] 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.
[0051] Figure 1 This is a schematic diagram illustrating the implementation environment of a semantic tag acquisition method provided in an embodiment of this application;
[0052] Figure 2 This is a flowchart of a method for obtaining semantic tags provided in an embodiment of this application;
[0053] Figure 3 This is a schematic diagram illustrating the principle of a semantic tag acquisition method provided in an embodiment of this application;
[0054] Figure 4 This is a flowchart of a method for obtaining semantic tags provided in an embodiment of this application;
[0055] Figure 5 This is a schematic diagram illustrating the principle of a first translation model provided in an embodiment of this application;
[0056] Figure 6 This is a flowchart of a method for obtaining semantic tags provided in an embodiment of this application;
[0057] Figure 7 This is a schematic diagram illustrating the principle of a second translation model provided in an embodiment of this application;
[0058] Figure 8 This is a flowchart of a method for obtaining semantic tags provided in an embodiment of this application;
[0059] Figure 9 This is a schematic diagram illustrating the principle of ontology class relationships in a knowledge base, provided in an embodiment of this application.
[0060] Figure 10 This is a schematic diagram of the structure of a semantic tag acquisition device provided in an embodiment of this application;
[0061] Figure 11 This is a schematic diagram of the structure of a node device provided in an embodiment of this application. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0063] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor are there any restrictions on quantity or execution order.
[0064] In this application, the term "at least one" means one or more, and "multiple" means two or more, for example, multiple first positions means two or more first positions.
[0065] Before introducing the embodiments of this application, it is necessary to introduce some basic concepts in the field of cloud technology:
[0066] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. It encompasses network technologies, information technologies, integration technologies, management platform technologies, and application technologies based on cloud computing business models. These technologies can form resource pools, allowing for on-demand, flexible, and convenient use. Cloud computing technology will become a crucial support in the cloud technology field. Backend services of technical network systems require substantial computing and storage resources, such as those for video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring data to be transmitted to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, all of which can be achieved through cloud computing.
[0067] Cloud storage is a new concept that has been extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that uses cluster applications, grid technology and distributed storage file systems to bring together a large number of storage devices of various types in the network (storage devices are also called storage nodes) to work together through application software or application interfaces to provide data storage and business access functions to the outside world.
[0068] A database can be simply viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, capable of being shared by multiple users, with minimal redundancy, and independent of application programs.
[0069] A relational database is a database that uses a relational model to organize data. It stores data in rows and columns for ease of understanding by users. These rows and columns are called tables, and a set of tables makes up the database. Users retrieve data from the database through queries, which are executable codes used to limit specific areas of the database. The relational model can be simply understood as a two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and the relationships between them. In short, a relational database is a database composed of multiple interconnected two-dimensional row-and-column tables. Currently, mainstream relational databases include Oracle, DB2, Microsoft SQL Server, Microsoft Access, and MySQL.
[0070] The aforementioned relational databases can be single-machine database systems, single-machine transaction-oriented database systems, single-machine analytical database systems that require transaction processing capabilities, distributed database systems, or distributed big data processing systems.
[0071] A database system may include at least one node device. Each node device's database may store multiple data tables, and each data table may be used to store one or more data items. The node device's database can be any type of relational database, such as Oracle, DB2, Microsoft SQL Server, Microsoft Access, MySQL, etc.
[0072] In some embodiments, the present application can also be applied to a database system based on blockchain technology (hereinafter referred to as "blockchain system"). The blockchain system is essentially a decentralized distributed database system. It uses a consensus algorithm to keep the ledger data recorded by different node devices on the blockchain consistent, uses a cryptographic algorithm to ensure the encrypted transmission and immutability of ledger data between different node devices, uses a script system to extend ledger functions, and uses network routing to connect different node devices.
[0073] A blockchain system can include one or more blockchains. A blockchain is a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and to generate the next block.
[0074] In a blockchain system, node devices can form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In a blockchain system, any node device can have the following functions: 1) Routing: A basic function of node devices used to support communication between nodes; 2) Applications: Deployed in the blockchain to implement specific business functions according to actual business needs. These applications record data related to the functionality, forming ledger data. The ledger data carries a digital signature to indicate the data's origin. The ledger data is sent to other node devices in the blockchain system, where other node devices, upon successful verification of the data's origin and integrity, add the ledger data to a temporary block. The business functions implemented by these applications can include wallets, shared ledgers, smart contracts, etc.; 3) Blockchain: Comprising a series of sequentially linked blocks. Once a new block is added to the blockchain, it is never removed. The blocks record the ledger data submitted by node devices in the blockchain system.
[0075] In some embodiments, each block may include the hash value of the transaction records stored in this block (the hash value of this block) and the hash value of the previous block. The blocks are connected by hash values to form a blockchain. In addition, the block may also include information such as the timestamp when the block was generated.
[0076] This application embodiment relates to the above-mentioned relational database. The relational database stores multiple data tables. Each row (i.e., each record) in the data table is called a tuple. Each column (i.e., each field) in the data table is called a relational attribute. The data items stored in each column are called relational attribute values. The column name of each column is the relational attribute name.
[0077] In relational databases, the identification of relational attribute semantics is fundamental to numerous data analysis tasks. For example, in pattern matching, accurate relational attribute semantics can help infer the correspondences between attributes in multi-source heterogeneous relational schemas. However, currently, relational data in the Internet and other information systems lacks a unified naming standard, and relational attribute names often suffer from ambiguity, posing a significant challenge to the semantic identification of relational attributes.
[0078] Currently, for certain writing standards or limited content related attributes, such as enterprise credit codes, email addresses, genders, and postal codes, rule-based methods such as regular expression matching can be used for identification. This rule-based approach can identify specific semantic categories and has wide applications in some business data analysis systems.
[0079] In the above process, taking regular expression matching as an example, it is necessary to perform semantic detection of specific categories of attributes according to manually set matching rules. This method is only applicable to some relational data with special writing forms. Therefore, this method can only meet the needs of specific data analysis systems for limited semantic category recognition, and has significant business limitations. It cannot be widely applied to general semantic category recognition.
[0080] In view of this, the embodiments of this application provide a method for obtaining semantic tags, which can automatically identify semantic tags of relational attributes (i.e., target fields) in relational databases, breaking the business limitations of using rule-based methods for semantic recognition, and can be widely applied to various general semantic category recognition scenarios with high accuracy.
[0081] Figure 1 This is a schematic diagram illustrating the implementation environment of a semantic tag acquisition method provided in this application. See also... Figure 1 Taking a distributed relational database system as an example, the system may include a gateway server 101, a distributed storage cluster 102, and a distributed coordination system 103 (such as ZooKeeper). The distributed storage cluster 102 may include multiple node devices, and these multiple node devices use a relational database for data storage.
[0082] The gateway server 101 is used to receive external read and write requests and distribute the read and write transactions corresponding to the read and write requests to the distributed storage cluster 102. For example, after a user logs in to the application client on the terminal, the application client is triggered to generate a read and write request and call the API (Application Programming Interface) provided by the distributed database system to send the read and write request to the gateway server 101. For example, the API can be the MySQL API (an API provided by a relational database system).
[0083] In some embodiments, the gateway server 101 can be merged with any node device in the distributed storage cluster 102 on the same physical machine, that is, a certain node device can act as the gateway server 101.
[0084] The distributed storage cluster 102 may include multiple node devices. Optionally, each node device can be a single machine or adopt a master-slave structure (i.e., a one-master-multiple-slave cluster), such as... Figure 1 As shown, an example of a cluster with one primary and two backup nodes is provided. Each node includes one primary and two backup nodes. Optionally, each primary or backup node is configured with an agent device. The agent device can be physically independent of the primary or backup node. Alternatively, the agent device can function as a proxy module on the primary or backup node. Taking node 1 as an example, node 1 includes one primary database and an agent device (primary Database + agent, abbreviated as primary DB + agent), as well as two backup databases and agent devices (backup Database + agent, abbreviated as backup DB + agent). It should be noted that both the primary and backup databases of the node device are relational databases.
[0085] In an exemplary scenario, the set of database instances corresponding to the host or standby machine for each node device is called a SET (set). For example, if a node device is a single-machine device, then the SET of that node device is only the database instance of that single-machine device. If a node device is a one-master-two-standby cluster, then the SET of that node device is the set of the host database instance and the two standby database instances. In this case, the strong synchronization technology of cloud database can be used to ensure the consistency between the data of the host and the replica data of the standby machines. Optionally, each SET can be linearly scaled to meet the business processing needs of big data scenarios. In some financial business scenarios, global transactions usually refer to cross-SET transfers.
[0086] The distributed coordination system 103 can be used to manage at least one of the gateway server 101 or the distributed storage cluster 102. Optionally, technicians can access the distributed coordination system 103 through a scheduler on a terminal, thereby controlling the backend distributed coordination system 103 based on the front-end scheduler to manage each cluster or server. For example, technicians can use the scheduler to control ZooKeeper to delete a node device from the distributed storage cluster 102, that is, to disable a node device.
[0087] The above Figure 1This only provides a lightweight global transaction processing architecture diagram, which is a type of distributed relational database system. The entire distributed relational database system can be viewed as jointly maintaining a large logical table. The data stored in this large table is distributed to various node devices in the distributed storage cluster 102 through the primary key. The data stored on each node device is independent of the data stored on other node devices, thereby realizing the horizontal partitioning of the logical large table by the node devices. Because the above system can horizontally partition and distribute the data tables in various databases, this system can also be figuratively called an architecture with "database sharding and table partitioning".
[0088] The semantic tag acquisition method provided in this application embodiment can be applied to the distributed relational database system that adopts the above-mentioned database sharding and table partitioning architecture. In addition, the semantic tag acquisition method provided in this application embodiment can also be applied to some single-machine relational database systems.
[0089] In some embodiments, the distributed database system comprised of the gateway server 101, the distributed storage cluster 102, and the distributed coordination system 103 can be considered as a server providing data services to user terminals. This 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the user terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0090] Figure 2 This is a flowchart illustrating a method for obtaining semantic tags provided in an embodiment of this application. See also... Figure 2 This embodiment is applied to a node device and includes the following steps:
[0091] 201. The node device obtains at least one data item corresponding to the target field to be identified in the relational database.
[0092] The target field to be identified is also the relational attribute to be identified, and the target field can be any column in any table in a relational database.
[0093] The at least one data item is also the relational attribute value to be identified, and the at least one data item can be some or all of the data items stored in the column indicated by the target field.
[0094] In this context, the node device can be any electronic device in a relational database system. For example, in a standalone database system, the node device is the standalone device corresponding to that standalone database system. In a distributed database system, since distributed transactions may involve cross-node operations, the node device can be a coordinating node device or a data node device. The node that initiates the distributed transaction is called the coordinating node device, and the other nodes involved in the distributed transaction are called data node devices.
[0095] In the above process, the node device can locate the target field to be identified from the relational database and query at least one data item stored corresponding to the target field.
[0096] In one example, Table 1 is a sample table of books provided in an embodiment of this application. This sample table includes five fields (i.e., five relational attributes): Title, Author, Publication Date, Price, and Publisher. Assuming the target field is Author, after locating the Author column in the sample table, the node device reads all data items recorded in this column: {Bill Swank, Steve Travers, Jack Torry}.
[0097] Table 1
[0098]
[0099]
[0100] In another example, Table 2 is a sample table of a movie provided in an embodiment of this application. This sample table includes five fields (i.e., five relational attributes): Movie Name, Release Year, Director, Genre, and Duration. Assuming the target field is Director, after locating the Director column in the sample table, the node device reads all data items recorded in this column: {Ben Wheatley, KCAmos, Kyle Newman}.
[0101] Table 2
[0102] Movie title Year of release director Movie Genre Movie length Movie Title 1 2015 Ben Wheatley Action-Drama-Sci-Fi 112 minutes Movie Title 2 2015 KCAmos Action-Drama-Thriller 91 minutes Movie Title 3 2015 Kyle Newman Action-Adventure-Comedy 96 minutes
[0103] 202. The node device obtains the semantic features of the target field based on the at least one data item.
[0104] In some embodiments, the node device extracts the semantic feature from the at least one data item based on a machine learning model. Optionally, the machine learning model may be at least one of a first translation model or a second translation model, wherein the first translation model is used to obtain the semantic feature based on the at least one data item, and the second translation model is used to obtain the semantic feature by combining the above two types of information based on the at least one data item and the contextual information of the target field.
[0105] In the above process, semantic features are extracted by machine learning models. Compared with the traditional method of semantic recognition based on regular expression matching, there is no need for users to design a certain matching rule. Instead, the semantic features are automatically extracted by the machine learning model. Furthermore, by controlling the scale of training data and the number of iterations of machine learning, higher accuracy is achieved.
[0106] In some embodiments, the node device invokes a first translation model to encode the at least one data item to obtain the semantic feature. Optionally, the first translation model includes, but is not limited to, Transformers (a classic translation model), NNLM (Neural Network Language Model), ELMo (Embeddings From Language Models), BERT (Bidirectional Encoder Representation From Transformers), etc. The embodiments of this application do not specifically limit the structure of the first translation model.
[0107] The above-mentioned encoding of at least one data item based on the first translation model can focus on each data item (i.e., relational data) corresponding to the target field itself. The semantic features of the entire target field can be represented by a global semantic feature of each data item, which makes the semantic feature have good expressive power and helps to improve the accuracy of subsequent semantic label prediction.
[0108] In an exemplary embodiment, taking the BERT model as an example, the BERT model is a deep bidirectional language representation model based on the Transformers structure. Essentially, it utilizes the Transformers structure to construct a multi-layer bidirectional encoder network. The BERT model includes at least one bidirectional encoder layer. Each bidirectional encoder layer is used to encode the input signal in both forward and backward directions, and the output of each bidirectional encoder layer serves as the input to the next bidirectional encoder layer. Each bidirectional encoder layer comprises two parts: an attention network and a forward fully connected layer. Each hidden layer in the attention network is obtained by weighted averaging of the hidden layers of the previous layer, ensuring that each hidden layer is directly associated with all hidden layers of the previous layer. Using the long sequence information of the input (i.e., the first word segmentation sequence described below), a hidden layer vector (i.e., the first semantic vector) representing global information can be obtained. The forward fully connected layer is used to further process the global information obtained by the attention network to enhance the learning ability of the entire BERT model.
[0109] The encoding process of the BERT model includes: the node device performs word segmentation on the at least one data item to obtain a first word segmentation sequence including at least one character, the at least one character including a classifier and the character obtained from the word segmentation of the at least one data item; the first word segmentation sequence is input into at least one bidirectional encoding layer in the first translation model, and the first word segmentation sequence is forward encoded and backward encoded through the at least one bidirectional encoding layer to output a first semantic vector sequence, where each first semantic vector in the first semantic vector sequence corresponds to a character in the first word segmentation sequence; the first semantic vector in the first semantic vector sequence corresponding to the classifier is determined as the semantic feature.
[0110] In the above process, the node device performs forward encoding and reverse encoding on each data item of the whole through a bidirectional encoding layer. Forward encoding enables the first semantic vector corresponding to each character to incorporate relevant information of historical characters that appeared before that character, while reverse encoding enables the first semantic vector corresponding to each character to incorporate relevant information of future characters that appear after that character. The encoding operations in both directions can greatly improve the expressive power of the first semantic vector of each character, that is, improve the expressive power of the first semantic vector sequence, thereby improving the expressive power of the finally determined semantic features.
[0111] In some embodiments, the node device can concatenate the at least one data item into a long text sequence, and use a word segmentation tool to perform word segmentation on the long text sequence to obtain the first word segmentation sequence. In the first word segmentation sequence, the first character is the classifier [CLS], and the characters after the classifier [CLS] are the characters obtained from the word segmentation of the long text sequence.
[0112] In the above process, placing the classifier [CLS] at the beginning of the first word segmentation sequence enables each subsequent character to incorporate the relevant information of the classifier [CLS] during the forward encoding process. Similarly, it enables the classifier [CLS] to incorporate the relevant information of the other characters during the reverse encoding process, thus possessing the ability to represent the global semantic information of the entire first word segmentation sequence. The first semantic vector corresponding to the classifier [CLS] can be used as the semantic feature of the entire target field and applied to downstream multi-classification tasks to accurately identify the semantic label of the target field.
[0113] In one example, taking "Author" from Table 1 as the target field, the attribute values "Bill Swank" from the first tuple, "Steve Travers" from the second tuple, and "Jack Torry" from the third tuple are concatenated into a long text sequence {Bill Swank, Steve Travers, Jack Torry}. Next, a word segmentation tool is used to convert this long text sequence into a first word segmentation sequence {[CLS], bill, swank, steve, travers, jack, torry, [SEP], 0, ..., 0}. It should be noted that each attribute value of a relational attribute can be considered as a statement concatenated from the attribute values. [SEP] is the statement separator, placed at the end of each statement, while the category separator [CLS] is placed at the beginning of the entire first word segmentation sequence. Since some BERT models specify the length of the first segmented sequence of input, if the number of characters obtained after segmenting a long text sequence is less than the specified length, then a value of 0 can be used to pad it until the length specified by the first segmented sequence is met.
[0114] In some embodiments, before inputting the first word segmentation sequence into at least one bidirectional coding layer of the BERT model, the first word segmentation sequence can be embedded to map each character in the first word segmentation sequence into an embedding vector in the embedding space, and then the sequence formed by the embedding vectors is input into the at least one bidirectional coding layer.
[0115] In the above process, by performing embedding processing on the first word segmentation sequence, the entire first word segmentation sequence can be converted from natural language into an embedding vector that is easy for machines to process, which facilitates the subsequent encoding processing of the bidirectional coding layer and can improve the model's processing speed. In some embodiments, one-hot encoding can also be used to obtain the feature vector sequence corresponding to the first word segmentation sequence and input the feature vector sequence into the bidirectional coding layer, which can simplify the preprocessing process. This application embodiment does not specifically limit this.
[0116] Optionally, taking the first bidirectional encoding layer as an example, this bidirectional encoding layer includes an attention network and a forward fully connected layer. The embedding vector sequence corresponding to the first word segmentation sequence is input into the attention network of the first bidirectional encoding layer. The attention network weights the embedding vector sequence to extract the attention feature sequence. This attention feature sequence is then input into the forward fully connected layer of the first bidirectional encoding layer. The forward fully connected layer performs bidirectional semantic encoding (including forward encoding and backward encoding) on the attention feature sequence, outputting a latent vector sequence. This latent vector sequence is then input into the second bidirectional encoding layer, and so on. The processing logic of subsequent bidirectional encoding layers is similar to that of the first bidirectional encoding layer, and will not be elaborated here. The latent vector sequence output by the last bidirectional encoding layer is also the first semantic vector sequence.
[0117] After obtaining the first semantic vector sequence output by the last encoding layer, since the classifier [CLS] is placed at the beginning in the first word segmentation sequence, the first first semantic vector in the first semantic vector sequence corresponds to the classifier [CLS], and the first first semantic vector is determined as the semantic feature of the target field.
[0118] In the above process, the introduction of an attention mechanism into the bidirectional encoding layer enables each character to focus on characters that are more closely related to itself during each semantic encoding, resulting in higher accuracy of the final semantic features.
[0119] In some embodiments, the node device may also combine the context information of the target field and invoke a second translation model to extract the semantic feature. That is, the node device obtains the context information of the target field, which includes data items of other fields corresponding to the same relational data as the target field; and invokes the second translation model to encode the at least one data item and the context information to obtain the semantic feature. The second translation model is used to obtain the semantic feature based on the at least one data item and the context information. Optionally, the second translation model includes, but is not limited to, Transformers, NNLM, ELMo, BERT, etc. The embodiments of this application do not specifically limit the structure of the second translation model.
[0120] The aforementioned second translation model not only encodes the at least one data item but also the contextual information. This ensures that the semantic features of the target field consider not only the relevant information of each data item within the field itself but also the relevant information of data items in other fields within the same data table. The extracted semantic features possess strong expressive power, which is beneficial for improving the accuracy of subsequent semantic label prediction.
[0121] In an exemplary scenario, both the author field in Table 1 and the director field in Table 2 contain name information. If semantic labeling is based solely on the data items in that column, the highly similarity of the extracted semantic features may lead to misclassification, making it difficult to distinguish between the author and director labels. However, by using a second translation model that incorporates contextual information, the semantic features of the author field also include information from the book title, price, publication date, and publisher. Similarly, the semantic features of the director field incorporate information from the movie title, release year, genre, and runtime. This allows the semantic features of the two fields to be distinguished by contextual information, reducing misclassification and improving the accuracy of semantic label recognition.
[0122] Optionally, the context information refers to data items in other fields belonging to the same data table as the target field. In one example, assuming the target field is the "Author" column in Table 1, the context information for the target field includes one or more columns from the "Title" column, "Publication Date" column, "Price" column, and "Publisher" column. For example, the context information includes all columns except the author column. Alternatively, since the author column is a text-based data item, only the title and publisher columns, which are also text-based data items, are retrieved as context information.
[0123] In some embodiments, when obtaining context information, the node device can obtain data items from all fields in the data table containing the target field, except for the target field, as the context information. This allows for the integration of data items from all other fields in the entire data table, making the context information more comprehensive and containing more information.
[0124] In other embodiments, when acquiring context information, the node device may first obtain the data item type of at least one data item corresponding to the target field, and then acquire the data items of other fields in the data table containing the target field that match the data item type as the context information. Optionally, the data item type includes text or numeric types. Optionally, the text type can be further divided according to language. This application embodiment does not specifically limit the classification method of data item types. This allows for filtering of context information based on data item type first. For some large data tables, this can greatly save computational resources when semantically encoding the context information later, and accelerate the semantic encoding rate.
[0125] In an exemplary embodiment, taking the second translation model as a BERT model as an example, the encoding process of the BERT model includes: the node device performing word segmentation processing on the at least one data item and the context information to obtain a second word segmentation sequence including at least one character, the at least one character including a classifier, a character obtained from the word segmentation processing of the at least one data item and the context information, and a sentence separator; inputting the second word segmentation sequence into at least one bidirectional encoding layer in the second translation model, performing forward encoding and reverse encoding on the second word segmentation sequence through the at least one bidirectional encoding layer to output a second semantic vector sequence, where each second semantic vector in the second semantic vector sequence corresponds to a character in the second word segmentation sequence; and determining the second semantic vector in the second semantic vector sequence corresponding to the classifier as the semantic feature.
[0126] In the above process, the node device performs forward and reverse encoding on each data item of its own column and each data item (context information) of other columns through a bidirectional encoding layer. This makes the second semantic vector of each character in the final encoded form not only integrate the relevant information of each character in its own column, but also integrate the relevant information of each character in other columns, thereby improving the expressive power of the entire second semantic vector sequence and thus improving the expressive power of the final determined semantic features.
[0127] In some embodiments, the node device can concatenate the at least one data item and the context information into a long text sequence, and use a word segmentation tool to perform word segmentation on the long text sequence to obtain the second word segmentation sequence. In the first word segmentation sequence, the first character is the classifier [CLS], and the characters after the classifier [CLS] are the characters obtained from the word segmentation of the long text sequence. In the second word segmentation sequence, the target field data item and the target field context information belong to different statements, and the different statements are separated by the statement separator [SEP].
[0128] In one example, taking the target field as "Author" in Table 1 above, the attribute value set of the author field is {Bill Swank, Steve Travers, Jack Torry}. The other fields of the first tuple include {Book Title 1, January 1, 1999, $16.99, Publisher 1}, the other fields of the second tuple include {Book Title 2, April 1, 2007, $9.99, Publisher 2}, and the other fields of the third tuple include {Book Title 3, March 1, 1996, $14.99, Publisher 3}. The attribute value set of the author field (the at least one data item) and the attribute value set of other fields (the context information) are concatenated into a long text sequence pair {Bill Swank, Steve Travers, Jack Torry} and {Book Title 1, January 1, 1999, $16.99, Publisher 1, Book Title 2, April 1, 2007, $9.99, Publisher 2, Book Title 3, March 1, 1996, $14.99, Publisher 3}. Then, using a word segmentation tool, this long text sequence pair can be converted into a second word segmentation sequence {[CLS], bill, swank, steve, ..., torry, [SEP], the first character of Book Title 1, the second character of Book Title 1, ..., the last character of Publisher 3, [SEP], 0, ..., 0}.
[0129] It should be noted that since some BERT models specify the length of the second word segmentation sequence in the input, if the number of characters obtained after segmenting a long text sequence is less than the specified length, then a value of 0 can be used to pad it until the length specified by the second word segmentation sequence is met.
[0130] In some embodiments, before inputting the second word segmentation sequence into at least one bidirectional coding layer of the BERT model, the second word segmentation sequence can be first processed by embedding, mapping each character in the second word segmentation sequence into a embedding vector in the embedding space, and then inputting the sequence formed by the embedding vectors into the at least one bidirectional coding layer.
[0131] In the above process, by performing embedding processing on the second word segmentation sequence, the entire second word segmentation sequence can be converted from natural language into an embedding vector that is easy for machines to process, which facilitates the subsequent encoding processing of the bidirectional encoding layer and can improve the model processing speed. In some embodiments, one-hot encoding can also be used to obtain the feature vector sequence corresponding to the second word segmentation sequence and input the feature vector sequence into the bidirectional encoding layer, which can simplify the preprocessing process. This application embodiment does not make specific limitations on this.
[0132] Optionally, taking the first bidirectional encoding layer as an example, this bidirectional encoding layer includes an attention network and a forward fully connected layer. The embedding vector sequence corresponding to the second word segmentation sequence is input into the attention network of the first bidirectional encoding layer. The attention network weights the embedding vector sequence to extract the attention feature sequence. This attention feature sequence is then input into the forward fully connected layer of the first bidirectional encoding layer. The forward fully connected layer performs bidirectional semantic encoding (including forward encoding and backward encoding) on the attention feature sequence, outputting a latent vector sequence. This latent vector sequence is then input into the second bidirectional encoding layer, and so on. The processing logic of subsequent bidirectional encoding layers is similar to that of the first bidirectional encoding layer, and will not be elaborated here. The latent vector sequence output by the last bidirectional encoding layer is the second semantic vector sequence.
[0133] After obtaining the second semantic vector sequence output by the last encoding layer, since the classifier [CLS] is placed at the beginning in the second word segmentation sequence, the first second semantic vector in the second semantic vector sequence corresponds to the classifier [CLS], and the first second semantic vector is determined as the semantic feature of the target field.
[0134] In the above process, by introducing an attention mechanism into the bidirectional encoding layer, each character can focus on characters in the current field that are more closely related to itself and characters in the context information that are more closely related to itself during each semantic encoding, so that the final semantic features obtained have higher accuracy.
[0135] 203. The node device processes the semantic feature to obtain the semantic label of the target field.
[0136] In some embodiments, the node device obtains at least one first prediction probability based on the semantic feature, wherein the first prediction probability is used to represent the degree of matching between the semantic feature and a semantic label; and the semantic label corresponding to the largest first prediction probability among the at least one first prediction probabilities is determined as the semantic label of the target field.
[0137] In the above process, the node device obtains the semantic label of the target field by directly classifying the semantic features, which simplifies the process of obtaining semantic labels and saves the computing power of the node device.
[0138] Optionally, the node device calls the first translation model to obtain the at least one first prediction probability, that is, inputs the semantic feature into a forward fully connected layer, performs weighted processing on the semantic feature through the forward fully connected layer, inputs the weighted feature into an exponential normalization (softmax) layer, and performs softmax mapping on the weighted feature through the softmax layer to obtain the at least one first prediction probability.
[0139] Optionally, after obtaining the at least one first prediction probability, the node device can sort the at least one first prediction probability in descending order, determine the first prediction probability that ranks first in the sort as the maximum first prediction probability, and determine the semantic label corresponding to the maximum first prediction probability as the semantic label of the target field.
[0140] In the above process, by calling the first translation model to perform weighted and softmax mapping on the semantic features, the matching degree between the semantic features and each semantic label can be obtained, that is, the at least one first prediction probability. Thus, the semantic label corresponding to the largest first prediction probability is directly used as the model output, breaking the limitations of the regular expression matching method. Regardless of the type of data item, this semantic detection method can be used to identify the semantic label of the target field, which can greatly improve the accuracy of semantic label acquisition.
[0141] In some embodiments, in addition to using a translation model to obtain semantic features, the node device can also extract the knowledge encoding of at least one data item of the target field based on a knowledge base, and use the rich ontology class knowledge contained in the knowledge base to enhance the feature representation of the target field.
[0142] In one exemplary embodiment, the node device queries a knowledge base for at least one candidate category corresponding to the at least one data item, where one data item corresponds to one or more candidate categories; the at least one candidate category is encoded to obtain a first category feature of the at least one data item; and the first category feature of the at least one data item is dimensionality-reduced to obtain a second category feature of the at least one data item. Optionally, the knowledge base includes, but is not limited to, DBpedia, Freebase, YAGO, etc.
[0143] In the above process, by leveraging prior knowledge from knowledge bases such as DBpedia, resources and ontology classes related to relational attribute values (i.e., each data item) can be obtained, which is equivalent to obtaining candidate categories related to each data item. Based on these candidate categories, knowledge encoding (i.e., second-category features) of the candidate categories can be extracted.
[0144] In some embodiments, after extracting the second category feature, the node device can also obtain the average embedding feature of the at least one data item, concatenate the average embedding feature with the second category feature to obtain the first concatenated feature, and obtain the semantic label of the target field based on the first concatenated feature and the semantic feature.
[0145] In the above process, the node device combines the second category features and semantic features to jointly predict the final semantic label from the dimensions of the translation model and the knowledge base, which can further improve the recognition accuracy of semantic labels.
[0146] Optionally, the node device calls the word vector model (word2vec) to perform embedding processing on the at least one data item to obtain at least one embedding vector of the at least one data item, and obtains the average vector of the at least one embedding vector as the average embedding feature.
[0147] In some embodiments, when a node device obtains a semantic label based on a first concatenation feature and a semantic feature, it may perform the following operations: based on the semantic feature, obtain at least one first prediction probability, wherein the first prediction probability is used to represent the degree of matching between the semantic feature and a semantic label; based on the first concatenation feature, obtain at least one second prediction probability, wherein the second prediction probability is used to represent the degree of matching between the first concatenation feature and a semantic label; perform weighted processing on the at least one first prediction probability and the at least one second prediction probability respectively to obtain at least one third prediction probability; and determine the semantic label corresponding to the largest third prediction probability among the at least one third prediction probability as the semantic label of the target field.
[0148] Optionally, the node device uses an LR (Logistic Regression) model to perform multi-classification processing on the first concatenated feature to obtain at least one second predicted probability. Then, the first and second predicted probabilities can be combined to obtain the final third predicted probability as a reference for semantic recognition.
[0149] Optionally, for each semantic tag, the node device takes the average of the first prediction probability and the second prediction probability corresponding to each semantic tag as the third prediction probability corresponding to each semantic tag, sorts the third prediction probabilities in descending order, determines the third prediction probability that is first in the sorted order as the maximum third prediction probability, and determines the semantic tag corresponding to the maximum third prediction probability as the semantic tag of the target field.
[0150] In some embodiments, besides using the average of the first and second predicted probabilities corresponding to each semantic tag as the third predicted probability, different weighting coefficients can be set for the first and second predicted probabilities. The first predicted probability is multiplied by its corresponding weighting coefficient to obtain a first value, and the second predicted probability is multiplied by its corresponding weighting coefficient to obtain a second value. The sum of the first and second values is then determined as the third predicted probability. Optionally, both the weighting coefficients of the first and second predicted probabilities are values greater than or equal to 0 and less than or equal to 1, and the sum of the weighting coefficients of the first and second predicted probabilities equals 1.
[0151] In some embodiments, the node device may also directly concatenate the second category feature with the semantic feature to obtain a second concatenated feature; based on the second concatenated feature, at least one fourth prediction probability is obtained, and a fourth prediction probability is used to represent the degree of matching between the second concatenated feature and a semantic label; the semantic label corresponding to the largest fourth prediction probability among the at least one fourth prediction probability is determined as the semantic label of the target field.
[0152] Figure 3 This is a schematic diagram illustrating the principle of a semantic tag acquisition method provided in an embodiment of this application. Please refer to it. Figure 3 After obtaining the relation attribute 301 to be identified (i.e., the target field), each data item of the target field is input into the BERT model 302 and the knowledge base 303 respectively. The semantic features of the target field are obtained through the BERT model 302, and the knowledge encoding 304 (i.e., the second category feature) of the target field is obtained through the knowledge base 303. By combining the semantic features and the knowledge encoding, the attribute semantic recognition result 305 (i.e., the semantic label of the target field) can be predicted.
[0153] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this disclosure, and will not be described in detail here.
[0154] The method provided in this application embodiment obtains the semantic label of any target field in a relational database based on the semantic features of each data item corresponding to the target field. Since the semantic features depend on each data item, they will not change according to the name of the target field, thereby improving the recognition accuracy of the semantic label.
[0155] Furthermore, since it does not rely on regular expression matching methods that require manually defined rules, it can be applied to general field semantic recognition scenarios, breaking the limitation that regular expression matching methods can only be applied to fields with specific naming conventions, and improving the portability of semantic tag recognition.
[0156] Figure 4 This is a flowchart of a semantic tag acquisition method provided in an embodiment of this application. Please refer to it. Figure 4 This embodiment is applied to a node device. This application embodiment describes how to obtain semantic tags for a target field based on a first translation model. The method includes the following steps:
[0157] 401. The node device obtains at least one data item corresponding to the target field to be identified in the relational database.
[0158] Step 401 above is similar to step 201 above, and will not be repeated here.
[0159] 402. The node device performs word segmentation on the at least one data item to obtain a first word segmentation sequence including at least one character.
[0160] The at least one character includes a classifier and characters obtained from word segmentation of the at least one data item.
[0161] In some embodiments, the node device can concatenate the at least one data item into a long text sequence, and use a word segmentation tool to perform word segmentation on the long text sequence to obtain the first word segmentation sequence. In the first word segmentation sequence, the first character is the classifier [CLS], and the characters after the classifier [CLS] are the characters obtained from the word segmentation of the long text sequence.
[0162] In the above process, by placing the classifier [CLS] at the beginning of the first word segmentation sequence, subsequent characters can be integrated with the relevant information of the classifier [CLS] during forward encoding. Similarly, during reverse encoding, the classifier [CLS] can be integrated with the relevant information of the other characters, thus possessing the ability to represent the global semantic information of the entire first word segmentation sequence. Using the first semantic vector corresponding to the classifier [CLS] as the semantic feature of the entire target field, it can be input into downstream multi-classification tasks to accurately identify the semantic label of the target field.
[0163] In one example, taking the target field as "Author" in Table 1 above, the attribute values "Bill Swank" in the first tuple, "Steve Travers" in the second tuple, and "Jack Torry" in the third tuple are concatenated into a long text sequence {Bill Swank, Steve Travers, Jack Torry}. Next, a word segmentation tool is used to convert this long text sequence into a first word segmentation sequence {[CLS], bill, swank, steve, travers, jack, torry, [SEP], 0, ..., 0}. It should be noted that each attribute value of a relational attribute can be considered as a statement concatenated from the attribute values. [SEP] is the statement separator, placed at the end of each statement, while the category separator [CLS] is placed at the beginning of the entire first word segmentation sequence. Since some BERT models specify the length of the input first word segmentation sequence, if the number of characters obtained after segmenting the long text sequence is less than the specified length, values of 0 can be used for padding until the specified length of the first word segmentation sequence is met.
[0164] 403. The node device inputs the first word segmentation sequence into at least one bidirectional encoding layer in the first translation model, and performs forward encoding and reverse encoding on the first word segmentation sequence through the at least one bidirectional encoding layer to output the first semantic vector sequence.
[0165] In this first semantic vector sequence, one first semantic vector corresponds to one character in the first word segmentation sequence.
[0166] Optionally, the first translation model is used to obtain the semantic features of the target field based on the at least one data item. The first translation model includes, but is not limited to, Transformers, NNLM, ELMo, BERT, etc. The embodiments of this application do not specifically limit the structure of the first translation model.
[0167] Taking the BERT model as an example, the BERT model is a deep bidirectional language representation model based on the Transformers structure. Essentially, it utilizes the Transformers structure to construct a multi-layer bidirectional encoder network. The BERT model includes at least one bidirectional encoder layer. Each bidirectional encoder layer is used to encode the input signal in both forward and backward directions, and the output of each bidirectional encoder layer serves as the input to the next bidirectional encoder layer. Each bidirectional encoder layer consists of two parts: an attention network and a forward fully connected layer. Each hidden layer in the attention network is obtained by weighted averaging of the hidden layers of the previous layer, ensuring that each hidden layer is directly associated with all hidden layers of the previous layer. Using the long sequence information of the input (i.e., the first word segmentation sequence described below), a hidden vector representing global information (i.e., the first semantic vector) can be obtained. The forward fully connected layer further processes the global information obtained by the attention network to enhance the learning ability of the entire BERT model.
[0168] In some embodiments, before inputting the first word segmentation sequence into at least one bidirectional coding layer of the BERT model, the first word segmentation sequence can be embedded to map each character in the first word segmentation sequence into an embedding vector in the embedding space, and then the sequence formed by the embedding vectors is input into the at least one bidirectional coding layer.
[0169] In the above process, by performing embedding processing on the first word segmentation sequence, the entire first word segmentation sequence can be converted from natural language into an embedding vector that is easy for machines to process, which facilitates the subsequent encoding processing of the bidirectional encoding layer and can improve the model processing speed. In some embodiments, one-hot encoding can also be used to obtain the feature vector sequence corresponding to the first word segmentation sequence and input the feature vector sequence into the bidirectional encoding layer, which can simplify the preprocessing process. This application embodiment does not make specific limitations on this.
[0170] Optionally, taking the first bidirectional encoding layer as an example, this bidirectional encoding layer includes an attention network and a forward fully connected layer. The embedding vector sequence corresponding to the first word segmentation sequence is input into the attention network of the first bidirectional encoding layer. The attention network weights the embedding vector sequence to extract the attention feature sequence. This attention feature sequence is then input into the forward fully connected layer of the first bidirectional encoding layer. The forward fully connected layer performs bidirectional semantic encoding (including forward encoding and backward encoding) on the attention feature sequence, outputting a latent vector sequence. This latent vector sequence is then input into the second bidirectional encoding layer, and so on. The processing logic of subsequent bidirectional encoding layers is similar to that of the first bidirectional encoding layer, and will not be elaborated here. The latent vector sequence output by the last bidirectional encoding layer is also the first semantic vector sequence.
[0171] In the above process, the node device performs forward encoding and reverse encoding on each data item of the whole through a bidirectional encoding layer. Forward encoding enables the first semantic vector corresponding to each character to incorporate relevant information of historical characters that appeared before that character, while reverse encoding enables the first semantic vector corresponding to each character to incorporate relevant information of future characters that appear after that character. The encoding operations in both directions can greatly improve the expressive power of the first semantic vector of each character, that is, improve the expressive power of the first semantic vector sequence, thereby improving the expressive power of the finally determined semantic features.
[0172] 404. The node device determines the first semantic vector in the first semantic vector sequence that corresponds to the classifier as the semantic feature of the target field.
[0173] After obtaining the first semantic vector sequence output by the last encoding layer, since the classifier [CLS] is placed at the beginning in the first word segmentation sequence, the first first semantic vector in the first semantic vector sequence corresponds to the classifier [CLS], and the first first semantic vector is determined as the semantic feature of the target field.
[0174] In the above process, one possible implementation is to call the first translation model to encode the at least one data item to obtain the semantic feature. Since the at least one data item is directly encoded based on the first translation model, it is possible to focus on each data item (i.e., relational data) corresponding to the target field itself. The semantic feature of the entire target field can be characterized by a global semantic feature of each data item, which makes the semantic feature have good expressive ability and is conducive to improving the accuracy of subsequent semantic label prediction.
[0175] In steps 402-404 above, the node device obtains the semantic features of the target field based on the at least one data item. In some embodiments, the node device may also obtain the semantic features through the second translation model in the next embodiment. This application does not specifically limit the method of obtaining semantic features.
[0176] 405. The node device processes the semantic feature to obtain the semantic label of the target field.
[0177] Step 405 above is similar to step 203 above, and will not be described in detail here.
[0178] Optionally, the node device obtains at least one first prediction probability based on the semantic feature, wherein the first prediction probability is used to represent the degree of matching between the semantic feature and a semantic label; and the semantic label corresponding to the largest first prediction probability among the at least one first prediction probabilities is determined as the semantic label of the target field.
[0179] In an exemplary scenario, Figure 5 This is a schematic diagram illustrating the principle of a first translation model provided in an embodiment of this application. Please refer to it. Figure 5 Taking the BERT model as the first translation model as an example, in the input layer 501, at least one data item corresponding to the target field is concatenated into a long text sequence, which is also the attribute value sequence of the attribute to be predicted. Then, the long text sequence is segmented using a word segmentation tool to obtain the first word segmentation sequence 502. The first word segmentation sequence is input into at least one bidirectional encoding layer 503 of BERT for semantic encoding. The first semantic vector corresponding to the classifier [CLS] is extracted as the semantic feature of the entire target field. The semantic feature is input into the classifier 504. In the classifier 504, multi-class processing is performed through a forward fully connected layer and a softmax layer to output at least one first prediction probability. The semantic label corresponding to the largest first prediction probability is selected as the model output.
[0180] In one example, the BERT model includes 12 bidirectional encoder layers, each outputting a latent vector with a dimension of 768. The multi-head attention mechanism in each bidirectional encoder layer has 12 parameters, resulting in a total model parameter size of 110M. The final first predicted probability P1 is expressed as: P1 = softmax(CW T Here, C is the first semantic vector corresponding to the classifier [CLS], that is, C is the semantic feature of the target field, C∈R. H H represents the dimension of semantic feature C; W is the parameter matrix of the classifier, W∈R K×HK represents the total number of semantic labels to be classified (i.e., the number of categories in attribute semantic classification); the first prediction probability P1 is calculated by the softmax function, P1∈R K .
[0181] Optionally, the BERT model can use cross-entropy as the loss function and be jointly trained with the classifier's parameter matrix, with the optimization objective being to maximize the log probability of correctly classified semantic labels. During training, the batch size can be set to 32 and the learning rate to 2×10⁻⁶. -5 The number of epochs for traversing all training samples is set to 3, and the maximum length of the first word segmentation sequence in the first translation model can be set to 128. If the length of the input long text sequence is greater than 128, the long text sequence can be automatically truncated to meet the maximum length limit.
[0182] In this embodiment, the semantic features of the target field are obtained by calling the first translation model to encode each data item of the target field, and the final semantic label is obtained based on the semantic features. Since the first translation model directly encodes at least one data item, it can focus on each data item (i.e., relational data) corresponding to the target field itself. The semantic features of the entire target field can be characterized by a global semantic feature of each data item, so that the semantic features have good expressive power, thereby improving the recognition accuracy of the semantic label obtained by subsequent prediction.
[0183] In an exemplary scenario, the data items in the "Author" field of Table 1 and the "Director" field of Table 2 are both personal names, possessing highly similar semantic features. If semantic labeling is based solely on this single data item, the final predicted semantic label may fail to distinguish between the "Author" and "Director" labels, leading to misclassification.
[0184] In view of this, this application provides a second translation model. The second translation model combines the contextual information of the target field to perform semantic tag prediction. This allows the semantic features of the author field to incorporate relevant information from the book title, price, publication date, and publisher fields, while the semantic features of the director field incorporate relevant information from the movie title, release year, movie type, and movie length fields. This allows the semantic features of the two fields to be distinguished by contextual information, thereby reducing the possibility of misjudgment of semantic tags and improving the accuracy of semantic tag recognition.
[0185] Figure 6 This is a flowchart of a semantic tag acquisition method provided in an embodiment of this application. Please refer to it. Figure 6 This embodiment is applied to node devices. This application describes how to obtain semantic tags for a target field based on a second translation model. The method includes the following steps:
[0186] 601. The node device acquires at least one data item corresponding to the target field to be identified in the relational database.
[0187] Step 601 above is similar to step 201 above, and will not be described in detail here.
[0188] 602. The node device obtains the context information of the target field, which includes data items of other fields that correspond to the same relational data as the target field.
[0189] Optionally, the context information refers to data items in other fields belonging to the same data table as the target field. In one example, assuming the target field is the "Author" column in Table 1, the context information for the target field includes one or more columns from the "Title" column, "Publication Date" column, "Price" column, and "Publisher" column. For example, the context information includes all columns except the author column. Alternatively, since the author column is a text-based data item, only the title and publisher columns, which are also text-based data items, are retrieved as context information.
[0190] In some embodiments, when obtaining context information, the node device can obtain data items from all fields in the data table containing the target field, except for the target field, as the context information. This allows for the integration of data items from all other fields in the entire data table, making the context information more comprehensive and containing more information.
[0191] In other embodiments, when acquiring context information, the node device may first obtain the data item type of at least one data item corresponding to the target field, and then acquire the data items of other fields in the data table containing the target field that match the data item type as the context information. Optionally, the data item type includes: text type or numeric type. Optionally, the text type can be further divided according to language. This application embodiment does not specifically limit the classification method of data item type. This allows for filtering of context information based on data item type first. For some large data tables, this can greatly save computational resources when semantically encoding the context information later, and accelerate the semantic encoding rate.
[0192] 603. The node device performs word segmentation on the at least one data item and the context information to obtain a second word segmentation sequence including at least one character.
[0193] The at least one character includes a classifier, characters obtained from the word segmentation of the at least one data item and the context information, and a statement separator.
[0194] In some embodiments, the node device can concatenate the at least one data item and the context information into a long text sequence pair, and use a word segmentation tool to perform word segmentation processing on the long text sequence pair to obtain the second word segmentation sequence. In the second word segmentation sequence, the first character is the classifier [CLS], and the characters after the classifier [CLS] are the characters obtained from the word segmentation processing of the long text sequence. In the second word segmentation sequence, each data item of the target field and the context information of the target field belong to different statements, and the different statements are separated by the statement separator [SEP].
[0195] In one example, taking the target field as "Author" in Table 1 above, the attribute value set of the author field is {Bill Swank, Steve Travers, Jack Torry}. The other fields of the first tuple include {Book Title 1, January 1, 1999, $16.99, Publisher 1}, the other fields of the second tuple include {Book Title 2, April 1, 2007, $9.99, Publisher 2}, and the other fields of the third tuple include {Book Title 3, March 1, 1996, $14.99, Publisher 3}. The attribute value set of the author field (the at least one data item) and the attribute value set of other fields (the context information) are concatenated into a long text sequence pair {Bill Swank, Steve Travers, Jack Torry} and {Book Title 1, January 1, 1999, $16.99, Publisher 1, Book Title 2, April 1, 2007, $9.99, Publisher 2, Book Title 3, March 1, 1996, $14.99, Publisher 3}. Next, using a word segmentation tool, this long text sequence is converted into a second word segmentation sequence {[CLS], bill, swank, steve, ..., torry, [SEP], the first character of Book Title 1, the second character of Book Title 1, ..., the last character of Publisher 3, [SEP], 0, ..., 0}.
[0196] It should be noted that since some BERT models specify the length of the second word segmentation sequence in the input, if the number of characters obtained after segmenting a long text sequence is less than the specified length, then a value of 0 can be used to pad it until the length specified by the second word segmentation sequence is met.
[0197] 604. The node device inputs the second word segmentation sequence into at least one bidirectional encoding layer in the second translation model, and performs forward encoding and reverse encoding on the second word segmentation sequence through the at least one bidirectional encoding layer to output a second semantic vector sequence.
[0198] In this second semantic vector sequence, one second semantic vector corresponds to one character in the second word segmentation sequence.
[0199] The second translation model is used to obtain the semantic features based on the at least one data item and the context information. Optionally, the second translation model includes, but is not limited to, Transformers, NNLM, ELMo, BERT, etc. The embodiments of this application do not specifically limit the structure of the second translation model.
[0200] In some embodiments, before inputting the second word segmentation sequence into at least one bidirectional coding layer of the BERT model, the second word segmentation sequence can be first processed by embedding, mapping each character in the second word segmentation sequence into a embedding vector in the embedding space, and then inputting the sequence formed by the embedding vectors into the at least one bidirectional coding layer.
[0201] In the above process, by performing embedding processing on the second word segmentation sequence, the entire second word segmentation sequence can be converted from natural language into an embedding vector that is easy for machines to process, which facilitates the subsequent encoding processing of the bidirectional encoding layer and can improve the model processing speed. In some embodiments, one-hot encoding can also be used to obtain the feature vector sequence corresponding to the second word segmentation sequence and input the feature vector sequence into the bidirectional encoding layer, which can simplify the preprocessing process. This application embodiment does not make specific limitations on this.
[0202] Optionally, taking the first bidirectional encoding layer as an example, this bidirectional encoding layer includes an attention network and a forward fully connected layer. The embedding vector sequence corresponding to the second word segmentation sequence is input into the attention network of the first bidirectional encoding layer. The attention network weights the embedding vector sequence to extract the attention feature sequence. This attention feature sequence is then input into the forward fully connected layer of the first bidirectional encoding layer. The forward fully connected layer performs bidirectional semantic encoding (including forward encoding and backward encoding) on the attention feature sequence, outputting a latent vector sequence. This latent vector sequence is then input into the second bidirectional encoding layer, and so on. The processing logic of subsequent bidirectional encoding layers is similar to that of the first bidirectional encoding layer, and will not be elaborated here. The latent vector sequence output by the last bidirectional encoding layer is the second semantic vector sequence.
[0203] 605. The node device determines the second semantic vector in the second semantic vector sequence that corresponds to the classifier as the semantic feature of the target field.
[0204] After obtaining the second semantic vector sequence output by the last encoding layer, since the classifier [CLS] is placed at the beginning in the second word segmentation sequence, the first second semantic vector in the second semantic vector sequence corresponds to the classifier [CLS], and the first second semantic vector is determined as the semantic feature of the target field.
[0205] In steps 603-605 above, the node device calls the second translation model to encode the at least one data item and the context information to obtain the semantic feature. The second translation model not only encodes the at least one data item but also the context information, ensuring that the semantic feature of the target field considers not only the relevant information of each data item within its own field but also the relevant information of data items in other fields within the same data table. This gives the semantic feature good expressive power and helps improve the accuracy of subsequent semantic label prediction.
[0206] In some embodiments, in addition to calling the second translation model to obtain semantic features, the first translation model in the above embodiments can also be called to obtain semantic features. Alternatively, the first translation model and the second translation model can be used to obtain two semantic features respectively, and the semantic features output by the two models can be fused to obtain the semantic feature representation of the final target field. The embodiments of this application do not specifically limit the method of obtaining semantic features.
[0207] 606. The node device processes the semantic feature to obtain the semantic label of the target field.
[0208] Step 606 above is similar to step 203 above, and will not be described in detail here.
[0209] Optionally, the node device obtains at least one first prediction probability based on the semantic feature, wherein the first prediction probability is used to represent the degree of matching between the semantic feature and a semantic label; and the semantic label corresponding to the largest first prediction probability among the at least one first prediction probabilities is determined as the semantic label of the target field.
[0210] In an exemplary scenario, Figure 7 This is a schematic diagram illustrating the principle of a second translation model provided in an embodiment of this application. Please refer to it. Figure 7Taking the second translation model as the BERT model as an example, in the input layer 701, at least one data item corresponding to the target field and the context information of the target field are concatenated into a long text sequence pair. This long text sequence pair is also the attribute value sequence of the attribute to be predicted and the context information. Then, the long text sequence is segmented using a word segmentation tool to obtain the second word segmentation sequence 702. The second word segmentation sequence is input into at least one bidirectional encoding layer 703 of BERT for semantic encoding. The second semantic vector corresponding to the classifier [CLS] is extracted as the semantic feature of the entire target field. This semantic feature is input into the classifier 704. In the classifier 704, multi-class processing is performed through a forward fully connected layer and a softmax layer to output at least one first prediction probability. The semantic label corresponding to the largest first prediction probability is selected as the model output.
[0211] In one example, assuming the target field is the author column in Table 1, the input and output samples of this second translation model are shown below.
[0212] enter:
[0213] 1) The set of attribute values (at least one data item) of the attribute to be identified: {Bill Swank, Steve Travers, Jack Torry}.
[0214] 2) Attribute context information (context information): {Book title 1, January 1, 1999, $16.99, Publisher 1}, {Book title 2, April 1, 2007, $9.99, Publisher 2}, {Book title 3, March 1, 1996, $14.99, Publisher 3}.
[0215] Output:
[0216] The predicted semantic tag is "author".
[0217] Optionally, the BERT model can use cross-entropy as the loss function and be jointly trained with the classifier's parameter matrix, with the optimization objective being to maximize the log probability of correctly classified semantic labels. During training, the batch size can be set to 32 and the learning rate to 2×10⁻⁶. -5 The number of epochs for traversing all training samples is set to 3, and the maximum length of the second word segmentation sequence in the second translation model can be set to 256. If the length of the input long text sequence is greater than 256, the long text sequence can be automatically truncated to meet the maximum length limit.
[0218] In some embodiments, when truncating long text sequences, a heuristic approach can be adopted, truncating the long text sequence each time, and iterating until the total length of the long text sequence meets the limit. This approach takes into account both attribute value information and contextual information in the long text sequence, and avoids losing a large amount of effective information due to truncation.
[0219] In this embodiment, by calling the bidirectional encoding layers of the second translation model, forward encoding and reverse encoding are performed on each data item of its own column and each data item (context information) of other columns, respectively. This makes the second semantic vector of each character obtained by encoding not only integrate the relevant information of each character in its own column, but also integrate the relevant information of each character in other columns, thereby improving the expressive power of the entire second semantic vector sequence and the expressive power of the finally determined semantic features, thus improving the recognition accuracy of semantic tags.
[0220] In other words, a relational attribute semantic automatic recognition technology with relational data context awareness is proposed, which can transform the semantic recognition problem into a multi-classification problem. By combining the attribute value set and relational data context, the relational attributes are semantically encoded. By rewriting the downstream task of the BERT model and fine-tuning the model parameters, effective relational attribute semantic recognition is achieved.
[0221] Furthermore, since BERT is an open-source foundational model, by rewriting the downstream task of BERT as relational attribute semantic classification, fine-tuning can be performed on pre-trained weights to obtain the desired translation model (equivalent to a relational attribute semantic classification model). This not only effectively utilizes prior knowledge, saves computational resources, and avoids training from scratch, but also better fits the corpus of relational data in the vertical domain, achieving high-performance relational attribute semantic encoding and good semantic recognition results. Moreover, since the feature selection and definition of relational attributes do not require human decision-making, end-to-end automated semantic encoding is achieved. Simultaneously, in this second translation model, the contextual information of the target field is introduced to semantically encode the target field, effectively distinguishing semantically similar fields, improving the expressive power of semantic sequences, and increasing the accuracy of semantic label recognition.
[0222] Figure 8 This is a flowchart of a semantic tag acquisition method provided in an embodiment of this application. In some embodiments, before performing any one of the above steps 405 or 606, the node device may also perform the following optional steps 801-803 to extract the knowledge encoding of the target field based on the knowledge base, which will be described in detail below:
[0223] 801. The node device queries the knowledge base for at least one candidate category corresponding to at least one data item of the target field. One data item corresponds to one or more candidate categories.
[0224] Optionally, the knowledge base may include, but is not limited to, DBpedia, Freebase, YAGO, etc., and the knowledge base stores a wealth of ontology class knowledge.
[0225] 802. The node device encodes the at least one candidate category to obtain the first category feature of the at least one data item.
[0226] The above process is equivalent to encoding the knowledge of at least one data item based on the knowledge base to obtain the first category feature. The dimension of the first category feature depends on the number of ontology classes in the knowledge base. Each dimension represents the probability that the attribute to be identified (i.e. the target field) belongs to a certain ontology class.
[0227] In an exemplary scenario, Figure 9 This is a schematic diagram of the principle of ontology class relationships in a knowledge base provided in an embodiment of this application. As shown in 900, taking the DBpedia knowledge base as an example, the knowledge base includes 760 ontology classes. There are complex hierarchical relationships between these ontology classes. For example, categories such as Actor, Artist, and WinterSportPlayer are all subclasses of the Person category.
[0228] Since in most cases, the data items of the target field will be mapped to several ontology classes with parent-child relationships, the generated knowledge encoding (second-class feature, KBVec) will be high-dimensional and sparse. Therefore, the node device can perform dimensionality reduction through step 803 below to save computational resources when predicting semantic labels.
[0229] 803. The node device performs dimensionality reduction on the first category feature of the at least one data item to obtain the second category feature of the at least one data item.
[0230] Optionally, the node device uses Principal Component Analysis (PCA) to map the extracted first-class features from the high-dimensional space to the low-dimensional space to obtain the second-class features. PCA can minimize information loss while compressing features.
[0231] In some embodiments, the knowledge encoding construction and extraction process is shown in Algorithm 1 below.
[0232] Algorithm 1: Construction and Extraction of Knowledge Encoding
[0233] Input: Attrs, a set of attributes to be identified; clses, a set of ontology classes in the knowledge base, containing d ontology classes; N, the maximum number of results returned by the LookUp API service; α, the principal component retention ratio in the PCA algorithm.
[0234] Output: Knowledge Encoding (i.e., Second-Class Features) KBVec
[0235]
[0236] In this Algorithm 1, based on the DBpedia knowledge base, for each attribute value in the attribute to be identified (that is, each data item of the target field), the matching resource and ontology class are first obtained by using the LookUp interface service provided by DBpedia (corresponding to line 5 of Algorithm 1).
[0237] Optionally, to prevent missing matching resources during keyword matching, the node device sets the maximum number of results returned in the LookUp API service to 5, in order to cover as many matching resources and ontology classes as possible. For example, the API "http: / / lookup.dbpedia.org / api / search / KeywordSearch?MaxHits=5&QueryString=berlin" can retrieve the 5 most relevant resources for a data item "berlin".
[0238] After obtaining the candidate categories to which the data items belong, the node device retrieves the dimensional position of each candidate category in the knowledge encoding and enhances its feature representation in the corresponding dimension (corresponding to lines 6-9 of Algorithm 1) to obtain the first category features of the target field. Finally, the node device normalizes the obtained first category features and uses the PCA method to perform dimensionality reduction on the first category features to reduce noise interference caused by high-dimensional sparse data, obtaining the second category features of the target field (corresponding to lines 13-14 of Algorithm 1).
[0239] In this embodiment, by leveraging prior knowledge from knowledge bases such as DBpedia, resources and ontology classes related to relational attribute values (i.e., each data item) can be obtained. This is equivalent to obtaining candidate categories related to each data item, thereby enabling the extraction of knowledge codes (i.e., second-category features) based on these candidate categories. In other words, a knowledge base-based attribute feature extraction technique is proposed, introducing external knowledge to enhance the feature representation of attributes.
[0240] Furthermore, combining the second-category features with the semantic features extracted in the translation model implementation and incorporating them into the semantic label prediction process can improve the accuracy of semantic label recognition. Based on steps 801-803 above, two methods can be provided to combine the second-category features and semantic features to obtain the semantic labels of the target field, which will be detailed below.
[0241] Method 1: ScoreEnsemble
[0242] In some embodiments, the node device obtains the average embedding feature WordVec of at least one data item of the target field; concatenates the average embedding feature WordVec with the second category feature KBVec to obtain a first concatenated feature [WordVec, KBVec]; and obtains the semantic label of the target field based on the first concatenated feature and the semantic feature.
[0243] Optionally, the node device calls the word vector model (word2vec) to perform embedding processing on the at least one data item to obtain at least one embedding vector of the at least one data item, and obtains the average vector of the at least one embedding vector as the average embedding feature WordVec.
[0244] In some embodiments, the node device obtains at least one first prediction probability based on the semantic feature, wherein the first prediction probability is used to represent the degree of matching between the semantic feature and a semantic tag; obtains at least one second prediction probability based on the first concatenation feature, wherein the second prediction probability is used to represent the degree of matching between the first concatenation feature and a semantic tag; performs weighted processing on the at least one first prediction probability and the at least one second prediction probability respectively to obtain at least one third prediction probability; and determines the semantic tag corresponding to the largest third prediction probability among the at least one third prediction probability as the semantic tag of the target field.
[0245] Optionally, the node device uses an LR (Logistic Regression) model to perform multi-classification processing on the first spliced feature to obtain at least one second prediction probability P2. The function expression of the second prediction probability P2 is as follows: P2 = LR([WordVec, KBVec]).
[0246] Next, the first prediction probability P1 and the second prediction probability P2 can be combined to obtain the final third prediction probability P3, which serves as a reference for semantic recognition. Optionally, for each semantic tag, the node device uses the average of the first prediction probability P1 and the second prediction probability P2 corresponding to each semantic tag as the third prediction probability P3 corresponding to each semantic tag. The function expression of the third prediction probability P3 is as follows: P3 = (P1 + P2) / 2.
[0247] Optionally, the node device sorts the third prediction probabilities P3 in descending order, determines the third prediction probability that is ranked first as the maximum third prediction probability, and determines the semantic label corresponding to the maximum third prediction probability as the semantic label of the target field.
[0248] In some embodiments, in addition to taking the average of the first prediction probability P1 and the second prediction probability P2 corresponding to each semantic tag as the third prediction probability P3, different weighting coefficients can be set for the first prediction probability P1 and the second prediction probability P2. The first prediction probability P1 is multiplied by the corresponding weighting coefficient λ1 to obtain the first value P1λ1, and the second prediction probability P2 is multiplied by the corresponding weighting coefficient λ2 to obtain the second value P2λ2. The value P1λ1+P2λ2 obtained by adding the first value P1λ1 and the second value P2λ2 is determined as the third prediction probability.
[0249] Optionally, the weighting coefficient λ1 of the first prediction probability and the weighting coefficient λ2 of the second prediction probability are both values greater than or equal to 0 and less than or equal to 1, and the weighting coefficients of the first prediction probability and the second prediction probability are added together to equal 1, that is, λ1+λ2=1.
[0250] In the first method described above, a basic model for semantic recognition of relational attributes is constructed by combining the average word vector (i.e., average embedding feature) and the attribute feature encoding based on the knowledge base (i.e., second-category feature). The final semantic recognition result is obtained by combining the recognition scores of the basic model and the context-aware model.
[0251] Method 2: Feature Ensemble
[0252] In some embodiments, the node device concatenates the second category feature KBVec of the target field with the semantic feature C of the target field to obtain a second concatenated feature [C, KBVec]. Based on the second concatenated feature [C, KBVec], at least one fourth prediction probability P4 is obtained, whereby a fourth prediction probability represents the degree of matching between the second concatenated feature and a semantic label. The semantic label corresponding to the largest fourth prediction probability among the at least one fourth prediction probability is determined as the semantic label of the target field. The functional expression of the fourth prediction probability P4 is as follows: P4 = LR([C, KBVec]).
[0253] In both of the above methods, the node device combines second-category features and semantic features to jointly predict the final semantic labels from the dimensions of the translation model and the knowledge base, respectively, which can further improve the recognition accuracy of semantic labels. Method 1 makes full use of the first prediction probability P1, while Method 2 makes full use of semantic features C; both have good performance. It should be noted that when the relational data quality is low and the distinction between attributes is difficult, Method 2 usually achieves better semantic recognition results.
[0254] Furthermore, in some scenarios, it cannot be guaranteed that all attributes to be predicted belong to categories already learned by machine learning models (a type of multi-class classification model), such as the first and second translation models. Therefore, when the category of the attribute to be identified does not fall within the predefined range of the machine learning model, it indicates the occurrence of an attribute identification problem of "unknown category," also known as the "out-of-vocabulary" problem.
[0255] In view of this, the node device can improve the above problems by using second-category features: The predicted attribute is predicted using a pre-trained multi-classification model, that is, the semantic label of the target field is still predicted using machine learning models such as the first or second translation model; the predicted attribute is filtered according to the set prediction score (equivalent to a probability threshold). If the maximum prediction probability score is less than the threshold, the target field is determined to be an "unknown category" attribute, meaning that the semantic label of this attribute may not belong to the predefined range of the multi-classification model. In other words, if the maximum first prediction probability is still less than a certain probability threshold, it indicates that an out-of-vocabulary word problem has occurred; for the filtered "unknown category" fields, the potential candidate semantic categories can be identified using the constructed first-category features. That is, the categories corresponding to the non-zero dimensions in the first-category features (i.e., the ontology classes in the knowledge base) are output as the identification results of the "unknown category" attribute in descending order of probability.
[0256] Combining the above process, on the one hand, for labeled categories, the multi-classification model ensures high accuracy; on the other hand, for "unknown categories," a knowledge base provides a feasible solution, making the machine learning model more universal in real-world applications.
[0257] In the second method described above, the semantic encoding of attributes (i.e., semantic features) is obtained through a context-aware model. The semantic encoding and the attribute encoding based on the knowledge base (i.e., second-category features) are combined to construct a feature-fusion relational attribute semantic recognition model. The recognition of unlabeled semantic categories in the multi-class model is considered. With the help of the attribute encoding of the knowledge base, semantic category references are provided for unknown category attributes, making the model more universal in practical application scenarios.
[0258] Figure 10 This is a schematic diagram of the structure of a semantic tag acquisition device provided in an embodiment of this application. Please refer to it. Figure 10 The device includes:
[0259] The first acquisition module 1001 is used to acquire at least one data item corresponding to the target field to be identified in the relational database;
[0260] The second acquisition module 1002 is used to acquire the semantic features of the target field based on the at least one data item;
[0261] The third acquisition module 1003 is used to process the semantic feature and obtain the semantic label of the target field.
[0262] The apparatus provided in this application obtains the semantic label of any target field in a relational database based on the semantic features of each data item corresponding to the target field. Since the semantic features depend on each data item, they will not change according to the name of the target field, thereby improving the recognition accuracy of the semantic label.
[0263] In one possible implementation, the second acquisition module 1002 includes:
[0264] The first encoding unit is used to call the first translation model to encode the at least one data item to obtain the semantic feature. The first translation model is used to obtain the semantic feature based on the at least one data item.
[0265] In one possible implementation, the first encoding unit is used for:
[0266] The at least one data item is segmented to obtain a first segmented sequence including at least one character, which includes a classifier and characters obtained from the segmentation of the at least one data item;
[0267] The first word segmentation sequence is input into at least one bidirectional encoding layer in the first translation model. The first word segmentation sequence is forward encoded and backward encoded by the at least one bidirectional encoding layer to output a first semantic vector sequence. In the first semantic vector sequence, one first semantic vector corresponds to one character in the first word segmentation sequence.
[0268] The first semantic vector in the first semantic vector sequence that corresponds to the classifier is determined as the semantic feature.
[0269] In one possible implementation, the second acquisition module 1002 includes:
[0270] The first acquisition unit is used to acquire the context information of the target field, which includes data items of other fields that correspond to the same relational data as the target field;
[0271] The second encoding unit is used to call the second translation model to encode the at least one data item and the context information to obtain the semantic feature. The second translation model is used to obtain the semantic feature based on the at least one data item and the context information.
[0272] In one possible implementation, the second encoding unit is used for:
[0273] The at least one data item and the context information are segmented to obtain a second segmentation sequence including at least one character, which includes a classifier, a character obtained from the segmentation of the at least one data item and the context information, and a statement separator.
[0274] The second word segmentation sequence is input into at least one bidirectional encoding layer in the second translation model. The second word segmentation sequence is then forward-encoded and backward-encoded by the at least one bidirectional encoding layer to output a second semantic vector sequence. In the second semantic vector sequence, one second semantic vector corresponds to one character in the second word segmentation sequence.
[0275] The second semantic vector in the second semantic vector sequence that corresponds to the classifier is determined as the semantic feature.
[0276] In one possible implementation, the third acquisition module 1003 includes:
[0277] The second acquisition unit is used to acquire at least one first prediction probability based on the semantic feature, wherein the first prediction probability is used to represent the degree of matching between the semantic feature and a semantic label;
[0278] The first determining unit is used to determine the semantic label corresponding to the largest first prediction probability among the at least one first prediction probabilities as the semantic label of the target field.
[0279] In one possible implementation, the device further includes:
[0280] The query module is used to query the knowledge base for at least one candidate category corresponding to the at least one data item, wherein one data item corresponds to one or more candidate categories;
[0281] An encoding module is used to encode the at least one candidate category to obtain the first category feature of the at least one data item;
[0282] The dimensionality reduction module is used to reduce the dimensionality of the first category feature of the at least one data item to obtain the second category feature of the at least one data item.
[0283] In one possible implementation, the third acquisition module 1003 includes:
[0284] The third acquisition unit is used to acquire the average embedding feature of the at least one data item;
[0285] The first concatenation unit is used to concatenate the average embedded feature with the second category feature to obtain the first concatenation feature;
[0286] The fourth acquisition unit is used to acquire the semantic label of the target field based on the first concatenation feature and the semantic feature.
[0287] In one possible implementation, the fourth acquisition unit is used for:
[0288] Based on the semantic feature, at least one first prediction probability is obtained, and the first prediction probability is used to represent the degree of matching between the semantic feature and a semantic label;
[0289] Based on the first splicing feature, at least one second prediction probability is obtained, and the second prediction probability is used to represent the degree of matching between the first splicing feature and a semantic label;
[0290] The at least one first prediction probability and the at least one second prediction probability are weighted respectively to obtain at least one third prediction probability;
[0291] The semantic label corresponding to the maximum third prediction probability among the at least one third prediction probability is determined as the semantic label of the target field.
[0292] In one possible implementation, the third acquisition module 1003 includes:
[0293] The second concatenation unit is used to concatenate the second category feature with the semantic feature to obtain the second concatenation feature;
[0294] The fifth acquisition unit is used to acquire at least one fourth prediction probability based on the second splicing feature, wherein the fourth prediction probability is used to represent the degree of matching between the second splicing feature and a semantic label;
[0295] The second determining unit is used to determine the semantic label corresponding to the maximum fourth prediction probability among the at least one fourth prediction probability as the semantic label of the target field.
[0296] It should be noted that the semantic tag acquisition device provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the node device can be divided into different functional modules to complete all or part of the functions described above. In addition, the semantic tag acquisition device and the semantic tag acquisition method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the semantic tag acquisition method embodiments, which will not be repeated here.
[0297] Figure 11 This is a schematic diagram of a node device provided in an embodiment of this application. Taking the node device as a terminal as an example, optionally, the device type of the terminal 1100 includes: a smartphone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer, or a desktop computer. The terminal 1100 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal, or other names.
[0298] Typically, terminal 1100 includes a processor 1101 and a memory 1102.
[0299] Optionally, the processor 1101 includes one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Optionally, the processor 1101 is implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). In some embodiments, the processor 1101 includes a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 1101 integrates a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 1101 also includes an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0300] In some embodiments, the memory 1102 includes one or more computer-readable storage media, optionally non-transitory. Optionally, the memory 1102 also includes high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1102 is used to store at least one program code, which is executed by the processor 1101 to implement the semantic tag acquisition method provided in the various embodiments of this application.
[0301] In some embodiments, the terminal 1100 may also optionally include: a peripheral device interface 1103 and at least one peripheral device. The processor 1101, memory 1102, and peripheral device interface 1103 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1103 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of: a radio frequency circuit 1104, a display screen 1105, a camera assembly 1106, an audio circuit 1107, and a power supply 1109.
[0302] Peripheral device interface 1103 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1101 and memory 1102. In some embodiments, processor 1101, memory 1102 and peripheral device interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1101, memory 1102 and peripheral device interface 1103 are implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0303] The radio frequency (RF) circuit 1104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1104 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the RF circuit 1104 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. Optionally, the RF circuit 1104 communicates with other terminals via at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1104 also includes circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0304] Display screen 1105 is used to display a UI (User Interface). Optionally, the UI includes graphics, text, icons, videos, and any combination thereof. When display screen 1105 is a touch display screen, display screen 1105 also has the ability to collect touch signals on or above the surface of display screen 1105. The touch signals can be input to processor 1101 for processing as control signals. Optionally, display screen 1105 is also used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, there is one display screen 1105, which is set on the front panel of terminal 1100; in other embodiments, there are at least two display screens 1105, which are respectively set on different surfaces of terminal 1100 or have a folded design; in still other embodiments, display screen 1105 is a flexible display screen, which is set on the curved surface or folded surface of terminal 1100. Furthermore, optionally, display screen 1105 is set as a non-rectangular irregular shape, that is, an irregularly shaped screen. Optionally, the display screen 1105 is made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0305] The camera assembly 1106 is used to acquire images or videos. Optionally, the camera assembly 1106 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 1106 also includes a flash. Optionally, the flash is a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm-light flash and a cool-light flash, used for light compensation at different color temperatures.
[0306] In some embodiments, the audio circuit 1107 includes a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input to the processor 1101 for processing, or input to the radio frequency circuit 1104 to realize voice communication. For stereo acquisition or noise reduction purposes, multiple microphones are used, respectively located at different parts of the terminal 1100. Optionally, the microphone is an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert electrical signals from the processor 1101 or the radio frequency circuit 1104 into sound waves. Optionally, the speaker is a conventional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves that humans can hear, but also convert electrical signals into sound waves that humans cannot hear for purposes such as ranging. In some embodiments, the audio circuit 1107 also includes a headphone jack.
[0307] The power supply 1109 is used to power the various components in the terminal 1100. Optionally, the power supply 1109 is AC power, DC power, a disposable battery, or a rechargeable battery. When the power supply 1109 includes a rechargeable battery, the rechargeable battery supports wired or wireless charging. The rechargeable battery also supports fast charging technology.
[0308] In some embodiments, the terminal 1100 further includes one or more sensors 1110. The one or more sensors 1110 include, but are not limited to: an acceleration sensor 1111, a gyroscope sensor 1112, a pressure sensor 1113, an optical sensor 1115, and a proximity sensor 1116.
[0309] In some embodiments, the accelerometer 1111 detects the magnitude of acceleration along the three coordinate axes of a coordinate system established with the terminal 1100. For example, the accelerometer 1111 is used to detect the components of gravitational acceleration along the three coordinate axes. Optionally, the processor 1101 controls the display screen 1105 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by the accelerometer 1111. The accelerometer 1111 is also used for collecting motion data from games or users.
[0310] In some embodiments, the gyroscope sensor 1112 detects the orientation and rotation angle of the terminal 1100. The gyroscope sensor 1112 and the accelerometer sensor 1111 work together to acquire the user's 3D movements on the terminal 1100. Based on the data acquired by the gyroscope sensor 1112, the processor 1101 implements the following functions: motion sensing (e.g., changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0311] Optionally, the pressure sensor 1113 is disposed on the side bezel of the terminal 1100 and / or on the lower layer of the display screen 1105. When the pressure sensor 1113 is disposed on the side bezel of the terminal 1100, it can detect the user's grip signal on the terminal 1100, and the processor 1101 performs left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 1113. When the pressure sensor 1113 is disposed on the lower layer of the display screen 1105, the processor 1101 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 1105. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0312] An optical sensor 1115 is used to collect ambient light intensity. In one embodiment, the processor 1101 controls the display brightness of the display screen 1105 based on the ambient light intensity collected by the optical sensor 1115. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1105 is increased; when the ambient light intensity is low, the display brightness of the display screen 1105 is decreased. In another embodiment, the processor 1101 also dynamically adjusts the shooting parameters of the camera assembly 1106 based on the ambient light intensity collected by the optical sensor 1115.
[0313] The proximity sensor 1116, also known as a distance sensor, is typically mounted on the front panel of the terminal 1100. The proximity sensor 1116 is used to detect the distance between the user and the front of the terminal 1100. In one embodiment, when the proximity sensor 1116 detects that the distance between the user and the front of the terminal 1100 is gradually decreasing, the processor 1101 controls the display screen 1105 to switch from a screen-on state to a screen-off state; when the proximity sensor 1116 detects that the distance between the user and the front of the terminal 1100 is gradually increasing, the processor 1101 controls the display screen 1105 to switch from a screen-off state to a screen-on state.
[0314] Those skilled in the art will understand that Figure 11 The structure shown does not constitute a limitation on terminal 1100, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0315] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including at least one line of program code, which can be executed by a processor in a terminal to complete the semantic tag acquisition method in the above embodiments. For example, the computer-readable storage medium includes ROM (Read-Only Memory), RAM (Random-Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage devices, etc.
[0316] In an exemplary embodiment, a computer program product or computer program is also provided, including one or more lines of program code stored in a computer-readable storage medium. One or more processors of a node device are capable of reading the one or more lines of program code from the computer-readable storage medium, and the one or more processors execute the one or more lines of program code, enabling the node device to perform the semantic tag acquisition method described in the above embodiments.
[0317] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. Optionally, the program is stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0318] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for acquiring a semantic label, characterized by, The method comprises: obtaining at least one data item corresponding to a target field to be identified in a relational database, the target field to be identified being a relational attribute, and the target field being any column in any data table in the relational database; obtaining a semantic feature of the target field based on the at least one data item; processing the semantic feature to obtain a semantic label of the target field; the obtaining of the semantic feature of the target field based on the at least one data item comprises: obtaining context information of the target field, the context information comprising data items of other fields corresponding to the same relational data as the target field, and the context information being data items of other fields in the data table where the target field is located and matching the data item type of the at least one data item; encoding the at least one data item and the context information by calling a second translation model to obtain the semantic feature, the second translation model being used to obtain the semantic feature based on the at least one data item and the context information.
2. The method of claim 1, wherein, the obtaining of the semantic feature of the target field based on the at least one data item comprises: encoding the at least one data item by calling a first translation model to obtain the semantic feature, the first translation model being used to obtain the semantic feature based on the at least one data item.
3. The method of claim 2, wherein, the encoding of the at least one data item by calling the first translation model to obtain the semantic feature comprises: performing word segmentation processing on the at least one data item to obtain a first word segmentation sequence comprising at least one character, the at least one character comprising a classifier and a character obtained by performing word segmentation processing on the at least one data item; inputting the first word segmentation sequence into at least one bidirectional encoding layer in the first translation model, performing forward encoding and reverse encoding on the first word segmentation sequence through the at least one bidirectional encoding layer, and outputting a first semantic vector sequence, one first semantic vector in the first semantic vector sequence corresponding to one character in the first word segmentation sequence; determining a first semantic vector corresponding to the classifier in the first semantic vector sequence as the semantic feature.
4. The method of claim 1, wherein, the encoding of the at least one data item and the context information by calling the second translation model to obtain the semantic feature comprises: performing word segmentation processing on the at least one data item and the context information to obtain a second word segmentation sequence comprising at least one character, the at least one character comprising a classifier, a character obtained by performing word segmentation processing on the at least one data item and the context information, and a sentence separator; inputting the second word segmentation sequence into at least one bidirectional encoding layer in the second translation model, performing forward encoding and reverse encoding on the second word segmentation sequence through the at least one bidirectional encoding layer, and outputting a second semantic vector sequence, one second semantic vector in the second semantic vector sequence corresponding to one character in the second word segmentation sequence; determining a second semantic vector corresponding to the classifier in the second semantic vector sequence as the semantic feature.
5. The method of claim 1, wherein, The processing of the semantic feature to obtain the semantic label of the target field comprises: obtaining at least one first prediction probability based on the semantic feature, wherein each first prediction probability represents a matching degree between the semantic feature and a semantic label; determining the semantic label corresponding to the maximum first prediction probability in the at least one first prediction probability as the semantic label of the target field.
6. The method of claim 1, wherein, Before the processing of the semantic feature to obtain the semantic label of the target field, the method further comprises: querying at least one candidate category corresponding to the at least one data item from a knowledge base, wherein each data item corresponds to one or more candidate categories; encoding the at least one candidate category to obtain first category features of the at least one data item; dimensionally reducing the first category features of the at least one data item to obtain second category features of the at least one data item.
7. The method of claim 6, wherein, The processing of the semantic feature to obtain the semantic label of the target field comprises: obtaining average embedding features of the at least one data item; splicing the average embedding features and the second category features to obtain first spliced features; obtaining the semantic label of the target field based on the first spliced features and the semantic feature.
8. The method of claim 7, wherein, The obtaining of the semantic label of the target field based on the first spliced features and the semantic feature comprises: obtaining at least one first prediction probability based on the semantic feature, wherein each first prediction probability represents a matching degree between the semantic feature and a semantic label; obtaining at least one second prediction probability based on the first spliced features, wherein each second prediction probability represents a matching degree between the first spliced features and a semantic label; respectively performing weighted processing on the at least one first prediction probability and the at least one second prediction probability to obtain at least one third prediction probability; determining the semantic label corresponding to the maximum third prediction probability in the at least one third prediction probability as the semantic label of the target field.
9. The method of claim 6, wherein, The processing of the semantic feature to obtain the semantic label of the target field comprises: splicing the second category features and the semantic feature to obtain second spliced features; obtaining at least one fourth prediction probability based on the second spliced features, wherein each fourth prediction probability represents a matching degree between the second spliced features and a semantic label; determining the semantic label corresponding to the maximum fourth prediction probability in the at least one fourth prediction probability as the semantic label of the target field.
10. A semantic tag acquisition apparatus characterized by comprising: The device comprises: a first obtaining module configured to obtain at least one data item corresponding to a target field to be identified in a relational database, wherein the target field to be identified refers to a relational attribute to be identified, and the target field refers to any column in any data table in the relational database; a second obtaining module configured to obtain a semantic feature of the target field based on the at least one data item; a third obtaining module configured to process the semantic feature to obtain a semantic label of the target field; the second obtaining module comprises: The first obtaining unit is configured to obtain context information of the target field, the context information comprising data items of other fields corresponding to the same relational data as the target field, and the context information referring to data items of other fields in a data table where the target field is located and matching data item types of the at least one data item; The second encoding unit is configured to encode the at least one data item and the context information by invoking a second translation model to obtain the semantic feature, the second translation model being configured to obtain the semantic feature based on the at least one data item and the context information.
11. The apparatus of claim 10, wherein, The second obtaining module further comprises: The first encoding unit is configured to encode the at least one data item by invoking a first translation model to obtain the semantic feature, the first translation model being configured to obtain the semantic feature based on the at least one data item.
12. The apparatus of claim 11, wherein, The first encoding unit is configured to: perform tokenization processing on the at least one data item to obtain a first token sequence comprising at least one character, the at least one character comprising a classifier and a character obtained by tokenization processing on the at least one data item; input the first token sequence into at least one bidirectional encoding layer in the first translation model, perform forward encoding and reverse encoding on the first token sequence through the at least one bidirectional encoding layer, and output a first semantic vector sequence, one first semantic vector in the first semantic vector sequence corresponding to one character in the first token sequence; determine a first semantic vector corresponding to the classifier in the first semantic vector sequence as the semantic feature.
13. The apparatus of claim 10, wherein, The second encoding unit is configured to: perform tokenization processing on the at least one data item and the context information to obtain a second token sequence comprising at least one character, the at least one character comprising a classifier, a character obtained by tokenization processing on the at least one data item and the context information, and a sentence separator; input the second token sequence into at least one bidirectional encoding layer in the second translation model, perform forward encoding and reverse encoding on the second token sequence through the at least one bidirectional encoding layer, and output a second semantic vector sequence, one second semantic vector in the second semantic vector sequence corresponding to one character in the second token sequence; determine a second semantic vector corresponding to the classifier in the second semantic vector sequence as the semantic feature.
14. The apparatus of claim 10, wherein, The third obtaining module comprises: The second obtaining unit is configured to obtain at least one first prediction probability based on the semantic feature, one first prediction probability being used to represent a matching degree between the semantic feature and a semantic label; The first determining unit is configured to determine a semantic label corresponding to a maximum first prediction probability in the at least one first prediction probability as the semantic label of the target field.
15. The apparatus of claim 10, wherein, The device further comprises: The query module is configured to query at least one candidate category corresponding to the at least one data item from a knowledge base, one data item corresponding to one or more candidate categories; The encoding module is configured to encode the at least one candidate category to obtain a first category feature of the at least one data item; The dimension reduction module is configured to reduce dimension of the first category feature of the at least one data item to obtain a second category feature of the at least one data item.
16. The apparatus of claim 15, wherein, The third obtaining module comprises: The third obtaining unit is configured to obtain an average embedding feature of the at least one data item. The first splicing unit is configured to splice the average embedding feature and the second category feature to obtain a first spliced feature. The fourth obtaining unit is configured to obtain a semantic label of the target field based on the first spliced feature and the semantic feature.
17. The apparatus of claim 16, wherein, The fourth obtaining unit is configured to: obtain at least one first prediction probability based on the semantic feature, where one first prediction probability is used to represent a matching degree between the semantic feature and one semantic label; obtain at least one second prediction probability based on the first spliced feature, where one second prediction probability is used to represent a matching degree between the first spliced feature and one semantic label; perform weighted processing on the at least one first prediction probability and the at least one second prediction probability respectively to obtain at least one third prediction probability; and determine a semantic label corresponding to a maximum third prediction probability in the at least one third prediction probability as the semantic label of the target field.
18. The apparatus of claim 15, wherein, The third obtaining module comprises: The second splicing unit is configured to splice the second category feature and the semantic feature to obtain a second spliced feature. The fifth obtaining unit is configured to obtain at least one fourth prediction probability based on the second spliced feature, where one fourth prediction probability is used to represent a matching degree between the second spliced feature and one semantic label. The second determining unit is configured to determine a semantic label corresponding to a maximum fourth prediction probability in the at least one fourth prediction probability as the semantic label of the target field.
19. A node device, characterized by The node device comprises one or more processors and one or more memories, and the one or more memories store at least one program code, which is loaded and executed by the one or more processors to implement the semantic label obtaining method in any one of claims 1 to 9.
20. A storage medium, characterized by The storage medium stores at least one program code, which is loaded and executed by the processor to implement the semantic label obtaining method in any one of claims 1 to 9.
21. A computer program product, comprising one or more program codes stored in a computer readable storage medium, one or more processors of a node device being capable of reading the one or more program codes from the computer readable storage medium, and the one or more processors executing the one or more program codes so that the node device is enabled to perform to implement the semantic label obtaining method in any one of claims 1 to 9.
Citation Information
Patent Citations
Intention recognition method and device, electronic equipment and readable storage medium
CN110928997A